DlgItem on top of another DlgItem.

Posted on 2000-01-10
Medium Priority
Last Modified: 2013-11-20
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.
Question by:hasmet
  • 2

Expert Comment

ID: 2339873
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.


Author Comment

ID: 2339941
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 ?

Accepted Solution

abancroft earned 400 total points
ID: 2339991
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).

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Watch the video to learn how one can deal with PST file corruption issue with an outstanding Kernel for Outlook PST Repair Tool easily. Using this tool, non-technical users can swiftly perform the repair process to restore their essential data witho…

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question