From 3011068caedf43283936375d9ee822eb992c1dfc Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 19 May 2015 13:37:06 -0400 Subject: [PATCH] More Windows uiSpinbox work. On second thought we might not need to do anything *too* special... --- redo/windows/spinbox.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/redo/windows/spinbox.c b/redo/windows/spinbox.c index 4095f07c..d9756349 100644 --- a/redo/windows/spinbox.c +++ b/redo/windows/spinbox.c @@ -10,6 +10,19 @@ struct spinbox { static BOOL onWM_COMMAND(uiControl *c, WORD code, LRESULT *lResult) { + struct spinbox *s = (struct spinbox *) c; + BOOL neededCap = FALSE; + LRESULT val; + + if (code != EN_CHANGE) + return FALSE; + // This verifies the value put in, capping it automatically. + // We don't need to worry about checking for an error; that flag should really be called "did we have to cap?". + // We DO need to set the value in case of a cap though. + // TODO if we have change events, we need to make sure doing this doesn't trigger a double event + val = SendMessageW(s->updown, UDM_GETPOS32, 0, (LPARAM) (&neededCap)); + if (neededCap) + SendMessageW(s->updown, UDM_SETPOS32, 0, (LPARAM) val); return FALSE; }