diff options
| author | Pietro Gagliardi <[email protected]> | 2014-11-03 23:16:48 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-11-03 23:16:48 -0500 |
| commit | 6cbaeb7657891034c3b0eee24e015b64400581ef (patch) | |
| tree | c831ab37a5cdf65938b1964aadefb5f96b83758b /spinbox_windows.go | |
| parent | 9a2641056935f408471fc207e001e9f912c2915c (diff) | |
Finished implementing Windows Spinbox.OnChanged().
Diffstat (limited to 'spinbox_windows.go')
| -rw-r--r-- | spinbox_windows.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/spinbox_windows.go b/spinbox_windows.go index 4a16364..247b98d 100644 --- a/spinbox_windows.go +++ b/spinbox_windows.go @@ -77,15 +77,20 @@ func spinboxUpDownClicked(data unsafe.Pointer, nud *C.NMUPDOWN) { //export spinboxEditChanged func spinboxEditChanged(data unsafe.Pointer) { + // we're basically on our own here s := (*spinbox)(unsafe.Pointer(data)) - // TODO + // this basically does what OS X does: values too low get clamped to the minimum, values too high get clamped to the maximum, and deleting everything clamps to the minimum value, err := strconv.Atoi(getWindowText(s.hwndEdit)) if err != nil { - // TODO see what OS X does + // best we can do fo rnow in this case :S + // a partial atoi() like in C would be more optimal + // it handles the deleting everything case just fine + value = s.min } - s.value = int(value) + s.value = value s.cap() - // TODO see what OS X does if the cap happened + C.SendMessageW(s.hwndUpDown, C.UDM_SETPOS32, 0, C.LPARAM(s.value)) + // TODO position the insertion caret at the end (or wherever is appropriate) s.changed.fire() } |
