display an image in a button
display an image in a button
- Subject: display an image in a button
- From: email@hidden
- Date: Tue, 17 Feb 2004 00:07:39 EST
Information:
_______________________________________________
from header
_______________________________________________
//Titles and Messages
#define LOCK_MSG @"Click to allow changes"
#define UNLOCK_MSG @"Click to disallow changes"
//Button Images
#define LOCK_IMG @"lock"
#define UNLOCK_IMG @"unlock"
_______________________________________________
from source
_______________________________________________
- (IBAction)toggleAuthorization:(id)sender
{
if([[Authorize sharedInstance]isAuthenticated])
{
[[Authorize sharedInstance]deauthenticate];
[applyButton setEnabled:NO];
[myPopUp setEnabled:NO];
[lockButton setImage:[NSImage imageNamed:LOCK_IMG]];
[authLabel setStringValue:LOCK_MSG];
}
else
{
if([[Authorize sharedInstance]authenticate])
{
[applyButton setEnabled:YES];
[myPopUp setEnabled:YES];
[lockButton setImage:[NSImage imageNamed:UNLOCK_IMG]];
[authLabel setStringValue:UNLOCK_MSG];
}
}
_______________________________________________
Problem:
As long as application or bundle is using a nib "Window" the images update as
directed.
My problem seems to exist because the bndl's nib is using a "Custom View" and
when I try to change the image from one pic to another it doesn't display the
image and from what I can tell, it thinks that the button has no image
assigned to it and it's a text button with no text.
The type of button is an NSButton, with the following attributes.
type is "Round Button"
icon is "lock"
behavior is "Momentary Push In"
Bordered (checked)
Enabled (checked)
Small (checked)
I've gone over the docs on NSButtons and I don't see what's missing, what I'm
using is from an Apple tutorial (Window based) and other than using a Custom
View, I don't see why it wont change the image, the log doesn't show any
exceptions or errors when running and knowing that if I move it to a Window it
works leads me to believe it's a problem with the properties in the Custom View.
Any ideas????
_______________________________________________
Dale
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.