Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!borland.com!cjaz From: cjaz@borland.com (Charles Jazdzewski) Newsgroups: comp.lang.pascal Subject: Re: Making modal modeless (TVision question) Message-ID: <1991Apr4.023102.4923@borland.com> Date: 4 Apr 91 02:31:02 GMT References: Organization: Borland International Lines: 42 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