Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Help a Cocoa Newbie

Help a Cocoa Newbie
Thread Tools
Thinine
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
May 23, 2003, 03:35 PM
 
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.
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
May 23, 2003, 04:05 PM
 
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).
     
Thinine  (op)
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
May 23, 2003, 04:25 PM
 
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. )
     
macrophyllum
Mac Enthusiast
Join Date: Sep 2000
Location: Vermont, USA
Status: Offline
Reply With Quote
May 27, 2003, 01:51 AM
 
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
Guest
Status:
Reply With Quote
May 27, 2003, 09:33 AM
 
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 Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:22 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,