summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-30 11:52:27 -0400
committerPietro Gagliardi <[email protected]>2014-10-30 11:52:27 -0400
commitb28781f281a7a65a89e4d7c830c773f6382fb6fb (patch)
tree5d9df89d5dba4e46fb3ac85fe206cb8779456c45
parent60283504d352e2283c8b01e46f32696bb5a6134a (diff)
Set up the NSNumberFormatter on Mac OS X Spinboxes in a better way. Untested.
-rw-r--r--spinbox_darwin.m7
1 files changed, 7 insertions, 0 deletions
diff --git a/spinbox_darwin.m b/spinbox_darwin.m
index 27299a6..58145f3 100644
--- a/spinbox_darwin.m
+++ b/spinbox_darwin.m
@@ -28,9 +28,16 @@
return nil;
self->textfield = (NSTextField *) newTextField();
+
self->formatter = [NSNumberFormatter new];
+ [self->formatter setFormatterBehavior:NSNumberFormatterBehavior10_4];
+ [self->formatter setLocalizesFormat:NO];
+ [self->formatter setUsesGroupingSeparator:NO];
+ [self->formatter setHasThousandSeparators:NO];
[self->formatter setAllowsFloats:NO];
+ // TODO partial string validation?
[self->textfield setFormatter:self->formatter];
+
self->stepper = [[NSStepper alloc] initWithFrame:NSZeroRect];
[self->stepper setIncrement:1];
[self->stepper setAutorepeat:YES]; // hold mouse button to step repeatedly