Improving keyboard handling, including accelerator keys in dialog
boxes. Also fixes enter key in Agent32 edit box.
diff --git a/controls/button.c b/controls/button.c
index 9c8b60d..1fd7798 100644
--- a/controls/button.c
+++ b/controls/button.c
@@ -187,6 +187,10 @@
case WM_SETFOCUS:
infoPtr->state |= BUTTON_HASFOCUS;
+ if (style == BS_AUTORADIOBUTTON)
+ {
+ SendMessage32A( hWnd, BM_SETCHECK32, 1, 0 );
+ }
PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
break;
@@ -218,6 +222,13 @@
if (wParam > maxCheckState[style]) wParam = maxCheckState[style];
if ((infoPtr->state & 3) != wParam)
{
+ if ((style == BS_RADIOBUTTON) || (style == BS_AUTORADIOBUTTON))
+ {
+ if (wParam)
+ wndPtr->dwStyle |= WS_TABSTOP;
+ else
+ wndPtr->dwStyle &= ~WS_TABSTOP;
+ }
infoPtr->state = (infoPtr->state & ~3) | wParam;
PAINT_BUTTON( wndPtr, style, ODA_SELECT );
}
diff --git a/controls/menu.c b/controls/menu.c
index 1cbb1c4..abefac9 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -566,8 +566,13 @@
{
if (item->text && (IS_STRING_ITEM(item->fType)))
{
- char *p = strchr( item->text, '&' );
- if (p && (p[1] != '&') && (toupper(p[1]) == key)) return i;
+ char *p = item->text - 2;
+ do
+ {
+ p = strchr (p + 2, '&');
+ }
+ while (p != NULL && p [1] == '&');
+ if (p && (toupper(p[1]) == key)) return i;
}
}
}
@@ -2364,11 +2369,6 @@
MENU_KeyRight( &mt );
break;
- case VK_SPACE:
- case VK_RETURN:
- fEndMenu |= !MENU_ExecFocusedItem( &mt, mt.hCurrentMenu );
- break;
-
case VK_ESCAPE:
fEndMenu = TRUE;
break;
@@ -2392,6 +2392,12 @@
{
UINT32 pos;
+ if (msg.wParam == '\r' || msg.wParam == ' ')
+ {
+ fEndMenu |= !MENU_ExecFocusedItem( &mt, mt.hCurrentMenu );
+ break;
+ }
+
/* Hack to avoid control chars. */
/* We will find a better way real soon... */
if ((msg.wParam <= 32) || (msg.wParam >= 127)) break;