Commit b2917cf5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/updown: Allow ranges with max < min for Up/Down control.

parent 8320686f
...@@ -470,6 +470,27 @@ static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key) ...@@ -470,6 +470,27 @@ static LRESULT UPDOWN_KeyPressed(UPDOWN_INFO *infoPtr, int key)
} }
/*********************************************************************** /***********************************************************************
* UPDOWN_SetRange
*
* Handle UDM_SETRANGE, UDM_SETRANGE32
*
* FIXME: handle Max == Min properly:
* - arrows should be disabled (without WS_DISABLED set),
* visually they can't be pressed and don't respond;
* - all input messages should still pass in.
*/
static LRESULT UPDOWN_SetRange(UPDOWN_INFO *infoPtr, INT Max, INT Min)
{
infoPtr->MaxVal = Max;
infoPtr->MinVal = Min;
TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n",
infoPtr->MinVal, infoPtr->MaxVal, infoPtr->Self);
return 0;
}
/***********************************************************************
* UPDOWN_MouseWheel * UPDOWN_MouseWheel
* *
* Handle mouse wheel scrolling * Handle mouse wheel scrolling
...@@ -1045,12 +1066,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -1045,12 +1066,11 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal); return MAKELONG(infoPtr->MaxVal, infoPtr->MinVal);
case UDM_SETRANGE: case UDM_SETRANGE:
/* we must have: */ /* we must have:
infoPtr->MaxVal = (short)(lParam); /* UD_MINVAL <= Max <= UD_MAXVAL */ UD_MINVAL <= Max <= UD_MAXVAL
infoPtr->MinVal = (short)HIWORD(lParam); /* UD_MINVAL <= Min <= UD_MAXVAL */ UD_MINVAL <= Min <= UD_MAXVAL
/* |Max-Min| <= UD_MAXVAL */ |Max-Min| <= UD_MAXVAL */
TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n", UPDOWN_SetRange(infoPtr, (short)lParam, (short)HIWORD(lParam));
infoPtr->MinVal, infoPtr->MaxVal, hwnd);
break; break;
case UDM_GETRANGE32: case UDM_GETRANGE32:
...@@ -1059,12 +1079,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L ...@@ -1059,12 +1079,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
break; break;
case UDM_SETRANGE32: case UDM_SETRANGE32:
infoPtr->MinVal = (INT)wParam; UPDOWN_SetRange(infoPtr, (INT)lParam, (INT)wParam);
infoPtr->MaxVal = (INT)lParam;
if (infoPtr->MaxVal <= infoPtr->MinVal)
infoPtr->MaxVal = infoPtr->MinVal + 1;
TRACE("UpDown Ctrl new range(%d to %d), hwnd=%p\n",
infoPtr->MinVal, infoPtr->MaxVal, hwnd);
break; break;
case UDM_GETPOS32: case UDM_GETPOS32:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment