Re: How to do Z-axis ordering on elements in a Dialog Box?
- From: "AliR" <AliR@xxxxxxxxxxxxx>
- Date: Wed, 10 Aug 2005 14:28:35 -0500
> >From the MFC documentation:
> BOOL SetWindowPos(
> const CWnd* pWndInsertAfter,
> int x,
> int y,
> int cx,
> int cy,
> UINT nFlags
> );
>
> The first parameter would be &wndTop and the last would be
> SWP_NOMOVE|SWP_NOSIZE, BUT ...
>
> What do I do for x, y, cx, and cy? I could take these directly from
> Coil.rc but this isn't the elegant way to do it because if I wanted to
> relocate this in the future I'd have to change these values in multiple
> locations.
The first prarameter wouldn't be &wndTop the first parameter would be the
progress bar, that is what you are trying to place the static control after
(though it won't hurt to be &wndTop). And as far as x, y, cx, and cy goes
you set them to 0 and specify the SWP_NOMOVE and SWP_NOSIZE and SetWindowPos
will ignore the x, y ,cx, and cy parameters. (Read the docs for
SetWindowPos, sometimes you have to read the SDK docs on functions to get
the real story)
>
> Also, the problem with the solutions you're giving me is that they're
> all programmatic. Why in the hell isn't there a way in the resource
> editor to right-click on a dialog element and be able to choose Z-axis
> options like in PowerPoint? For God's sakes I can't even see the
> static text in the resource editor because it's hidden behind the damn
> progress bar!
There is a way you can do it in the resouce editor, and that is by setting
the controls tab order. Press ctrl+D
>
> Also, what is the effect of making the static text a child of the
> progress bar? That looks to me like it's entirely programmatic, i.e.
> the static text won't even show up in the resource editor?
>
But none of these approaches will give you a sound solution. The effect of
making the static a child of the progress is the same as making a static a
child of a dialog, the static will never ever be displayed below the dialog!
so by setting the static's parent to the progress, it garauntees that the
static will be on top of the progress. By the way you can call
m_Static.SetParent(m_Progress); to do this when things are begin created
through a dialog template.
Now as far as centering things, the dialog editor will give you two means of
centering things one is Center In Dialog under the format menu, or the
toolbar. This will center any selected control in the dialog template. The
other is simply Align -Centers, again under the format menu. This will
center two or more control in relation to each other. The control that has
the solid resize bars, stays in it's place and the other control will move
to center themselves in relation to that control.
By the way don't forget to set the text alignment property of the static
control to Center.
And also if you end up going with the approach of setting the parent of the
static to the progress then you can simply call m_Static.CenterWindow and it
will center itself within the progrss control.
AliR.
.
- Follow-Ups:
- Re: How to do Z-axis ordering on elements in a Dialog Box?
- From: Cyde Weys
- Re: How to do Z-axis ordering on elements in a Dialog Box?
- References:
- How to do Z-axis ordering on elements in a Dialog Box?
- From: Cyde Weys
- Re: How to do Z-axis ordering on elements in a Dialog Box?
- From: AliR
- Re: How to do Z-axis ordering on elements in a Dialog Box?
- From: Cyde Weys
- How to do Z-axis ordering on elements in a Dialog Box?
- Prev by Date: a dialog inside a CView app (SDI or MDI)
- Next by Date: Re: How to do Z-axis ordering on elements in a Dialog Box?
- Previous by thread: Re: How to do Z-axis ordering on elements in a Dialog Box?
- Next by thread: Re: How to do Z-axis ordering on elements in a Dialog Box?
- Index(es):
Relevant Pages
|