I have created a small app in C using WinAPI and I have a small problem. The tab key does not switch between controls. Should it be automatic? If not, can you tell how to implement it? I have made an algorithm to switch between edit boxes, here's a stub:
case WM_NOTIFY
{
if tab key
{
control_id++;
SetFocus(GetDlgItem(hwnd, control id));
if control_id = max_control_id
{ control_id = min_control_id; }
If there's no simple way, then should I use my algorithm?
P.S.: I tried adding TABSTOP, it does not work. Here are some controls that do not work. I am using VS 2010 Express, Windows 7 64 bit.
hwnduser = CreateWindow (TEXT("EDIT"), NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP | WS_GROUP,
220, 80, 80, 20,
hwnd, (HMENU) 3, NULL, NULL);
hwndpass = CreateWindow (TEXT("EDIT"), NULL,
WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP,
220, 130, 80, 20,
hwnd, (HMENU) 4, NULL, NULL);
CreateWindow(TEXT("button"), TEXT("Login"),
WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_GROUP,
80,200,100,30,
hwnd, (HMENU) 1, NULL, NULL);
CreateWindow(TEXT("button"), TEXT("Exit"),
WS_VISIBLE | WS_CHILD | WS_TABSTOP,
220,200,100,30,
hwnd, (HMENU) 2, NULL, NULL);
You have to call IsDialogMessage
in your message loop.
See How To Use One IsDialogMessage() Call for Many Modeless Dialogs on how to do this.