PDA

View Full Version : windowDidLoad




semaja2
Feb 17, 2007, 10:03 AM
Hey,

I seem to be having trouble, i need to call my application to the front when a menu item is called (due to the app being a NSMenuBar item)

Im just using basic AS code in ObjC that activates the app, this works when im manually do it in script editor.

However heres the problem, im unable to make the windowDidLoad method to be called, is there any one that can help me with detecting a window load or open



Eraserhead
Feb 17, 2007, 10:19 AM
However heres the problem, im unable to make the windowDidLoad method to be called, is there any one that can help me with detecting a window load or open

The the windows delegate the controller with the method? Is the method in the header file? And have you tried reloading the controller in the nib?

kainjow
Feb 17, 2007, 10:50 AM
Im just using basic AS code in ObjC that activates the app, this works when im manually do it in script editor.

Ew ;)

AppleScript should never be used in Cocoa unless you absolutely need it - and that is when you're communicating between applications, not doing system tasks.

If you want to bring your app to the front, use:
[NSApp activateIgnoringOtherApps:YES];

Regarding windowDidLoad, is your controller a NSWindowController subclass?

semaja2
Feb 25, 2007, 07:30 PM
Heres a small example of my problem,

Clicking on window1 will just call the window open using a normal connection (The way i do in my apps)

Clicking on window2 will call the window by coding as well as make the app come to the front

Clicking on about is the same as window1 but calling the standard about window

PS. Once you open the app switch to like finder and use the menu item.