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, it seems the only guide that worked and everyone liked is giving me a 404, so does anyone know of some good guides or examples that are very easy to understand?

Im at the moment trying to read the growl source code but im lost in the code
 

whooleytoo

macrumors 604
Aug 2, 2002
6,607
716
Cork, Ireland.
Hey, it seems the only guide that worked and everyone liked is giving me a 404, so does anyone know of some good guides or examples that are very easy to understand?

Im at the moment trying to read the growl source code but im lost in the code

I've the source code of mine at home, I can post it tomorrow, if no one else has answered by then.
 

whooleytoo

macrumors 604
Aug 2, 2002
6,607
716
Cork, Ireland.
You could use the following. _systemMenu is an instance NSStatusItem* variable, and _menu is an IBOutlet pointing to a menu in the app's nib file.

Code:
- (void) showMenubarIcon
{
	NSImage*	icon = [NSImage imageNamed:@"MenuIcon"] ;
	
	NSStatusBar*	bar = [NSStatusBar systemStatusBar] ;
	_systemMenu = [bar statusItemWithLength:NSSquareStatusItemLength] ;
	[_systemMenu retain] ;
	
	[_systemMenu setTitle: nil] ;
	[_systemMenu setImage:icon] ;
	[_systemMenu setHighlightMode:YES] ;
	[_systemMenu setMenu:_menu] ;	
}

- (void) hideMenubarIcon
{	
	[_systemMenu release] ;
	_systemMenu = nil ;
}
 

semaja2

macrumors 6502a
Original poster
Dec 12, 2005
576
18
Adelaide
Thanks Whooelytoo, greatly appreciated. I used your code and some other examples to finally come up with my solution but i thought i should write a guide up for anyone else that might want to do this and is also a extreme n00b at ObjC :p

So if anyone wants to check out my first guide ive ever written : http://files.semaja2.net/NSStatusItem - ObjC.html

Comments appreciated and so is constructive criticism (I know about the missing bits in the @interface i will fix these up when i learn about them :p )
 

CaptainZap

macrumors regular
Jan 17, 2007
170
0
Hey great guide Semaja, I'm sure once I learn more about Obj-C and Cocoa I'll be using it =].
 

semaja2

macrumors 6502a
Original poster
Dec 12, 2005
576
18
Adelaide
Hey great guide Semaja, I'm sure once I learn more about Obj-C and Cocoa I'll be using it =].

Thanks ill be making it into a proper HTML page and stuff later on, the one in that link is just a export from pages so its kinda bloaty ;)
 

janey

macrumors 603
Dec 20, 2002
5,316
0
sunny los angeles
thanks whooleytoo and semaja2 :D
i've been looking around for guides and sample code, not much luck. great timing, as i was about to give up too :p

One thing though, the screenshots on the guide are really blurry - I know what you're doing and i get the point from the shots, but it's still blurry :(

on second thought, i just looked at an image and it's only blurry because it's enlarged in the guide..nevermind :D :eek:
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
I would suggest posting your guide at cocoadev.com also, so that others can find it easily, and if your site goes down or something, it'll always be accessible on cocoadev.com :)
 

semaja2

macrumors 6502a
Original poster
Dec 12, 2005
576
18
Adelaide
kainjow: thanks for the suggestion, once i finish the guide (few little bits needed cleaning) ill either post the link or have them host it

janey: i have a upcoming guide that explains how to interface with the Apple Remote, but im might increase the required base knowledge so that i can cut down on the confusion caused by the many screenshots i know have in the new guide :p

as for the screenshots, they were only added for a quick reference not to actually be read but your not the only one bringing up the point on bad quality
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.