|
|
Help a Cocoa Newbie
|
|
|
|
Mac Elite
Join Date: Jul 2002
Status:
Offline
|
|
I bought the book Cocoa Programming for Dummies and it's been very helpful. I'm doing a small program with two sliders. I've been able to get continous feedback in text boxes with them and I would like to know if it's possible to do continous operations using those values. Essentially, I want to continuously calculate the product of the two variables. Thanks.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Of course you can. The code to do this is left as an exercise to the reader (hint: try looking at Apple's Currency Converter tutorial).
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Jul 2002
Status:
Offline
|
|
I didn't see anything in the tutorial that was of much help. Perhaps I need to explain better. I want to take the values of two continuous sliders and get the product continuously. Now, I can get the product easy enough, I just don't know how to calculate it continuously. Right now I have to select the product box and hit return for it to refresh.
(
Last edited by Thinine; May 23, 2003 at 04:35 PM.
)
|
|
|
|
|
|
|
|
|
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status:
Offline
|
|
I don't know the example you are doing, but my guess is that you have a slider with a target to a method in some class called say, "sliderChanged".
In the sliderChanged method do something like:
-(void)sliderChanged:(id)theSlider {
[aTextField setFloatValue:[theSlider floatValue]];
}
This code assumes you have a text field called "aTextField". This will put the value of the slider into the the text field.
Hope this helps.
|
|
|
|
|
|
|
|
|
hayesk
|
|
Originally posted by Thinine:
I didn't see anything in the tutorial that was of much help. Perhaps I need to explain better. I want to take the values of two continuous sliders and get the product continuously. Now, I can get the product easy enough, I just don't know how to calculate it continuously. Right now I have to select the product box and hit return for it to refresh.
Whenever you update the values, send a message to update the product too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|