cocoa

How can I stop HIToolbox from catching my exceptions?

This question follows on from my other question on why my app isn't being brought down by exceptions. The Problem When an exception is thrown on the main thread via an Action, the app still doesn't crash. As per Dave's answer to my original question, I've implemented the reportException category on NSApplication and set the uncaught e...

NSThreading for speed

I'm working on a game sim and want to speed up the match simulation bit. On a given date there may be 50+ matches that need simulating. Currently I loop through each and tell them to simulate themselves, but this can take forever. I was hoping 1) Overlay a 'busy' screen 2) Launch a thread for each 3) When the last thread exits, rem...

How to modify the fullscreen behavior of some apps in MacOSX

I recently got a Matrox Dualhead2Go for my Mac and now I have the problem that some applications that run in fullscreen stretch over two of my monitors. Matrox DH2G "simulates" one monitor with 3840x1200 resolution across my two 1920x1200 monitors. The main applications I want this for is VLC and when viewing flash video in fullscreen. ...

How do you make a view corresponding to a model subclass that holds view elements corresponding to the parent model class?

I have some UI elements that will share common parts with other UI elements. They correspond to model objects in an inheritance hierarchy. As an example let's say all Layers can be toggled on/off. All WaveLayers are Layers which additionally define a .wav filename. And there is a specific concrete subclass of WaveLayer called GroovyLaye...

Lua - Cocoa - String Concat - Simple Table to NSArray

Hi all, Mac OS X 10.5 compatibility, Lua 5.0 compatibility required (hence cannot use current batch of LuaObjc bridges.) My lua script produces an indexed table containing tens of thousands of strings. Basic problem: how to concat those strings with a newline separator, to one string, quickly? Fly in ointment: even using garbage-coll...

How can I make a window or NSPanel out of an image?

Hi everyone, I'm trying to add some style to my app and it's driving me crazy. I'm wanting to take a image that is transparent and use it as a window or NSPanel. I'm thinking this will have to be done programmatically but I would like to do it in Interface Builder. How can I achieve this effect either way. So far, I've tried both ways an...

How to prevent all rows of an NSTableView being selected at startup

I am new to Objective-C. I am using NSArrayController to fill NSTableView. Initially, I am getting all rows selected in the table view. I am unable to find the reason behind it. ...

Are there any good tutorials for Mac GUI Applications with Cocoa?

I has read some sample codes from Mac dev, and wrote currencyApplication by self. But I still cannot understand clearly how to implement Mac GUI Applications. From NSWindowController class reference, I found a Document-Based Applications Overview pdf for Documents Applications. But I want something like Dialog Programming in MFC. Are ...

NSPopUpButton revert to initial state

Hi, I register for notification NSPopUpButtonWillPopUpNotification in order to change the pop up menu before it is shown. The new pop up menu consist of running Application list with respected icons. When the application is selected, it calls a @selector method. After selection completes, the button have the image of the selected appl...

Removing leading zeroes from a string.

I have a string 0023525631 but what I want is the string 23525631 without the leading zeroes. How do I do this; I am confused about it. ...

Cocoa: How do you make the background of an IKImageBrowserView transparent?

How do you make the background of an IKImageBrowserView transparent? There seems to be no background color option in interface builder. What I've tried: I've never used Core Animation, but I saw IKImageBrowserView has a setBackgroundLayer method, so I tried the following, which had no effect: CALayer* layer = [CALayer layer]; [layer...

Graphics not appearing properly over print layout of web view

Hi all, I am trying to obtain print of html content over web view, using this method : [sampleWebView print:nil]; // where sampleWebView is an object of WebView In html I am drawing a line using this- <hr size=\"4\" noshade=\"noshade\" class=\"style1\" /> And a small colored circle using this- &#x25CF; In web view it is appear...

In NSWindowController subclass, [self document] returns null

I am using a custom subclass of NSDocument and a custom subclass of NSWindowController. The problem is that I cannot reference my custom document from my custom window controller. In IB, in the TKDocument NIB I have File's Owner set to TKWindowController. In my TKDocument subclass I have: - (void) makeWindowControllers { TKWindow...

NSEvent modifier flags not updating until mouse moves.

In Mac OS X 10.6, NSEvent has a +modifierFlags class method to determind the currently pressed modifier flags. In 10.5, using [[NSApp currentEvent] modifierFlags] only updates after mouse move. Is there any way to asynchronously get the modifier flags? ...

Why would you drain an autorelease pool instead of releasing it?

Why would you drain an autorelease pool instead of releasing it? ...

What is iTunes for Windows written of?

I was wondering it for a long time since Apple released iTunes for Windows. What did they use to write iTunes for Windows? It seems completely with its own UI components and everything is contained inside it. It even uses QuickTime resources files. Can we assume that they've Cocoa working with windows. Anyway, my main question is, is the...

Cocoa asyncsocket class problem

Hey I am making server client system with asyncsocket class for cocoa, I really don't get it, do I have to send a message to the server in order to receive something, it seems so. Server should send me a message when I connect, but I won't get anything unless I send the server a message which goes pretty strange, same applies, I have to ...

Argument comparison order

I'm a seasoned programmer and therefore feel a little embarrassed asking this question but decided to do so anyways. I'm reading this book, and have also seen various examples across the net where the order of arguments in a compare operation is reversed and I wonder if there is a reason for it, or just because it looks "cool" and does ...

Access scrollPhase in NSEvent

How do I access the property scrollPhase in an NSEvent of type NSScrollEvent (in OS X 10.6)? - (void)scrollWheel:(NSEvent *)event { NSLog(@"Scroll Event: %@", event); } If I write the event to the log, I can see the desired information: ... Scroll Wheel Event: NSEvent: type=ScrollWheel ... scrollPhase=Continue ... Scroll Wheel E...

NSTask with bash script problem

For example, i have this simple bash script: #!/bin/sh cd $1; And this cocoa wrapper for it: NSTask *cd = [[NSTask alloc] init]; NSString *testFolder = [NSString stringWithString:@"/Users/test/Desktop/test 1"]; [cd setLaunchPath:@"/bin/sh"]; [cd setArguments:[NSArray arrayWithObjects:[[NSBundle mainBundle] ...