Skip to content
Snippets Groups Projects
Commit 8e238d04 authored by Luc Tourangeau's avatar Luc Tourangeau Committed by Alexandre Julliard
Browse files

Reimplemented the CheckRadioButton function.

parent bbafc7a6
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,14 @@ typedef struct
BOOL dialogEx;
} DLG_TEMPLATE;
/* Radio button group */
typedef struct
{
UINT firstID;
UINT lastID;
UINT checkID;
} RADIOGROUP;
/* Dialog base units */
static WORD xBaseUnit = 0, yBaseUnit = 0;
......@@ -1593,40 +1601,51 @@ BOOL16 WINAPI CheckRadioButton16( HWND16 hwndDlg, UINT16 firstID,
/***********************************************************************
* CheckRadioButton32 (USER32.48)
* CheckRB
*
* Callback function used to check/uncheck radio buttons that fall
* within a specific range of IDs.
*/
BOOL WINAPI CheckRadioButton( HWND hwndDlg, UINT firstID,
UINT lastID, UINT checkID )
static BOOL CALLBACK CheckRB(HWND hwndChild, LPARAM lParam)
{
WND *pWnd = WIN_FindWndPtr( hwndDlg );
if (!pWnd) return FALSE;
LONG lChildID = GetWindowLongA(hwndChild, GWL_ID);
RADIOGROUP *lpRadioGroup = (RADIOGROUP *) lParam;
for (WIN_UpdateWndPtr(&pWnd,pWnd->child); pWnd;WIN_UpdateWndPtr(&pWnd,pWnd->next))
if ((pWnd->wIDmenu == firstID) || (pWnd->wIDmenu == lastID))
if ((lChildID >= lpRadioGroup->firstID) &&
(lChildID <= lpRadioGroup->lastID))
{
if (lChildID == lpRadioGroup->checkID)
{
break;
SendMessageA(hwndChild, BM_SETCHECK, BST_CHECKED, 0);
}
if (!pWnd) return FALSE;
if (pWnd->wIDmenu == lastID)
lastID = firstID; /* Buttons are in reverse order */
while (pWnd)
{
SendMessageA( pWnd->hwndSelf, BM_SETCHECK,
(pWnd->wIDmenu == checkID), 0 );
if (pWnd->wIDmenu == lastID)
else
{
WIN_ReleaseWndPtr(pWnd);
break;
SendMessageA(hwndChild, BM_SETCHECK, BST_UNCHECKED, 0);
}
WIN_UpdateWndPtr(&pWnd,pWnd->next);
}
return TRUE;
}
/***********************************************************************
* CheckRadioButton32 (USER32.48)
*/
BOOL WINAPI CheckRadioButton( HWND hwndDlg, UINT firstID,
UINT lastID, UINT checkID )
{
RADIOGROUP radioGroup;
/* perform bounds checking for a radio button group */
radioGroup.firstID = min(min(firstID, lastID), checkID);
radioGroup.lastID = max(max(firstID, lastID), checkID);
radioGroup.checkID = checkID;
return EnumChildWindows(hwndDlg, (WNDENUMPROC)CheckRB,
(LPARAM)&radioGroup);
}
/***********************************************************************
* GetDialogBaseUnits (USER.243) (USER32.233)
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment