Dialog box "z-order" problem

Hi,

I have tree dialog box opened in a SDI application. Depending of the opening
sequence, I can't put on top (topmost) some of the dialog box. I tried to
modify some settings like the "style" or the "border" of the dialog box but
without positive result. Any suggestions?

Thanks,

Hugo



0
H
7/9/2003 6:17:00 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
1612 Views

Similar Articles

[PageSpeed] 24

Try calling

        SetWindowPos( &CWnd::wndTopMost, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE );

in the OnInitDialog() function of your dialog class.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------


"H.B." <hbcrdv@_hotmail_.com> wrote in message
news:1057774619.849605@news.drenet.dnd.ca...
> Hi,
>
> I have tree dialog box opened in a SDI application. Depending of the
opening
> sequence, I can't put on top (topmost) some of the dialog box. I tried to
> modify some settings like the "style" or the "border" of the dialog box
but
> without positive result. Any suggestions?
>
> Thanks,
>
> Hugo
>
>
>


0
CheckAbdoul
7/9/2003 6:46:33 PM
The problem is more specifically like ...

First, I open the dialog box "A"
Secondly, I open the dialog box "B"
And finally I open the dialog box "C"

(The dialog boxes are created with Create() and showed or masked with
ShowWindow())

After that, "C" is topmost, followed by "B" followed by "A". The problem is
that I cannot put "B" in front of "C" and "A" in front of "B" or "C" when I
click on the corresponding dialog box.

What I want its' be able to put any of these dialog boxes in front of the
others when I click them. I presume that a window style exist to make this
possible without having to catch the event (something like OnFocus or
OnClick) and put the dialog box manually in front of the others.

Thanks,

Hugo



"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6F7267> wrote
in message news:uGz$gpkRDHA.1920@TK2MSFTNGP11.phx.gbl...
> Try calling
>
>         SetWindowPos( &CWnd::wndTopMost, 0,0,0,0, SWP_NOMOVE |
SWP_NOSIZE );
>
> in the OnInitDialog() function of your dialog class.
>
> --
> Cheers
> Check Abdoul [ VC++ MVP ]
> -----------------------------------
>
>
> "H.B." <hbcrdv@_hotmail_.com> wrote in message
> news:1057774619.849605@news.drenet.dnd.ca...
> > Hi,
> >
> > I have tree dialog box opened in a SDI application. Depending of the
> opening
> > sequence, I can't put on top (topmost) some of the dialog box. I tried
to
> > modify some settings like the "style" or the "border" of the dialog box
> but
> > without positive result. Any suggestions?
> >
> > Thanks,
> >
> > Hugo
> >
> >
> >
>
>


0
H
7/9/2003 7:50:55 PM
It's also seems that "B" and "C" are child of "A". Why? I dont know! They
are supposed to be child of main window (SDI) because I used Create(IDD,
NULL).

I found this trying to the child style for dialog box "B" and "C".


"H.B." <hbcrdv@_hotmail_.com> wrote in message
news:1057780254.287597@news.drenet.dnd.ca...
> The problem is more specifically like ...
>
> First, I open the dialog box "A"
> Secondly, I open the dialog box "B"
> And finally I open the dialog box "C"
>
> (The dialog boxes are created with Create() and showed or masked with
> ShowWindow())
>
> After that, "C" is topmost, followed by "B" followed by "A". The problem
is
> that I cannot put "B" in front of "C" and "A" in front of "B" or "C" when
I
> click on the corresponding dialog box.
>
> What I want its' be able to put any of these dialog boxes in front of the
> others when I click them. I presume that a window style exist to make this
> possible without having to catch the event (something like OnFocus or
> OnClick) and put the dialog box manually in front of the others.
>
> Thanks,
>
> Hugo
>
>
>
> "CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6F7267>
wrote
> in message news:uGz$gpkRDHA.1920@TK2MSFTNGP11.phx.gbl...
> > Try calling
> >
> >         SetWindowPos( &CWnd::wndTopMost, 0,0,0,0, SWP_NOMOVE |
> SWP_NOSIZE );
> >
> > in the OnInitDialog() function of your dialog class.
> >
> > --
> > Cheers
> > Check Abdoul [ VC++ MVP ]
> > -----------------------------------
> >
> >
> > "H.B." <hbcrdv@_hotmail_.com> wrote in message
> > news:1057774619.849605@news.drenet.dnd.ca...
> > > Hi,
> > >
> > > I have tree dialog box opened in a SDI application. Depending of the
> > opening
> > > sequence, I can't put on top (topmost) some of the dialog box. I tried
> to
> > > modify some settings like the "style" or the "border" of the dialog
box
> > but
> > > without positive result. Any suggestions?
> > >
> > > Thanks,
> > >
> > > Hugo
> > >
> > >
> > >
> >
> >
>
>


