Jump to content
  • Advertisement
Sign in to follow this  
andyborowicz

WS_EX_CONTROLPARENT & WS_TABSTOP

This topic is 4393 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I have created a simple app - one parent window, a couple of edits and buttons in it, as its children. I want to be able to switch between edits with the TAB key. I thought these two will do... guess I was wrong. Can anybody explain how to make it work? Even the simplest app with a window and two edits - when I press TAB w want to switch edits. And in my app nothing happens (not even a warning soud). wndHandle = CreateWindowEx( WS_EX_CONTROLPARENT, "MainWindow", "My application", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 640, 480, NULL, NULL, hInstance, NULL); edit1Handle = CreateWindowEx( WS_EX_CLIENTEDGE, "Edit", NULL, WS_CHILD | WS_VISIBLE | ES_NUMBER | WS_TABSTOP, 20, 25, 30, 20, wndHandle, NULL, hInstance, NULL); edit2Handle = CreateWindowEx( WS_EX_CLIENTEDGE, "Edit", NULL, WS_CHILD | WS_VISIBLE | ES_NUMBER | WS_TABSTOP, 20, 75, 30, 20, wndHandle, NULL, hInstance, NULL); Just a fragment... Why doesn't the TAB key work???

Share this post


Link to post
Share on other sites
Advertisement
You'll need to use IsDialogMessage(). Change your message pump to this


if (!IsDialogMessage(hwnd, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}

Share this post


Link to post
Share on other sites
Did what you proposed... but now when I execute my program, the window is shown but the cursor is still a sand-glass, and the application doesn't respond. My WinMain looks like this:

int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow)
{
if (!initWindow(hInstance))
return false;
MSG msg;
ZeroMemory(&msg,sizeof(msg));
while(msg.message!=WM_QUIT)
{
while (GetMessage(&msg,wndHandle,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int)msg.wParam;
}

Any idea, please?

PS. I'm sorry for not answering for a long time. I was away.

Share this post


Link to post
Share on other sites
Remove the Window handle from the GetMessage call and insert the IsDialogMessage:


int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow)
{
if ( !initWindow( hInstance ) )
{
return false;
}

MSG msg;

ZeroMemory( &msg, sizeof( msg ) );

while ( msg.message != WM_QUIT )
{
while ( GetMessage( &msg, NULL, 0, 0 ) )
{
if ( !IsDialogMessage( wndHandle, &msg ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
}
return (int)msg.wParam;
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!