Re: Need help moving an NSSlider
Re: Need help moving an NSSlider
- Subject: Re: Need help moving an NSSlider
- From: Iain Wood <email@hidden>
- Date: Mon, 9 Feb 2004 10:29:26 +0000
On 9 Feb 2004, at 02:42, Ryan Bates wrote:
On Feb 8, 2004, at 4:23 PM, Iain Wood wrote:
I have slider connected to an NSSlider, and window connected to an
NSTextField. A second slider is connected to the setSlider method,
and when I move that slider, a series of values gets sent to the
window NSTextField, but the NSSlider connected to slider doesn't
move.
For some reason the NSSlider doesn't like the naming conflict. You
need to rename either the "slider" variable or the "setSlider:"
method. I suggest the method because in normal Cocoa syntax
"setSlider:" may be confused with setting the actual slider instance
variable.
Wel I did that and it worked. Many thanks, no more tearing my hair out.
I don't understand why it works though. Where is the conflict? There
was only one "slider", the IBOutlet, and one "setSlider", the method.
Just a couple notes. NSTextField doesn't respond to the "insertText:"
method, perhaps you meant an NSTextView? If you set up the text field
to simply test the results of the slider, you may want to use the
NSLog() function. Such as NSLog(@"Sender Value: %d", [sender
intValue]);
Also using the name "window" as referring to a text view was slightly
confusing. You may want to consider renaming it because it usually
refers to an instance of NSWindow.
I used InsertText so I could more closely parallel the non working
[slider setIntValue] bit, and yes, I know window is a bad choice. It
was just what popped into my head as I was quickly writing the test
code. I consider my wrist slapped. Wont do it again :-)
Iain
_______________________________________________
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.