From: Yakovm3 on 4 Apr 2010 09:42 I wrote winapi application.Which during creation defined : [code] CreateGLWindow(hwnd,"OpenGL",800,600,16,fullscreen); CreateWindow(TEXT("button"), TEXT("Choose Shading Mode"), WS_CHILD | WS_VISIBLE | BS_GROUPBOX,10, 610, 300, 120, hwnd, (HMENU) 0,hInstance, NULL); CreateWindow(TEXT("button"), TEXT("Wireframe"), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,20, 630, 100, 30, hwnd, (HMENU)IDC_M_WIRE , hInstance, NULL); CreateWindow(TEXT("button"), TEXT("Flat"), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,20, 660, 100, 30, hwnd, (HMENU)IDC_M_FLAT , hInstance, NULL); CreateWindow(TEXT("button"), TEXT("Smooth"), WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,20, 690, 100, 30, hwnd, (HMENU)IDC_M_SMOOTH , hInstance,NULL); [/code] in CreateGLWindow it calls: [code] CreateWindow( wc.lpszClassName, TEXT("Graphics"), WS_OVERLAPPEDWINDOW | WS_VISIBLE,10, 10, 800, 800, 0, 0, hInstance, 0); [/code] The procedure is controlled via keyboard and radio buttons defined above [code] case WM_KEYDOWN: // Is A Key Being Held Down? { switch LOWORD(wParam) { //====================== //Move forward/backward // to Z axis //====================== //Move forward case VK_DOWN : stateM->incZ(); break; //Move backward case VK_UP: stateM->decZ(); break; } } case WM_COMMAND: { switch(LOWORD(wParam)) { //Set WIRE Model (Edges only) case IDC_M_WIRE: stateM->setWire(); break; //Set FLAT Shading Model case IDC_M_FLAT: stateM->setFlat(); break; //Set SMOOTH Shading Model case IDC_M_SMOOTH: stateM->setSmooth(); break; } } [/code] When the application is controlled via keyboard it works properly,but when I set one of the radio buttons - it performs the functionality it has to perform when radio- button is checked AND when I want to control via keyboard (after it) I can't no more control it like before. It seems that application doesn't react on keyboard messages Only when I minimize and maximize application window back, the keyboard control start to work properly. Thank you in advance
From: Leo Davidson on 4 Apr 2010 12:09 On Apr 4, 2:42 pm, "Yako...(a)gmail.com" <yako...(a)gmail.com> wrote: > case VK_DOWN : .... > case VK_UP: When radio buttons have the focus they usually handle the up and down keys to move up and down in the list of radiobuttons. (At least, they do when hosted in a dialog. Not sure if the dialog manager does that or if the radiobutton itself does.) If it's that or something similar, you put something in your existing radiobutton event/handler code so that when the radiobutton selection changes the focus is set back to whichever component you usually want. Of course, then you'll have non-standard radiobutton behaviour which probably isn't a good idea. You could also subclass the radiobuttons to make them pass VK_DOWN and VK_UP to the parent window. That would give you slightly more normal behaviour, but still nonstandard.
From: Yakovm3 on 4 Apr 2010 14:28 On Apr 4, 7:09 pm, Leo Davidson <leonudeldavid...(a)googlemail.com> wrote: > On Apr 4, 2:42 pm, "Yako...(a)gmail.com" <yako...(a)gmail.com> wrote: > > > > > case VK_DOWN : > ... > > case VK_UP: > > When radio buttons have the focus they usually handle the up and down > keys to move up and down in the list of radiobuttons. (At least, they > do when hosted in a dialog. Not sure if the dialog manager does that > or if the radiobutton itself does.) > > If it's that or something similar, you put something in your existing > radiobutton event/handler code so that when the radiobutton selection > changes the focus is set back to whichever component you usually want. > Of course, then you'll have non-standard radiobutton behaviour which > probably isn't a good idea. > > You could also subclass the radiobuttons to make them pass VK_DOWN and > VK_UP to the parent window. That would give you slightly more normal > behaviour, but still nonstandard. I have a 3 radio buttons(btw i have changed them with regular push buttons and still have the same effect).So when i choose different modes with those buttons it works OK and change it and other controls works too except a keyboard for the main window only when I minimize and maximize it back it returns to normal
From: Leo Davidson on 4 Apr 2010 15:24 On Apr 4, 7:28 pm, "Yako...(a)gmail.com" <yako...(a)gmail.com> wrote: > On Apr 4, 7:09 pm, Leo Davidson <leonudeldavid...(a)googlemail.com> > wrote: > > > > > On Apr 4, 2:42 pm, "Yako...(a)gmail.com" <yako...(a)gmail.com> wrote: > > > > case VK_DOWN : > > ... > > > case VK_UP: > > > When radio buttons have the focus they usually handle the up and down > > keys to move up and down in the list of radiobuttons. (At least, they > > do when hosted in a dialog. Not sure if the dialog manager does that > > or if the radiobutton itself does.) > > > If it's that or something similar, you put something in your existing > > radiobutton event/handler code so that when the radiobutton selection > > changes the focus is set back to whichever component you usually want. > > Of course, then you'll have non-standard radiobutton behaviour which > > probably isn't a good idea. > > > You could also subclass the radiobuttons to make them pass VK_DOWN and > > VK_UP to the parent window. That would give you slightly more normal > > behaviour, but still nonstandard. > > I have a 3 radio buttons(btw i have changed them with regular push > buttons and still have the same effect).So when i choose different > modes with those buttons it works OK and change it and other controls > works too except a keyboard for the main window only when I minimize > and maximize it back it returns to normal Other button types will also do it. Try opening any standard dialog and give the OK button the focus, then use the cursor keys. Chances are (unless the dialog is unusual) you'll move to the Cancel button etc.
|
Pages: 1 Prev: Creating small window near cursor Next: ANN: Seed7 Release 2010-04-04 |