Re: display an image in a button
Re: display an image in a button
- Subject: Re: display an image in a button
- From: email@hidden
- Date: Tue, 17 Feb 2004 23:09:19 EST
Yes the images are in the preferencePane BNDL but since it is a BNDL loaded
by the application it appears to be using the images from the application and
not itself.
Also, I'm using Project Builder in Jaguar, not Xcode in Panther.
_______________________________________________
In a message dated 02/17/2004 22:17:36, email@hidden writes:
>
Are you certain the image is valid? Try doing a check:
>
>
if ([NSImage imageNamed:LOCK_IMG]]) {
>
NSLog(@"Image is Valid");
>
} else {
>
NSLog(@"Image is not Valid");
>
}
>
>
If it's not, then make sure the image has been added to the target in
>
Xcode.
>
>
Ryan
>
>
>
On Feb 17, 2004, at 6:03 PM, email@hidden wrote:
>
>
> Well, no responses so I guess I'll address some of the issues myself.
>
>
>
> In case you're wondering if I have looked at the docs, I tried to
>
> force the
>
> NSView to update and this had no effect on the image showing.
>
>
>
> Well, it appears if I place the images in the main application it will
>
> display them even without using the NSView "display" method.
>
>
>
> Why are the images being loaded from the application and not from the
>
> preferencePane BNDL and how can I force the images from the BNDL or is
>
> this a problem
>
> specific in 10.2.x?
>
> _______________________________________________
>
>
>
> Dale
>
> _______________________________________________
>
>
>
> In a message dated 02/17/2004 00:12:56, email@hidden writes:
>
> _______________________________________________
>
>
>
>> 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.