0
H
7/9/2003 9:10:18 PM
Have you tried doing BringWindowToTop when you get the OnMouseActivate message? 

Borders have nothing to do with Z-order, they control appearance only. 

You can also use SetWindowPos to hwndTopmost, but that can have problems in that the
window can remain topmost even when the app is not active, so you may have to clear the
topmost flag when the dialog receives an OnActivate message saying it is being
deactivated.
					joe

On Wed, 9 Jul 2003 17:10:18 -0400, "H.B." <hbcrdv@_hotmail_.com> wrote:

>It's also seems that "B" and "C" are child of "A". Why? I dont know! They
>are supposed to be child of main window (SDI) because I used Create(IDD,
>NULL).
>
>I found this trying to the child style for dialog box "B" and "C".
>
>
>"H.B." <hbcrdv@_hotmail_.com> wrote in message
>news:1057780254.287597@news.drenet.dnd.ca...
>> The problem is more specifically like ...
>>
>> First, I open the dialog box "A"
>> Secondly, I open the dialog box "B"
>> And finally I open the dialog box "C"
>>
>> (The dialog boxes are created with Create() and showed or masked with
>> ShowWindow())
>>
>> After that, "C" is topmost, followed by "B" followed by "A". The problem
>is
>> that I cannot put "B" in front of "C" and "A" in front of "B" or "C" when
>I
>> click on the corresponding dialog box.
>>
>> What I want its' be able to put any of these dialog boxes in front of the
>> others when I click them. I presume that a window style exist to make this
>> possible without having to catch the event (something like OnFocus or
>> OnClick) and put the dialog box manually in front of the others.
>>
>> Thanks,
>>
>> Hugo
>>
>>
>>
>> "CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6F7267>
>wrote
>> in message news:uGz$gpkRDHA.1920@TK2MSFTNGP11.phx.gbl...
>> > Try calling
>> >
>> >         SetWindowPos( &CWnd::wndTopMost, 0,0,0,0, SWP_NOMOVE |
>> SWP_NOSIZE );
>> >
>> > in the OnInitDialog() function of your dialog class.
>> >
>> > --
>> > Cheers
>> > Check Abdoul [ VC++ MVP ]
>> > -----------------------------------
>> >
>> >
>> > "H.B." <hbcrdv@_hotmail_.com> wrote in message
>> > news:1057774619.849605@news.drenet.dnd.ca...
>> > > Hi,
>> > >
>> > > I have tree dialog box opened in a SDI application. Depending of the
>> > opening
>> > > sequence, I can't put on top (topmost) some of the dialog box. I tried
>> to
>> > > modify some settings like the "style" or the "border" of the dialog
>box
>> > but
>> > > without positive result. Any suggestions?
>> > >
>> > > Thanks,
>> > >
>> > > Hugo
>> > >
>> > >
>> > >
>> >
>> >
>>
>>
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
7/9/2003 9:53:35 PM
Reply:

Similar Artilces:

Z-ordering of an SDI application with modeless CDialog
Hello, I have some modeless CDialogs in my application. My main window is a SDI application (CFormView in a CFrame) My problem is that my CDialog that are not modeless are always on top of my main window, I tried to create them with NULL as parent or CWnd::GetDesktopWindow() but it does not seem to work. I would like my CDialogs to behave like normal windows and to be displayed on top when the menu action is creating them but I need the main window to come back to the front when it is selected. What should I investigate ? Did I do a bad thing by mixing a SDI app with CDialogs? Thanks...

MFC-app starting WINDOWS Screensaver window z-order problem
Hi! I wrote an MFC-app using VC++.NET 2003, which starts a screensaver using CreateProcess(). It also terminates the screensaver using TerminateProcess() / CloseHandle(). If the user activates mouse/keyboard before my app terminates the screensaver-process, the screensaver terminates itself and the z-order and focus-handling of open windows somehow gets mixed up. this just happens when I use CreateProcess(), when I use PostMessage(WM_SYSCOMMAND, SC_SCREENSAVE, 0) for the standrad-screen-saver, everything works fine, but I dont want to use this approach. maybe the system uses different CreateP...

how to change z-order of modeless dialog
Hi, I have an app with a modeless dialog. What I want to do is when the user clicks on the main app window, the modeless dialog should stay behind the main window app. Thanks for your help, Paul I posted the same question here a while ago, and someone suggested this solution: Set the desktop as the parent of your modeless dialog. Use CWnd::GetDesktopWindow() to get the CWnd * you need. I was warned that this can cause a lot of problems, but after real-world use in several applications, there have been none so far (frantically knocks wood). Give it a try and see if it does what y...

