Tech Support > Microsoft Windows > Development Resources > Edit controls and the TAB character
Edit controls and the TAB character
Posted by Martin Johansen on April 3rd, 2004


Hello.

I am writing a program in notepad using CYGWIN tools.

In this case I am using a resource file to create a dialog.

How can I make an edit control accept TAB characters by pressing TAB and not
only CTRL-TAB.

I have checked the Win32 programmers reference, but did not manage to find
anything.

THANKS!


Posted by John Carson on April 4th, 2004


"Martin Johansen" <martinfj@is.online.no> wrote in message
news:IhHbc.4804$zf6.65120@news4.e.nsc.no

By default, the dialog box window procedure uses the tab key to navigate
between controls. It intercepts the tab key before the edit control gets it.
Overriding this normal behaviour may confuse your users. If you want to do
it anyway, then you need to subclass the edit control and process the
WM_GETDLGCODE message by returning DLGC_WANTTAB.


--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)


Posted by John Carson on April 4th, 2004


"John Carson" <donaldquixote@datafast.net.au> wrote in message
news:406f67e9@usenet.per.paradox.net.au
To ensure that you keep getting all the other keys, you should probably
return DLGC_WANTALLKEYS.

In that case, you will receive the Enter key as well. If you want it to
close the dialog, then you should add the following processing of WM_CHAR to
your subclassing window procedure (or the equivalent to your OnChar
processing):

case WM_CHAR:
if (wParam == '\r' && !(GetKeyState(VK_CONTROL)<0))
{
PostMessage(GetParent(hwnd), WM_CLOSE,0,0);
return 0;
}
break;


--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)




Similar Posts