cocoa

NSTextView syntax highlighting

I'm working on a Cocoa text editor which uses an NSTextView. Is it possible to change the color of certain portions of the text? ...

NStimer -- what am I doing wrong here?

I've been using an NSTimer successfully, but am now having trouble with it. Undoubtably something stupid. Appreciate another set of eyes. Running the debugger, I see that applicationDidFinishLaunching is called, but trigger is never called. -(void) trigger:(NSTimer *) theTimer{ NSLog(@"timer fired"); } - (void)applicationDidFinishL...

How to get audio data from the Macbook microphone?

I am looking to write a small audio processing program, and I need some way to get audio input from the microphone in a Macbook. Buffer polling? Notifications? What class/framework should I be aware of? ...

Cocoa Binding, how to ask 'view' side to scroll to selection

Currently, I'm binding the NSArray to NSArrayController and then to a NSTableView, so the data and selection is working correctly, but seems I can't tell table view to scroll to selection from NSArrayController. Do I have to add an NSTableView outlet? I certainly can do that, but I'd try to see if there's a better way to avoid introduci...

Drag/Drop File from/in webview

Hi All I am making an application featured like mac mail as in mac mail if we drop a file in message area then that file is as an attached file and we can drag that file to desktop and double click on the file to open it. I am using webview(I think webview is used in mac mail) Can anybody suggest me how can I do this Thanks Amit Batta...

How can I delay pasting promised data after it is requested ?

Hi, I am writing an application which enables the user to share the pasteboard of his local machine with that of a remote Mac to which the user connects to. The application I am writing runs on the remote Mac. It all works fine, but sometimes the pasteboard data can get large and take quite some time to travel over the network. This ...

NSTextField over NSOpenGLView

I have made a window with an NSOpenGLView that I am rendering openGL content into. I want to add some buttons and text fields to the view: I can add NSTextFields and NSButtons using interface builder (or code) but they do not appear. NSOpenGLView is documented as not being able to have sub views, so I then made my own CustomGLView by d...

Custom NSTextView autocompletion menu

How would one implement a custom auto-complete pop-up menu like Xcode has? At the moment I can only put custom auto-completions using - (NSArray *)textView:theTextView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(int *)index I want a bit more flexibility than this. Cheers! MT ...

In MVC where do you put references to your model Classes?

I have been wondering for a while, after asking different people and without any of them providing what I would call an "at least a bit concrete answer": Question: Where, in an iPhone application should an application keep the references to it's Model Classes (using the MVC approach) ? In iPhone (and Cocoa) applications we have what w...

Core Data calculation result at startup

Thanks for the help. I have a doc based Core Data app consisting of a table with two columns. The column cells are populated with US Currency dollar values. I have two labels at the bottom of each column with Number formatters. Each label displays the sum of it's respective column. I'm doing this with bindings: Bound to the arrayContr...

How to send multi-touch events from one Cocoa App to another?

Is there a way to send a multi-touch event (something like NSEventTypeMagnify) from one cocoa app to another, so that I could for instance tell iPhoto to zoom into a picture? ...

get process(e.g. TextEdit) as an object in cocoa

hi. I am a newbie and i want to get a process or a key window as an object as i need to send message to it.In fact , i need to get them so that i can manipulate them with my input method kid(IMKit). the corresponding method is -(BOOL)inputText:key:modifiers:client: i want the key window/process receive the event as client. I am appre...

How to get a unique identifier for a protocol object

I'm trying to make a dictionary store a map of delegates that correspond to a protocol. I need some consistent key that represent a protocol. For example the following gives me a protocol object Protocol * one = @protocol(SomeProtocolDefinedEarlier); And it responds to [one hash] but the hash isn't the same each time you get a proto...

Send more than 32768 Bytes at once from one TCP-Socket to an other

Hey guys, I don't know if this question has been asked yet but imagine following situation: I have two TCP-Sockets (opened with NSSocketPort und listening with two NSFileHandle) and now I want to send some NSData between them. @try { [fileHandle writeData:data]; } @catch (NSException * e) { // Do some alert } Everything is ri...

NSDateComponents - EXC_BAD_ACCESS error

Basic question to which I'm sure there is a simple answer. I'm trying to get the timestamp of a photo. When I try to access the NSDateComponents to retrieve a specific date element (say "day" for example), I get a EXC_BAD_ACCESS error. First, the relevant bits of my code: // formattedDateString is a string representing the "DateTimeO...

How to re-show main window after closed in Cocoa ?

I want to re-show the main window after closed when click my app icon on dock. Anyone know how to do it ? Thanks in advance. ...

GUI-less App Bundle

I would like to create a helper application that has no GUI yet does have access to an app bundle. I was looking at the Xcode command line project templates, but these all just generate executable files. How can I create something like a command line tool that presents no application menu yet provides access to bundle resources in a .app...

NSButton state != 0 when alloc'd

I have two projects that include the same code: NSButton *button = [[NSButton alloc] initWithFrame:ctrlRect]; (gdb) print (int)[button state] $1 = 1 in the other project $1 = 0 I am compiling both with GCC 4.2, 10.6 - no other apparent differences in compiler settings. If I alloc/init an NSButton earlier in the app, state = 0 wh...

Open panel appears then disappears immediately

Hi, I am using this code: NSOpenPanel *openPanel = [NSOpenPanel openPanel]; [openPanel beginForDirectory:nil file:nil types:[NSImage imageFileTypes] modelessDelegate:self didEndSelector:NULL contextInfo:NULL]; This is the only code in the method. When the method is called, the open panel appears on-screen for a second then di...

Changing the volume of a QTMovie playing an mp3

Hello, I'm using a QTMovie to play audio tracks. I've just started playing around with the volume controls and I'm changing the volume using setVolume:(float)newVolume. The problem I'm having is that the volume change seems very very miniscule. I have tried varying the volume between 0 and 10 and 0 and 128 (the maximum) and the differen...