Geeks With Blogs
Prabhu Kumar a tech twaddler..
A colleague of mine had a strange problem today. He had written a small UI application for a Windows Mobile Professional device with many controls. The controls contained several check boxes, text boxes, labels and buttons. When he ran the dialog using the "Run Dialog" option in Visual Studio, it showed up correctly and when the program ran on the device a strange thing happened. Some of the controls would show up and others would not.

It wasn't random, the same set of controls showed up every time and others didn't. The UI was divided into three sections each contained within a group box. I could imagine how strange he must have thought it to be. But it had already happened to me before. And when he asked me for help, I couldn't help a smile (: If you had read
this post carefully enough, you would have noticed a small remark on the group box that I had made. "Add these three static controls into a group box, name the group box "Process Info". Remember to create the three static text controls before creating the group box. I was trying the other way around, by creating the group box first, the text controls would not show up, they were hidden behind the group box." And that was the exact problem in this case too. He had added controls to the UI in a particular order, or rather, in no particular order. So all the controls added before the group box showed up correctly and others didn't.


Update:
As Gato pointed out, this problem occurs because of the Tab order (also called z-order) of the individual controls. See the 'Comments' section below.
Posted on Friday, June 19, 2009 10:53 AM | Back to top


Comments on this post: Why would the controls not show up!

# re: Why would the controls not show up!
Requesting Gravatar...
I've notice that it depends on "Tab order" of the controls on the dialog (Format->Tab Order(Ctrl+d)) controls with higher tab order than Group Box are not shown (m.b. tab order = z-order)

my solution is
BOOL SetForegroundWindow(
HWND hWnd
);

p.s. sorry for my bad english :)
Left by Gato on Aug 09, 2009 6:29 PM

# re: Why would the controls not show up!
Requesting Gravatar...
Yes, you observation is correct. Thanks for letting us know :)

The showing of controls within a group box depends on the Tab order or z-order of the control. To change the tab order first open the dialog in the VS resource editor ,a Format menu appears. Select "Format -> Tab Order". A number appears on the top-left of all the controls denoting the tab order of that control. Double click on any number to start numbering the controls from 1 and then click on other controls to number them 2, 3, 4 and so on. For the group box problem make sure that all the controls inside the group box have tab order less than the group box itself.

And by the way, your english is fine (:
Left by Prabhu on Aug 17, 2009 4:02 AM

Your comment:
 (will show your gravatar)


Copyright © TechTwaddle | Powered by: GeeksWithBlogs.net