Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

semaja2

macrumors 6502a
Original poster
Dec 12, 2005
576
18
Adelaide
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

macrumors G4
Nov 3, 2005
10,434
12,250
UK
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

Moderator emeritus
Jun 15, 2000
7,958
7
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:
Code:
[NSApp activateIgnoringOtherApps:YES];

Regarding windowDidLoad, is your controller a NSWindowController subclass?
 

semaja2

macrumors 6502a
Original poster
Dec 12, 2005
576
18
Adelaide
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.
 

Attachments

  • NSStatusBar-Error.zip
    53.4 KB · Views: 106
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.