Issue with NSStepper

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

  1. anni.saini macrumors newbie

    Jul 15, 2009

    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.

  2. robbieduncan Moderator emeritus


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

    Jul 15, 2009
    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