Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Changing icons based on Graphite?

Changing icons based on Graphite?
Thread Tools
iOliverC
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Feb 24, 2004, 01:43 PM
 
What I want to do is change my toolbar icons to graphite if the option is checked. Is there any example code for this? I couldn't find any on Mamasam.
     
calumr
Forum Regular
Join Date: Sep 2000
Location: UK
Status: Offline
Reply With Quote
Feb 24, 2004, 02:18 PM
 
     
iOliverC  (op)
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Feb 24, 2004, 03:20 PM
 
I tried the code you linked to, in my NSDocument subclass which has a toolbar:

Code:
- (void)systemTintChangedNotification:(NSNotification *)notification; { NSString *newDocImage; if ([NSColor currentControlTint] == NSGraphiteControlTint) newDocImage=@"NewDocGraphite"; else newDocImage=@"NewDocAqua"; }
I then changed my New toolbar item image to [NSImage imageNamed:newDocImage] and tried to build, I realized it couldn't use newDocImage outside of
Code:
- (void)systemTintChangedNotification:(NSNotification *)notification;
So I put NSString *newDocImage; in my header and built. Before it could open I got a SigBus 10 then crashing. Any ideas?
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Feb 24, 2004, 07:45 PM
 
Originally posted by iOliverC:
I tried the code you linked to, in my NSDocument subclass which has a toolbar:

Code:
- (void)systemTintChangedNotification:(NSNotification *)notification; { NSString *newDocImage; if ([NSColor currentControlTint] == NSGraphiteControlTint) newDocImage=@"NewDocGraphite"; else newDocImage=@"NewDocAqua"; }
I then changed my New toolbar item image to [NSImage imageNamed:newDocImage] and tried to build, I realized it couldn't use newDocImage outside of
Code:
- (void)systemTintChangedNotification:(NSNotification *)notification;
So I put NSString *newDocImage; in my header and built. Before it could open I got a SigBus 10 then crashing. Any ideas?
If you've declared newDocImage in both your class header, and in the systemTint... method, then only the one in systemTint... will be assigned a value. The one declared in the class header will still have whatever random junk was in it's memory location when it was created, and therefore would cause crashing.

You need to assign some useful value to your class's newDocImage (perhaps just remove the declaration in the method?).
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 02:19 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,