fix stepper changing text field to wrong values

This commit is contained in:
jorsi 2020-09-13 19:30:43 -04:00
parent 0121fb680c
commit d297b2c0e7
2 changed files with 9 additions and 6 deletions

View File

@ -322,14 +322,17 @@
- (IBAction) bumpMacFrameSkip:(NSStepper *)sender
{
int bumpValue = sender.intValue; // 1 or -1
[self.macFrameSkipTextField setIntegerValue: self.macFrameSkipTextField.integerValue + bumpValue];
int nextValue = self.macFrameSkipTextField.intValue + bumpValue;
// constrain value
if ([self.macFrameSkipTextField integerValue] < 0)
[self.macFrameSkipTextField setIntegerValue: 0];
if ([self.macFrameSkipTextField integerValue] > 200)
[self.macFrameSkipTextField setIntegerValue: 200];
if (nextValue < 0) {
nextValue = 0;
}
if (nextValue > 200) {
nextValue = 200;
}
[self.macFrameSkipTextField setIntValue: nextValue];
[sender setIntValue:0]; // reset stepper value
[self setMacFrameSkip:self.macFrameSkipTextField.intValue]; // execute setter
}

View File

@ -665,7 +665,7 @@
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" allowsUndo="NO" state="on" borderStyle="bezel" userInterfaceLayoutDirection="rightToLeft" drawsBackground="YES" id="woe-Qv-FXl">
<numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" formatWidth="-1" groupingSize="0" minimumIntegerDigits="1" maximumIntegerDigits="42" id="BAb-Gt-XZ4">
<real key="minimum" value="0.0"/>
<real key="maximum" value="100"/>
<real key="maximum" value="200"/>
</numberFormatter>
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>