[comp.lang.pascal] Making modal modeless

dl2p+@andrew.cmu.edu (Douglas Allen Luce) (03/31/91)

Hi,

I may just be up late, but I cannot seem to find an adequate
solution to my quandary:

Within a modal dialog box called through Desktop^.ExecView, I have an
option which is supposed to create a window and place it on the
desktop, and then make it active.

When ExecView is called, the state of the desktop is saved.  After
I've placed the window in the DeskTop (through a call to
DeskTop^.Insert from the dialog box), the EndModal procedure is
called.  Within this procedure, the previous state is saved, and my
window cannot come up selected.  

Apparently, any messing with the DeskTop is erased after the EndModal
is finished, and I cannot kludge something by passing back a command
to the call of DeskTop^.ExecView to select the window now down,
because the DeskTop^.Current is empty, and the desktop doesn't think
there's anything out there!

It appears that perhaps the only thing I can do is to send an "Insert
Window" command all the way out of the modal dialog chain back to the
ExecView calling procedure, and then having it handle inserting the
window.  Since the window relys heavily on the context of the dialog
boxes, doing this would be hacky at best.

I must be missing something obvious; this seems like such a useful
thing to do!

Can anyone wake me up?

Douglas Luce
Chemical Engineering
Carnegie Mellon

cjaz@borland.com (Charles Jazdzewski) (04/04/91)

 dl2p+@andrew.cmu.edu (Douglas Allen Luce) writes:

>Within a modal dialog box called through Desktop^.ExecView, I have an
>option which is supposed to create a window and place it on the
>desktop, and then make it active.
>
>When ExecView is called, the state of the desktop is saved.  After
>I've placed the window in the DeskTop (through a call to
>DeskTop^.Insert from the dialog box), the EndModal procedure is
>called.  Within this procedure, the previous state is saved, and my
>window cannot come up selected.  
>
>Apparently, any messing with the DeskTop is erased after the EndModal
>is finished, and I cannot kludge something by passing back a command
>to the call of DeskTop^.ExecView to select the window now down,
>because the DeskTop^.Current is empty, and the desktop doesn't think
>there's anything out there!
>
>It appears that perhaps the only thing I can do is to send an "Insert
>Window" command all the way out of the modal dialog chain back to the
>ExecView calling procedure, and then having it handle inserting the
>window.  Since the window relys heavily on the context of the dialog
>boxes, doing this would be hacky at best.

It is not explicitly stated in the manual but groups do not support
modifications when they contain the modal view.  In this case, the
Desktop is the contains the modal view (the dialog) and therefore
should not be modified (i.e. no views should be added or deleted from
the group).  This leaves two potential solutions:  1) Have the dialog
record the changes need to be made and then perform the changes after
the dialog is terminated (EndModal).  This is in essence the solution
you propose. 2) Execute the dialog in another group, preferably the 
owner of the group (in this case, the owner of the Desktop is the 
Application so replace Desktop^.ExecView(D) to Application^.ExecView(D).

As an aside, the "Window List" (Alt-0) dialog in the IDE is does a 
similar thing to what you are doing (save it deletes windows, not 
adding them).  It is executed on the Application and not the desktop.

Chuck Jazdzewski                      cjaz@borland.com
Borland International