From d297b2c0e76b5b2195b99c3e412df7d2f2738ce4 Mon Sep 17 00:00:00 2001 From: jorsi Date: Sun, 13 Sep 2020 19:30:43 -0400 Subject: [PATCH] fix stepper changing text field to wrong values --- macosx/Snes9x/S9xPrefsViewController.m | 13 ++++++++----- macosx/Snes9x/S9xPrefsViewController.xib | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/macosx/Snes9x/S9xPrefsViewController.m b/macosx/Snes9x/S9xPrefsViewController.m index 7b12af05..f351dcb9 100644 --- a/macosx/Snes9x/S9xPrefsViewController.m +++ b/macosx/Snes9x/S9xPrefsViewController.m @@ -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 } diff --git a/macosx/Snes9x/S9xPrefsViewController.xib b/macosx/Snes9x/S9xPrefsViewController.xib index 55554056..970908f5 100644 --- a/macosx/Snes9x/S9xPrefsViewController.xib +++ b/macosx/Snes9x/S9xPrefsViewController.xib @@ -665,7 +665,7 @@ - +