15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


modeless dialog Z order problem

Todd Southwell -- todd@odessa.nosc.mil
Friday, July 12, 1996

msvc 1.5 win 3.1

Hello-

I have a formview-based application. Modeless dialogs which are created 
upon the push of a button, [ Create(IDD_DIALOG?, NULL) ], work fine except:

When the dialog is up, and the user clicks on the formview, the 
formview does not come to the top. Instead, the frame of the formview 
flashes upon clicking the formview's titlebar, gains focus, but does not 
get drawn on top. The modeless dialog remains on top, *without the focus*.

I can place other apps(terminal, paintbrush, etc.) on top of both windows 
no prob. yet, when the user clicks either the formview or modeless dialog 
titlebar, both windows come up, with the modeless dialog on top, regardless.

Any ideas? I believe the second parameter in the Create call( listed as 
NULL), is a valid parent, because it will search for the parent frame, no?

I'm short on time.

Regards,
Todd




Jim Tannenbaum -- jimt1@voicenet.com
Monday, July 15, 1996

[Mini-digest: 5 responses]

Todd,

        This isn't as straight forward as you might think.  The FormView is
the framework for the app.  Therefore, it can't be on top of the modeless
dialog boxes.  Either close them when they loss focus or minimize them or
?(via over ride of OnActivate is easiest).

                Good Luck,

                  Jet


JJM Systems, Inc                 Phone: (215) 672-3660
1 Ivybrook Blvd, Suite 190       Fax:   (215) 672-5702
Ivyland, PA  19874               Net:   jimt1@voicenet.com


-----From: "michael" 

Michael says..

If you check the archives for this forum, you'll find the following post
back in
February '96. 

Caveat: This solution is for VC++ 4.x

----------------------------------------------------------------------------
----------------------------------------
Subject: Re: How to make a modeless dialog box NOT always on top

I had a similar situation, and came up with a solution, but I'm not sure
whether it has any bad side effects or not.  I created the dialog with
the desktop window as the parent ( GetDesktopWindow() ).  I know it requires
a little more attention to what happens when you close the app, since the
dialog doesn't get a close message when the main window closes, but that isn't
really a problem.

 Marty Fried (mfried@linex.com)
----------------------------------------------------------------------------
----------------------------------------

>msvc 1.5 win 3.1
>
>Hello-
>
>I have a formview-based application. Modeless dialogs which are created 
>upon the push of a button, [ Create(IDD_DIALOG?, NULL) ], work fine except:
>
>When the dialog is up, and the user clicks on the formview, the 
>formview does not come to the top. Instead, the frame of the formview 
>flashes upon clicking the formview's titlebar, gains focus, but does not 
>get drawn on top. The modeless dialog remains on top, *without the focus*.
>
>I can place other apps(terminal, paintbrush, etc.) on top of both windows 
>no prob. yet, when the user clicks either the formview or modeless dialog 
>titlebar, both windows come up, with the modeless dialog on top, regardless.
>
>Any ideas? I believe the second parameter in the Create call( listed as 
>NULL), is a valid parent, because it will search for the parent frame, no?
>
>I'm short on time.
>
>Regards,
>Todd
---------------------------
Michael Thal
Data Tree Corporation
voice: (619) 231-3300
fax:      (619) 231-3301

-----From: "R.H.J. Geraets" 

Use GetDesktopWindow() in stead of NULL as the second parameter in the
Create call for your modeless dialog.

Rene' Geraets

-----From: Kostya Sebov 

Dear Tod,

The dialog (no matter modal or modeless) is usually pop-up window (the one
having WS_POPUP style). Yout formview is in short a child (WS_CHILD) of the
app's main window, which is WS_OVERLAPPEDWINDOW. Pop-up windows *by definition*
appear above the overlapped windows of the same app (probably thread -- not sure)
and obviously their children.

The quickiest solution is to move your dialog into another formview. Moreover
it will avoid user's possible confusion between the windows of the different type,
each of whic can have the focus.

You can also experimant with the dialog as a child of your main window, but
ussualy it doesn't yeld any success.


Sincerely,
--- 
Kostya Sebov. 
----------------------------------------------------------------------------
Tel: (38 044) 266-6387 | Fax: (38 044) 266-6195 | E-mail: sebov@is.kiev.ua
-----From: ted r lowe 

Environment: vc++ 4.1/winnt,win95

i'm experiencing the exact same problem and need to solve
it soon.  i spent hours hacking TOPMOST/BOTTOMMOST parameters, etc.
for both the parent and (modeless dialog) child windows
to no avail. The only reply on this problem so far, posted
some code for hiding the modeless dialog window, which
is not helpful in this case, since i just want the z order to
change.  thank you for any reply!

ted
---
   who: ted r lowe                  \  "Imagination is more     \
 where: Wheaton, IL, USA, Earth      \ important than knowledge" \
e-mail: trl@mcs.net                   \                           \
   url: http://www.mcs.net/~trl/       \        Albert Einstein    \
 phone: voice=708-260-0424 fax=260-0570 \                           \          




Roger Onslow -- Roger_Onslow@compsys.com.au
Monday, July 22, 1996

Frame is parent of the dialog, and, like and good parent, it always puts its 
children first.
(ie. parent frame always displays underneath its children -- otherwise you'd 
never see the views inside a frame!!)
           /|\        Roger Onslow
      ____|_|.\       ============
    _/.........\Senior Software Engineer
   /CCC.SSS..A..\
  /CC..SS...A.A..\   Computer
 /.CC...SS..AAA...\       Systems
/\.CC....SSAA.AA../            Australia
\ \.CCCSSS.AA.AA_/
 \ \...........//      Ph: +61 49 577155
  \ \...._____//      Fax: +61 49 675554
   \ \__|_/\_//    RogerO@compsys.com.au
    \/_/  \//






| Вернуться в корень Архива |