Commit 379d492b authored by Ričardas Barkauskas's avatar Ričardas Barkauskas Committed by Alexandre Julliard

comctl32: Use index value if property sheet page isn't found.

parent beffac00
......@@ -168,7 +168,7 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
int index,
int skipdir,
HPROPSHEETPAGE hpage);
static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psInfo);
static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psInfo, int original_index);
static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* psInfo);
static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID);
static BOOL PROPSHEET_RemovePage(HWND hwndDlg, int index, HPROPSHEETPAGE hpage);
......@@ -1998,9 +1998,8 @@ static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
TRACE("index %d, skipdir %d, hpage %p\n", index, skipdir, hpage);
/* hpage takes precedence over index */
if (hpage != NULL)
index = PROPSHEET_GetPageIndex(hpage, psInfo);
index = PROPSHEET_GetPageIndex(hpage, psInfo, index);
if (index < 0 || index >= psInfo->nPages)
{
......@@ -2331,13 +2330,8 @@ static BOOL PROPSHEET_RemovePage(HWND hwndDlg,
if (!psInfo) {
return FALSE;
}
/*
* hpage takes precedence over index.
*/
if (hpage != 0)
{
index = PROPSHEET_GetPageIndex(hpage, psInfo);
}
index = PROPSHEET_GetPageIndex(hpage, psInfo, index);
/* Make sure that index is within range */
if (index < 0 || index >= psInfo->nPages)
......@@ -2652,26 +2646,20 @@ static BOOL PROPSHEET_RecalcPageSizes(HWND hwndDlg)
* PROPSHEET_GetPageIndex
*
* Given a HPROPSHEETPAGE, returns the index of the corresponding page from
* the array of PropPageInfo.
* the array of PropPageInfo. If page is not found original index is used
* (page takes precedence over index).
*/
static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE hpage, const PropSheetInfo* psInfo)
static int PROPSHEET_GetPageIndex(HPROPSHEETPAGE page, const PropSheetInfo* psInfo, int original_index)
{
BOOL found = FALSE;
int index = 0;
int index;
TRACE("hpage %p\n", hpage);
while ((index < psInfo->nPages) && (found == FALSE))
{
if (psInfo->proppage[index].hpage == hpage)
found = TRUE;
else
index++;
}
TRACE("page %p index %d\n", page, original_index);
if (found == FALSE)
index = -1;
for (index = 0; index < psInfo->nPages; index++)
if (psInfo->proppage[index].hpage == page)
return index;
return index;
return original_index;
}
/******************************************************************************
......
......@@ -821,7 +821,7 @@ if (0)
ok(r == 4, "got %d\n", r);
/* select page that can't be created */
ret = SendMessageA(hdlg, PSM_SETCURSEL, 3, 0);
ret = SendMessageA(hdlg, PSM_SETCURSEL, 3, 1);
ok(ret == TRUE, "got %d\n", ret);
r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0);
......
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