Re: buttonType in NSButton
Re: buttonType in NSButton
- Subject: Re: buttonType in NSButton
- From: Jonathan Jackel <email@hidden>
- Date: Tue, 10 Dec 2002 21:03:13 -0500
on 12/10/02 7:26 PM, Adam Lindsay at email@hidden wrote:
>
>> I'm working on my first significant Cocoa project, and was wondering if
>
>> there's a programmatic way of discovering an NSButton's buttonType. I've
>
>> looked at NSButton, NSButtonCell, and NSAccessibility (briefly), and
>
>> nothing presents itself as the front door. I can *set* it, but I don't
>
>> want to do that.
>
>>
>
>
>
> How about asking the button for its class, e.g. [yourButton class] or
>
> [yourButton className], or testing with isKindOfClass:? Check the NSObject
>
> docs.
>
>
Perhaps I misunderstood you, but my premise was that [myButton class] is
>
not enough to distinguish between an NSButton that momentarily lights and
>
one that toggles.
As usual, I didn't quite get what the problem was.
I'm not a big user of different button styles, so I may be wrong here, but
the docs say that when you set a button type, you are changing the button's
behavior for highlightsBy and showsStateBy. Those are iVars you can access.
[myButton highLightsBy] and [myButton showsStateBy] will return an integer
representing how the button behaves (see the corresponding "set" methods for
the lists of constants). Once you figure out the values returned by the
button types you are using, you can test for them and, by implication, for
the type of button you are dealing with.
Jonathan
_______________________________________________
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.