Issue with NSStepper

Discussion in 'Mac Programming' started by anni.saini, May 9, 2010.

  1. anni.saini macrumors newbie

    Joined:
    Jul 15, 2009
    #1
    hi,

    I want to use NSStepper with NSTextField and want to set some initial value in the NSTextField (let say 3).

    I implemented code for this and set min and max value for stepper to 1 and 100 and increment value to 1.

    I have set the initial value of NSTextField to 3.

    I have one issue with this:
    1. When first time, I clicked on stepper it randomly increments the value and afterward it works fine (increments value properly).
    2. When I didn't set any initial value for NSTextField, it takes zero default.

    Can anybody know how can I set initial value for stepper, so that it works fine.

    thanks,
    Anni
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    NSStepper is a NSControl so all the normal setXXX: methods including setIntValue: are available.
     
  3. anni.saini thread starter macrumors newbie

    Joined:
    Jul 15, 2009
    #3
    hi robbieduncan,

    thanks for the help... its working for initial value.

    however I have observe more issue there:
    1. When I first time clicked on up arrow it shows me value 2 even though I set setIntValue to 3.
    2. And when I clicked down first time it shows value 1.

    Couple of solutions that I tried:
    -- I tried by opting continuous option for text field
    -- setting NSTextField value to same as that I set to setIntValue
    -- binding Stepper and NSTextField with the same control.
     

Share This Page