Re: capturing a double-click on a control
Re: capturing a double-click on a control
- Subject: Re: capturing a double-click on a control
- From: "I. Savant" <email@hidden>
- Date: Fri, 16 Mar 2007 16:51:44 -0400
You detect double-clicks in general by examining the NSEvent that
was passed into the -mouseDown: method of the control itself. Ask the
event for its -clickCount and act accordingly. To do this with an
existing Cocoa control that doesn't otherwise handle it, you'd
override it.
With that said, the standard warning applies: Changing the
behavior of a basic UI control is a bad idea. Why should a slider do
something different in *your* app and nowhere else? The answer is "it
shouldn't". There's nothing apparent about it that says "this slider
can be double-clicked to reset the value" unless you place a label
near it explaining this. In that case, the text "double-click to
reset" is longer than a button that simply says, "Reset" ... and the
function of a "Reset" button next to the control is immediately obvious.
Depending on your goal, it's probably more "Mac-like" to provide a
"Reset" or "Use Defaults" button. Since you haven't described why you
want to do this, it's hard to give a specific suggestion, but I
strongly recommend you *never* alter the behavior of a basic control
in this way.
--
I.S.
On Mar 16, 2007, at 4:35 PM, Artemiy Pavlov wrote:
Hello all!
I would like to know, how can I make my code respond to a double
click on a control like a slider?
For example, I have:
IBOutlet NSSlider * MySlider;
- (IBAction)iaMySliderDidSomething:(id)sender;
I connect these to the real slider in the Interface Builder, and I
then can read/write a value from/to the slider. But I would like to
reset it to some default value when the slider is double-clicked.
How would I go about doing so?
Thanks very much,
Artemiy.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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