Click to See Complete Forum and Search --> : Buttons and WS_TABSTOP
poxs
December 15th, 2004, 11:57 AM
I have creted some buttons in normal window (not dialog box) with CreateWindow function. I have some problems with switching between those buttons with TAB key like in dialog box. Every button has WS_TABSTOP style included. TAbB key simply doesn't want to work. I don't see even the focus frame arround the button. How to make it working like in a normal dialog box? Maybe i'm missing some styles of the parent window of those buttons. Please tell my how should I create parent window and and buttons to make it working.
kkez
December 15th, 2004, 12:14 PM
You should use WS_EX_CONTROLPARENT ex-style for the main window.
Trasgu
December 17th, 2004, 10:53 AM
I have the same problem, but donīt work yet.
JohnCz
December 18th, 2004, 07:16 PM
You should use WS_EX_CONTROLPARENT ex-style for the main window. That will not change anything.
Please tell my how should I create parent window and and buttons to make it working.
Dialog handles this but any other window do not. You have to provide a code that will take care of tabbing:
BOOL CWhateverParentClassForButtons::PreTranslateMessage(MSG* pMsg)
{
if(IsDialogMessage(pMsg))
{
return TRUE;
}
return CWnd ::PreTranslateMessage(pMsg);
}
NoHero
December 19th, 2004, 06:27 AM
Yes JohnCz. But you forget we are in the WINAPI Forum. So I think he is looking for the C written main loop:
BOOL bRetVal = 0;
MSG msg;
while ( (bRetVal = GetMessage(&msg, /* hWnd */ NULL, 0, 0)) != 0 )
{
if ( bRetVal == -1 )
{
// handle error somewhat
}
else
{
if ( !IsDialogMessage(hWnd, &msg) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
hWnd is the handle to your main window.
Trasgu
December 19th, 2004, 10:13 AM
Itīs working, thank you very much.
Why I canīt rate the NoHeroīs post?.
A message say: "You must spread some Reputation around before giving it to NoHero again.".What I must to do?.
JohnCz
December 19th, 2004, 10:42 AM
Yes JohnCz. But you forget we are in the WINAPI Forum. Yes, I have tested it in MFC application, and lost ti on the way. Sometimes I work on several posts at the same time and that is a reason. Sorry.
But idea is still the same and is clear where to put it.
NoHero
December 19th, 2004, 11:03 AM
Yes, I have tested it in MFC application, and lost ti on the way. Sometimes I work on several posts at the same time and that is a reason. Sorry.
But idea is still the same and is clear where to put it.
Of course. I just wanted to remind you of this. :wave:
NoHero
December 19th, 2004, 11:03 AM
Itīs working, thank you very much.
You are welcome :wave:
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.