|
|
Changing icons based on Graphite?
|
|
|
|
Grizzled Veteran
Join Date: Jun 2002
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Sep 2000
Location: UK
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Jun 2002
Status:
Offline
|
|
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?
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status:
Offline
|
|
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 Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|