• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Multiple sliders updating the same text field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple sliders updating the same text field


  • Subject: Re: Multiple sliders updating the same text field
  • From: Mike Abdullah <email@hidden>
  • Date: Tue, 24 Jul 2007 16:49:30 +0100

Personally I'd suggest using Cocoa bindings for this. Bind each slider to its own property in the model. Then, add a fourth property to the model which returns the combined value of the other three properties. Bind the text field to this.

Mike.

On 24 Jul 2007, at 16:21, Nathaniel Gottlieb-Graham wrote:

Here's my situation: I have a couple of sliders that both need to update the same text field. The sliders all send values from -2 to 2, only stopping on integer values (-2, -1, 0, 1, 2). The text field is supposed to display the combined total of these sliders, so if one is at -2 and another is at 2, it should display 0. For some reason, I'm having a lot of trouble with this. Here's the code for one slider:


//this part is elsewhere religious = 0;

//relevant part
- (IBAction)focusReligionSlider:(id)sender {
startReligious = religious;
currentReligious = religious + [sender intValue];
[factionReligiousTextField setIntValue:startReligious + currentReligious]
}


This code makes each slider reset the text field's value to the value of the current slider as soon as it's manipulated, but for the life of me I can't figure out what to do to fix it.
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please 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:
40mikeabdullah.net


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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


  • Follow-Ups:
    • Re: Multiple sliders updating the same text field
      • From: Stephane Sudre <email@hidden>
References: 
 >Multiple sliders updating the same text field (From: Nathaniel Gottlieb-Graham <email@hidden>)

  • Prev by Date: Re: Multiple sliders updating the same text field
  • Next by Date: Re: How to get custom widgets into nib file window ?
  • Previous by thread: Re: Multiple sliders updating the same text field
  • Next by thread: Re: Multiple sliders updating the same text field
  • Index(es):
    • Date
    • Thread