Tab control focus
Posted: Thu Apr 27, 2023 4:22 am
Hi All,
I am working on porting a large VO application, created by someone else, to X#. I don't have VO myself, although the organization has an old version that I might install if I get desperate.
I have got most things running fine now and am just chasing up some different behavior in a few GUIs. One I have an issue with is programmatically changing tabs on a tab control using SelectTab. When you select the tab, the runtime needs to construct the window which will be the new tab page, and also adjust the tab strip to indicate a new tab has been selected.
When the tab opens, the user expects the focus will be on a particular control, but it is not, even though the Show method for the window specifically sets it there. After some digging around, I believe what is happening is that the focus is actually set correctly as the window is shown, but the runtime then adjusts the tab strip, moving the focus to there, causing the control on the window to loose focus. This event is captured by the EditFocusChange method that correctly sets the focus to another control. The user then sees the focus on the logically second control rather than the expected first one.
Further digging in the VO documentation I have, tells me that I can set a style property for the tab strip that will prevent this unwanted focus change. It is the "Never focus" style, which says the tab strip never gets focus. I think this is likely a bit in the Style property of the tab strip, a long integer, but which bit!
I guess normally you use the VO GUI editor to manage these things, and never worry about which bit, but I don't have that.
Can anyone point me to appropriate documentation for these bits or even just tell me which bit I need to do this?
Failing that, I may need to install the old VO copy we have and play with a simple GUI to find the bit by trial and error.
Thanks in advance,
John
I am working on porting a large VO application, created by someone else, to X#. I don't have VO myself, although the organization has an old version that I might install if I get desperate.
I have got most things running fine now and am just chasing up some different behavior in a few GUIs. One I have an issue with is programmatically changing tabs on a tab control using SelectTab. When you select the tab, the runtime needs to construct the window which will be the new tab page, and also adjust the tab strip to indicate a new tab has been selected.
When the tab opens, the user expects the focus will be on a particular control, but it is not, even though the Show method for the window specifically sets it there. After some digging around, I believe what is happening is that the focus is actually set correctly as the window is shown, but the runtime then adjusts the tab strip, moving the focus to there, causing the control on the window to loose focus. This event is captured by the EditFocusChange method that correctly sets the focus to another control. The user then sees the focus on the logically second control rather than the expected first one.
Further digging in the VO documentation I have, tells me that I can set a style property for the tab strip that will prevent this unwanted focus change. It is the "Never focus" style, which says the tab strip never gets focus. I think this is likely a bit in the Style property of the tab strip, a long integer, but which bit!
I guess normally you use the VO GUI editor to manage these things, and never worry about which bit, but I don't have that.
Can anyone point me to appropriate documentation for these bits or even just tell me which bit I need to do this?
Failing that, I may need to install the old VO copy we have and play with a simple GUI to find the bit by trial and error.
Thanks in advance,
John