Re: NSButton Behaviors
Re: NSButton Behaviors
- Subject: Re: NSButton Behaviors
- From: "Frank D. Engel, Jr." <email@hidden>
- Date: Mon, 1 Oct 2007 20:18:32 -0400
I tried setting up a binding against the "highlighted" of the [btn
cell], but that doesn't seem to work; I'm not sure if "highlighted"
is not applicable to NSButtonCell, or if I did something silly, but
at any rate I can't seem to get it working with a binding.
I also tried a binding to the "state" but that doesn't help much
either, considering what I get out of it. I tried both "highlighted"
and "state" with different button behaviors and use NSLog to watch
what was happening, but I couldn't find anything that would do what I
needed.
I don't mind doing a subclass, but since I'm still adjusting to Cocoa
somewhat, could someone give a hint as to what exactly it is that I
should be overriding?
I'm thinking about looking for a way to override the "highlighted"
methods of the cell and just calling the superclass version while
using NSLog to see if anything actually happens, but I'm not sure if
that's a good approach here or not.
Considering that the binding didn't seem to result in any calls from
any mode of button behavior, I suspect that the "highlighted" isn't
being used for buttons at all, so I'm rather doubtful that this is a
worthwhile pursuit?
On Sep 28, 2007, at 9:12 PM, I. Savant wrote:
On Sep 28, 2007, at 9:05 PM, Frank D. Engel, Jr. wrote:
HOWEVER, I also need a bound variable (or some similar
notification method back to the program) to be set based on
whether or not the button is highlighted -- like a "Toggle" button
-- rather than just triggering an action on button release.
How about taking a look at the NSButtonCell that belongs to the
button? An NSCell (or its subclass, such as NSButtonCell) already
has an -isHighlighted method. You can always subclass and extend ...
http://developer.apple.com/documentation/Cocoa/Reference/
ApplicationKit/Classes/NSCell_Class/Reference/Reference.html
If what you're trying to do seems incredibly difficult, you're
probably doing it wrong. ;-)
--
I.S.
-----------------------------------------------------------
Frank D. Engel, Jr. <email@hidden>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten
Son, that whosoever believeth in him should not perish, but have
everlasting life.
$
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden