DlgItem on top of another DlgItem.

I have an edit control that is in a static group box. I also have a
checkbox with a title. I dont have any
title for static group box. I put my check box on top of  groupbox title
location so it looks like a title to the group. I put a lower tab order
for the group box than check box.
and also I selected a transparent
attr. for the checkbox.
so when checkbox is selected I make
controls in the group disabled.

It seems doing what I want, but is this
a good/proper way ? I try to use setwindowpos to set some z-order, but
that doesnot change any order on
this static group box.

again I see these type of dialogs
in windows/NT, and I want to make
sure the best/proper way to do this.

please put comment before locking
the question, I want to give the points to the most convincing answer.
LVL 1
hasmetAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

abancroftCommented:
I have used this technique a few times.

I usually use it when there is some optional functionality that requires additional user input.

I believe it's good technique, because:
1. At a glance, the user can tell whether the functionality is enabled or not (the checkbox);
2. Also at a glance, the user can readily identify what extra input the additional functionality requires (the group box contains the controls);
3. It's obvious to the user that the check box controls the additional functionality (the combination of the check & group boxes);
4. For the programmer, it's very maintainable. In the resource editor it's obvious what's going on, with out having to examine code for SetWindowPos() calls. And MFC makes things like this soooooo easy. In general, visual editing is much quicker and informative than code.

0
hasmetAuthor Commented:
what are the attributes for
static group box and for check box ?
how is the tab order is playing role here ? is the group box upper border
going to be ever visible on top of the check box title and ruin the trick ?
0
abancroftCommented:
I disable the group box and make sure it isn't a tab stop.

The check box is transparent, as you describe.

In the resource editor do what you describe - have the group box BEFORE the check box.

That's it.

The tab order also determines the order the controls are created. This order in which they are created determines the Z order - later controls are on top of earlier ones. i.e. the first control in the tab order is created first, which means it is at the bottom of the Z order.

It seems like the user cannot ever bring the group box on top of the check box. I tried swapping tab order, applying the notify style to the group box, giving it a valid control id (not IDC_STATIC).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.