Z-Ordering supported?
Does Excel (2002, 2003) support Z-Ordering of Inserted Objects? I found it ...

z-order in dialog editor
Hi, I'm getting entirely frustrated in attempting to layout a dialog and manipulate the controls. I'm using MFC in VS2003. There doesn't appear to be any ability within the Format menu to manipulate the z-order of the controls on the dialog. I went into the "Customize..." dialog and found "Bring to Front" and "Send to Back" under the Format menu. I added these to my Format toolbar thinking that I had solved the problem. So what happened? Nothing! I select a control and the "Bring to Front" and "Send to Back" toolba...

modeless Dialog Z-order
Hi Is it possible to change the z-ordering of modeless dialogs, so they don't stay on top of the parent? Rgds Tage This question gets answered here once a week. The parent of both dialogs have to be the same. A child dialog can not go behind his parent window. See this for possible alternatives: http://groups.google.com/group/microsoft.public.vc.mfc/browse_thread/thread/7928fbff4a61357c/9ae5eab363eb0e6f?lnk=gst&q=Child+Dialog+ZOrder#9ae5eab363eb0e6f AliR. "Tage Korsdal Nielsen" <tkn@korsdal.dk> wrote in message news:OJQFna2jIHA.3740@TK2MSFTNGP03.phx.gbl... &...

Z-Order and modeless CDialogs
Hey there, I'm creating an dialog-based application in MFC that utilized many (or at least some) modeless dialogs. I generally display the dialogs via calls to Create and the ShowWindow(SW_SHOW). This all works fine, except in the following circumstance. If I launch the initial dialog for the application and then subsequently launch 2 more modeless dialogs (for now all the dialogs are based on the same resource, if that matters), everything works fine - I can change focus from one dialog to another. The problem is that he window ordering does not change. If I click on the 2nd dialo...

Z-Order of Topmost window (Multithreaded UI)
Hi everyone, I see behavior which violates rules from the well-known article "Windows Features" http://msdn.microsoft.com/en-us/library/ms632599(VS.85).aspx I have an MFC MDI application which is a bit different from a generated by Visual Studio Wizard: ChildFrames are not WS_CHILD but WS_POPUP. It allows to move MDI-childs out of the MainFrame. Looks good! Since ChildFrames are popup windows now, they are owned by the Mainframe. On some user action I want to create a topmost window in a separate thread. I design it to have WS_POPUP and WS_EX_TOPMOST styles and have the active ...

Dialog box "z-order" problem
Hi, I have tree dialog box opened in a SDI application. Depending of the opening sequence, I can't put on top (topmost) some of the dialog box. I tried to modify some settings like the "style" or the "border" of the dialog box but without positive result. Any suggestions? Thanks, Hugo Try calling SetWindowPos( &CWnd::wndTopMost, 0,0,0,0, SWP_NOMOVE | SWP_NOSIZE ); in the OnInitDialog() function of your dialog class. -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- "H.B." <hbcrdv@_hotmail_.com> wrote in messa...

How do I know a window's z-order?
hi,all I use spy++ to get some information of a window, is there any way I can know the window's z-order? Or in spy++ window's property, the previous window and Next window is just the z-order? I mean that does the previous window mean the window in front of current window, and the next window mean the one behind current window? Thanks Yes. Spy++ will show you the windows in z-order. The first is on top, and next is just below that, etc. "Nicky" <Nicky@discussions.microsoft.com> wrote in message news:6531FDA8-CB2E-4B98-A8E4-6975D3575D7A@microsoft.com... ...

Z-order Plotting Area
Hi, How can I change the Z-order of objects in the plotting area? I Added a rectangle, which was meant to appear in the background, but it covers my data series. Thanks, Hi, All embedded objects within the chart will appear above the actual charting layer. Maybe you could produce the rectangular area using dummy data series. What information does the rectangle relate to in the context of your chart? Cheers Andy Geert Porteman wrote: > Hi, > > How can I change the Z-order of objects in the plotting area? > I Added a rectangle, which was meant to appear in the background,...

