Re: [newbie]: UI questions (using NSSlider & NSTextField with delegation)
Re: [newbie]: UI questions (using NSSlider & NSTextField with delegation)
- Subject: Re: [newbie]: UI questions (using NSSlider & NSTextField with delegation)
- From: "Clark S. Cox III" <email@hidden>
- Date: Tue, 13 Aug 2002 07:50:43 -0400
On 08/13/2002 07:21, "email@hidden" <email@hidden> wrote:
>
Thanks for the reply Martin, but I do have the slider & textfield hooked up
>
through an outlet/action. This part works ok, i.e. I am able to have the
>
textfield updated from the slider. It's just that even though the
>
textfield has it's value updated from the slider, this value isn't sent to
>
the textfield's delegate (my controller object in this case) unless I go in
>
and manually hit return in the textfield or manually edit the text. Only
>
then does the controller object get the update through delegation.
Don't hook the slider directly to the text field, instead, hook them
both up to your controller, and let it handle their interaction, like so:
-(IBAction)sliderOrTextFieldChanged:(id)sender
{
double value = [sender doubleValue]; //Or int, float, whatever
[slider setDoubleValue: value];
[textField setDoubleValue: value];
//Do something with value here
}
Then simply set the action of both the slider and the text field to
sliderOrTextFieldChanged:.
--
Clark S. Cox III
_______________________________________________
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.