PDA

View Full Version : Bring a window to the front




prostuff1
Feb 17, 2009, 09:42 PM
I am modifying the code of Transmission to include a crude menulet. As of now it only displays the upload and download speed, pause all torrents, resume all torrents, toggle the speed limit and bring up some of the Transmission windows.

The one problem I am having is that if i hide the app or minimize it and then use the menulet to bring up the main Transmission it does not come to the front.

I have done some basic searching but could not find anything.

What code would i need to add to make the window come to the front when selecting it from the menulet.



kainjow
Feb 18, 2009, 12:46 AM
You probably need to activate the app also. Try this:
[NSApp activateIgnoringOtherApps:YES];
[window makeKeyAndOrderFront:nil];

hiddenpremise
Feb 18, 2009, 06:20 AM
Make the controller for your the NIB for your window to be an NSWindowController. Then cntrl drag from that class in interface builder to the window and select "window"

In your code write
[self showWindow:self];
Or from another controller
[myNibController showWindow:self];

prostuff1
Feb 18, 2009, 11:18 AM
Thank you both. This worked the way i wanted it to and it was easy enough to modify the code. I figured it was something simple but could not find the reference for it.