Commit de608991 authored by Keith Stevens's avatar Keith Stevens Committed by Alexandre Julliard

comctl32: trackbar: Correctly set lSetMin and lSelMax.

Modify the behavior when the messages TBM_SETSEL, TBM_SETSELSTART, and TBM_SETSELEND are sent and TBS_ENABLESELRANGE is not set. When the style TBS_ENABLESELRANGE is not set, Windows observed behavior is to set the Selection Start and End values to 0, rather than leave them unchanged.
parent 86ea6b58
......@@ -902,16 +902,12 @@ static void test_ignore_selection(HWND hWndTrackbar){
/* test TBM_SETSEL ensure that it is ignored */
SendMessage(hWndTrackbar, TBM_SETSEL, TRUE, MAKELONG(0,10));
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
todo_wine{
expect(0, r);
}
expect(0, r);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
expect(0, r);
SendMessage(hWndTrackbar, TBM_SETSEL, FALSE, MAKELONG(0,10));
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
todo_wine{
expect(0, r);
}
expect(0, r);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
expect(0, r);
......@@ -921,9 +917,7 @@ static void test_ignore_selection(HWND hWndTrackbar){
expect(0, r);
SendMessage(hWndTrackbar, TBM_SETSELEND, TRUE, 10);
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
todo_wine{
expect(0,r);
}
expect(0,r);
SendMessage(hWndTrackbar, TBM_SETSELEND, FALSE, 0);
r = SendMessage(hWndTrackbar, TBM_GETSELEND, 0,0);
expect(0, r);
......@@ -934,9 +928,7 @@ static void test_ignore_selection(HWND hWndTrackbar){
expect(0, r);
SendMessage(hWndTrackbar, TBM_SETSELSTART, TRUE, 10);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
todo_wine{
expect(0,r);
}
expect(0,r);
SendMessage(hWndTrackbar, TBM_SETSELSTART, FALSE, 0);
r = SendMessage(hWndTrackbar, TBM_GETSELSTART, 0,0);
expect(0, r);
......
......@@ -1216,8 +1216,11 @@ TRACKBAR_SetRangeMin (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lMin)
inline static LRESULT
TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
{
if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
infoPtr->lSelMin = 0;
infoPtr->lSelMax = 0;
return 0;
}
infoPtr->lSelMin = (SHORT)LOWORD(lSel);
infoPtr->lSelMax = (SHORT)HIWORD(lSel);
......@@ -1237,8 +1240,10 @@ TRACKBAR_SetSel (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lSel)
inline static LRESULT
TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
{
if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
infoPtr->lSelMax = 0;
return 0;
}
infoPtr->lSelMax = lEnd;
infoPtr->flags |= TB_SELECTIONCHANGED;
......@@ -1255,8 +1260,10 @@ TRACKBAR_SetSelEnd (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lEnd)
inline static LRESULT
TRACKBAR_SetSelStart (TRACKBAR_INFO *infoPtr, BOOL fRedraw, LONG lStart)
{
if (!GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)
if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TBS_ENABLESELRANGE)){
infoPtr->lSelMin = 0;
return 0;
}
infoPtr->lSelMin = lStart;
infoPtr->flags |=TB_SELECTIONCHANGED;
......
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