how can I keep top-level windows in their relative z-order
A top level window will come to the top of the z-order (here I am assuming no always-on-top windows) when activated, say by clicking on it. But the owner of a top-level window will never be brought above its owned windows. Does anyone know of a simple way to prevent the top-level windows of an application from changing their z-order when activated? Why do I want to do this? I have an application that allows transparent Flash controls. As you know, transparent Flash control must be housed in a top-level window (Actually, they must be housed in a WS_EX_LAYERED window and a WS_EX_LAYERED...

Odd Z-order behavior
I have a Dialog app, that opens a couple of other windows in separate threads. They are in separate threads to minimize slowing down the UI and each other as they are displaying graphics and DirectShow windows. It's not your typical desktop app, it's a specialized program for a specialized purpose (just to forstall the inevitable "why would you want to have a big black window" kinds of questions).. I create the threads from my main dialog app using the following code: BlackThread = new CBlackThread(); // here I set some variables that have to be inited before the t...

Send form windows to the back of -global- Z-order
I know there is a function to send child form windows to the back of an app's 'local' Z-order. And there's an easy way to send them to the -front- of the global Z-order. But is there any way to send them to the back of the global Z-order? In other words, place the form windows behind all other currently active windows? Bob wrote: > I know there is a function to send child form windows to the back of > an app's 'local' Z-order. And there's an easy way to send them to the > -front- of the global Z-order. > > But is there any way to se...

z-order of various lines and bars in an Excel 2007 chart
What is the procedure for changing the z-order of various lines and bars in an Excel 2007 chart, such as drop lines, high-low lines, up/ down bars, and error bars? I observed that when I add drop lines to an Excel 2007 chart, they appear in front of the underlying data -- in my case, the underlying data is displayed as a plotted area. I want the plotted area to be fully visible with no lines over it. I would like to send the drop lines to the back and keep the plotted area in the front, but there is no option to do this. So, is there a procedure for adjusting the z-order of drop...

Control Z-Order of drop lines in an Excel 2007 chart?
Can anyone describe for me the procedure for changing/controlling the z-order of drop lines relative to the plotted data in an Excel 2007 chart? I would like for the chart's drop lines to remain active, but appear behind the plotted data. The default display for drop lines seems to be on top. Thanks! Joseph That is the default behaviour and AFAIK there is no way to change that. Regards, Peter T "Joseph" <Joseph@discussions.microsoft.com> wrote in message news:4496AFC2-105D-42C4-90D8-061C316618C7@microsoft.com... > Can anyone describe for ...

Z-order
Hi. I'm using Visual Studio .NET. I would like to change the z-order of the controls in a dialog (the position of ones on top of others, something like the third dimension), at design time, with the Visual Studio form designer. Cheers. Hi, The Z-Order of the controls on a dialog defines the tab-order, so changing the tab-order will change the Z-Order and visa-versa. Hope this helps Chris Taylor "sWitCh" <mispamaki@N05PAMyaDOTcom> wrote in message news:OnOE3BiyDHA.2464@TK2MSFTNGP12.phx.gbl... > Hi. > I'm using Visual Studio .NET. I would like to change th...

Big bug with Z-Ordering in MFC (or resources or whatever...)
When you put a control over another control, say for example a Button over a Static control, the static draws itself over the button, so you cant see the button, but when you click the button (where you guess it should be...), it appears and presses, like it was always there... This problem give me the creeps! What i'm trying to do is make a window with some dynamically created controls which have the ability to move and resize (using CRectTracker or something similar), but can you imagine what it makes of it when one window goes over another? and when i'm trying to fix the ZOrder some...

How to set controls' Z-order
I'm trying to modify the Z order of a (CStatic label) control so it appears on top of a (CStatic bitmap) control. My bitmap background covers the entire dialog window and is created in the resource editor. I want all my controls that I create at run time to go on top of the background. So in my OnInitDialog().. // CStatic *Label1; (in the class decl) Label1 = new CStatic(); Label1->Create(_T("Label1 !"), WS_CHILD|WS_VISIBLE, CRect(700, 500, 800, 600), this); Label1->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); And the label ...

Z-order and child windows
Questions: 1) Is there a way to get the top level window in an application, that is NOT system wide? ( GetForegroundWindow() is system wide. I want something similar that is limited to my application only. ) 2) Does EnumChildWindows include windows owned, such as modal windows or message boxes? ( Or must I enumerate all windows, and see if it belongs to my application by verifying the parent window of those windows is us?) >1) Is there a way to get the top level window in an application, that is NOT >system wide? >( GetForegroundWindow() is system wide. I want something similar...

Shapes, Cells and Z-Order
I'm trying to pretty up a workbook by adding some shapes and I'm curious if there was a way to cause a cell (and it's contents and formatting) to appear above a shape. More specifically I'd like to add a sort of frame around a range with a color fill gradient and shadows but have the cells in the location appear above it. I'v fooled around with send to back on the shapes and different combinations of transparency and pattern settings but the shape always appears "on top" of the cells. Just curious if there was a way to do this? Jon Jon, You can't put any...