cocoa

how can i send a keyboard event to the app through pressing a button?

in fact i am building a virtual keyboard how can i send a keyboard event to the program through pressing a button? thanks ...

How to simulate a low level keypress on os x?

Howdy, I am trying to generate keyboard keydown and keyup events programmatically. I am currently using CGPostKeyboardEvent to do this, but I am searching for a way to do this at a lower level. I have looked at DDHidLib but could not figure out a way to create a fake event. Can anyone help? update: Thanks to weichsel's advice I am...

Drawing a rounded cornered NSTextFieldCell

My code for my NSTextFieldCell is: - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { // Drawing code here. NSGradient *gradient = [[NSGradient alloc] initWithStartingColor:[NSColor lightGrayColor] endingColor:[NSColor grayColor]]; [gradient drawInRect:cellFrame angle:90]; [[self title] drawIn...

Sorting array(NSArray) in descending order

I have a array of NSString objects which I have to sort by descending. Since I did not find any API to sort the array in descending order I approached by following way. I wrote a category for NSString as listed bellow. (NSComparisonResult)CompareDescending:(NSString *)aString { NSComparisonResult returnResult = NSOrderedSame; r...

Testing Music Library in the iPhone emulator

I'd like to be able to debug my application in the iPhone emulator. The app uses the Media Library Framework so I'm not really sure whether I'm able to add songs to the emulator and actually try out the app there. Is this possible? Right now I'm just using the iPod directly for this... Thanks, rui ...

drawing in other processes windows on macosx?

Is it possible to draw in other processes windows on MacOSX using Cocoa or other libraries? If yes, are there any samples? Alternatively a quick summary of what i'd have to do? (I need to support at least OSX 10.5) Shared memory is of course a possible solution, but i'd prefer direct drawing to avoid synchronization overhead and code ...

Landscape mode and locationInView in opengl es

So today I implement landscape mode for my app. It is an opengl es application. I rotated it 90 degrees. The first thing I notice is that the touches no longer work. The reason being is that the call to locationInView is still giving the coordinates as though the application is in portrait mode. How do people typically deal with this...

NSOpenPanel above a fullscreen NSWindow ?

Hi - I open a window with the following: NSRect screenRect = [[NSScreen mainScreen] frame]; [super initWithContentRect:screenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; int windowLevel = CGShieldingWindowLevel(); [self setLevel:windowLevel]; ......

Only allow one NSWindow to be selectable until action is completed (Cocoa)

Hi all, I have a program with many windows open. I want all windows to be visible, but only one window can be interactable, until a certain event has occured. e.g. pressing a button. At the moment, I can still click another window, and interact with it, how do I only allow interaction with ONE window, until a certain event occurs? Ima...

Looking for a cocoa method to simulate a button press that does not have an Event as a paramter

I need to simulate a button press on my Cocoa button programatically and I am trying to do this on cocotron which unfortunately does not have the NSEvent method: mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure: implemented. Is there anyway to programatically simulate a button pre...

Reposition an NSBox in the top pane of a horizontal NSSplitView

I've worked for hours on this and I just can't get it - should be really basic stuff but it's not getting thru my thick skull. I think it has to do with the coordinate system in Cocoa but I really don't know. This is all happening in the top pane of a horizontal NSSplitView. Very simply, I'm trying to position one NSBox right below a ...

Button substitute keyboard

i am creating a virtual for my application in IMK(input method kit) i failed to simulate keyboard event by pressing a button. is there any library i can used for the simulation? is there any materials/solutions i can reference to? thanks Reply With Quote ...

How to set up gcov for code coverage analysis in iPhone SDK?

Hi, I've recently begun unit testing an app I write for the iPhone. I have the basics of creating my own tests down, even if it seems a little sub-optimal. I am, however, having real trouble setting up code coverage analysis using gcov. I followed the instructions here: http://www.cubiclemuses.com/cm/articles/2009/05/14/coverstory-on-t...

Can I move window using an object inside that window?

Hi all. Is it possible in Cocoa to move a window by dragging an object which is inside that window? For example: I have a webview inside a window, big as the window, so setMovableByWindowBackground will obviously not work. Is there a way to click and drag the web view and move the whole window? Any help would be very appreciated! —Alb...

Use NSFilehandle to serial-port communication ,why don't receive NSFilehandle's notification .

my source-code as belowed : a part of source-code as belowed : - (id)init { NSFileHandle *fh =[[NSFileHandle alloc] initWithFileDescriptor:myfileDescriptor closeOnDealloc:YES]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; [notificationCenter addObserver:self selector: @selector(getData:) ...

Bind an NSTableView to an array in the NSUserDefaults: Mutable!

My setup is an NSTableView with one column that is binded to the NSUserDefaults. Now that works perfectly, as long as nothing gets changed in my tableview. When I trie to change a value (all simple strings) i get the following error: Error setting value for key path of object Acid (from bound object <NSTableColumn: 0x1796ef10> ident...

Objective-c asynchronous communication: target/action or delegation pattern?

Hello folks, I'm dealing with some asynchronous communication situations (Event-driven XML parsing, NSURLConnection response processing, etc.). I'll try to briefly explain my problem: In my current scenario, there is a service provider (that can talk to a xml parser or do some network communication) and a client that can ask the servi...

Magic Mouse Momentum Scrolling Not Working

Unfortunately this is hard for me to test myself because I have yet to get a Magic Mouse of my own, but I've been told by my testers who do have a magic mouse that momentum scrolling isn't working in my app. I've not subclassed NSScrollView, but scrollview's document view is all custom. I have not overridden scrollWheel: anywhere, either...

Programatically Removing a Button from a Window in Cocoa OSX

I need to programatically remove a button from a window in Cocoa but the only method close to this was dealloc in NSObject, but this is not what I want to do. Is there a way to actually delete the button from the window not just deallocate its memory? ...

Getting a List of Applications Capable of Opening a Type of File

I'm trying to get a list of applications that are capable of opening a type of file. So far I've been able to get the name of a single application using NSWorkspace's getInfoForFile:application:type: method. Is there any API that I can call to get a list of applications capable of opening a file? ...