tabcontrol
-
I have to port a MFC app to .NET. The main window is dialog with a big tabcontrol and many tab pages. In C++ every tab page was a dialog, so it has a default push button, in C# only the main form has an accept button. How could I "press" different buttons depending on the active tab page on Enter pressed? The only way I could see is to handle the key(up|down) event, verify if it is Enter (how?) and do something further, but must be something easier :) The other problem: I want to set the focus on one tab page component when the page is shown, and keep the current focus no matter how the pages are changed (I mean when switch back). The control.Focus() in the Load method does not work, when should I call Focus? Thanks
-
I have to port a MFC app to .NET. The main window is dialog with a big tabcontrol and many tab pages. In C++ every tab page was a dialog, so it has a default push button, in C# only the main form has an accept button. How could I "press" different buttons depending on the active tab page on Enter pressed? The only way I could see is to handle the key(up|down) event, verify if it is Enter (how?) and do something further, but must be something easier :) The other problem: I want to set the focus on one tab page component when the page is shown, and keep the current focus no matter how the pages are changed (I mean when switch back). The control.Focus() in the Load method does not work, when should I call Focus? Thanks
First problem: What I have done is, I have put a button "OK" or "Apply" on a form, not on a Tabcontrol but just below the tabcontrol. and made it the acccept button. :( i was checking that what is the selected control on the tab thru my program. but i had only 2 tabs and was easy to track down.
-
First problem: What I have done is, I have put a button "OK" or "Apply" on a form, not on a Tabcontrol but just below the tabcontrol. and made it the acccept button. :( i was checking that what is the selected control on the tab thru my program. but i had only 2 tabs and was easy to track down.
I end up with something similar: I put an accept button on the main form and "hide" it (size 1x1, flat, *color = main background) and this "invisible" button will route the Enter according to the active tab page. I can not use a single, normal button for all pages because the actions are quite different (enter, delete, view, load, ...) so the button's name would be a real problem. This thing works but MUST be some other way :confused: