Running Programs in GUI

jamesmc

Member
Hi All,

I am having a little problem. I have got a window in GUI that has a button on it that, when I press the button, runs another program.

What I want it to do is run the new program in a seperate and new window that closes when I close the new program. But at the moment it doesn't do that, it extents the window that is showing currently and just puts itself in there.

I really need to open a new window, run the new program in it while still keeping the previous window available to view, and then close down the new window once the program has completed its task.

TIA,

James.
 
James,

Run the second procedure persistently and parent it to the calling program's window. In the second window's design ensure you dont have "suppress window" set to true.

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
Definition section
DEF VAR h-child AS HANDLE.
.
.
Triggers
ON CHOOSE OF btn-whatever DO:

IF NOT VALID-HANDLE(h-child)
THEN
RUN progname PERSISTENT SET h-child (INPUT c-win:handle). /* pass in the current window's handle */
ELSE
RUN some-enable-function IN h-child.

END.
[/code]

I generally have an internal procedure in all called programs named "SHOW-SELF" which just sets the window's state to WINDOW-RESTORED, provided I only want one instance of the called program.

Now, define an input parameter in your called procedure and put this after the RUN Enable_UI statement:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
Definition section
DEF INPUT PARAMETER p-handle AS HANDLE.
.
.
.
Main Block
ASSIGN c-win:PARENT=p-handle.
[/code]

When your calling program closes the called program will close automatically (watch out for transactions!) When you minimize the calling program the called program will minimize with it too.

HTH
Rich



<FONT COLOR="#000000" SIZE="1" FACE="Arial, Verdana">[This message has been edited by rich_t on 28 June 2000 @ ]</font>
 
Rich,

This might work if I used the UIB to create all of the code that I have. I am developing standard sequential code to be run in a GUI environment.

The situation is that I have a menu. When a user selects option one (which runs prog1.p) I want to RUN VALUE("prog1.p") in a new window leaving the menu intact. Once prog1.p has completed running in its own window I want its window to close leaving the only the menu left.

If you want me to e-mail my code to you for a closesr look please let me know.

TIA,

James.
 
James,

Feel free to e-mail your code to me at rich_t_1@hotmail.com

I do something similar where I have a menu window which floats about and procedures are run persistently from it, etc. It doesn't have to be done in the UIB, it works just the same from the procedure editor.

Rich
 
James I have e-mailed you back some modified code.

For the benefit of anyone following this thread, I had a look at James' code (written in the procedure editor) and what was missing was the code to create a window to contain the defined frames, ie avoiding using the default procedure window.

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>

DEF FRAME f-myframe etc etc.

DEF VAR h-window AS HANDLE.

CREATE WINDOW h-window
ASSIGN width=60
height=6
title="My new window".

ASSIGN FRAME f-myframe:PARENT=h-window.

[/code]

Adding this code, or similar, to each of the called procedures will create a separate window each time, thus avoiding having all the frames displayed in the default procedure window.

Cheers
Rich
 
Back
Top