How to make a form visible?

NickA

Member
Have you taken a look at the 'VIEW' statement in the on-line help?

Other alternatives are resetting the 'VISIBLE' and 'HIDDDEN' attributes against the object (Useful if you've only got a handle to the object).

HTH
 
The problem is when a parent window calls a child window, then the parent window is closed, and then the child window is closed, the parent is invisible and can't be viewed on screen, how to solve this fellow?
 

NickA

Member
Simple example?

Can you knock a simple example together?

Is it possible that you are exiting the calling procedure? Or are you just hiding the calling procedure's window by setting attributes or using 'HIDE'?
 
The form is not hidden by program code. It is closed by the user clicking the close button of the form at the upper right corner.
 

tsspdx

New Member
"Form" has a very definite meaning in Progress. It's starting to sound like that's not what you mean at all.

Clicking on the upper right box closes (destroys) a window, including the forms it contains. In Progress parlance, it's a WINDOW-CLOSE event.

I agree with Nick. We can help you better if you tell us what you're trying to do.
 
Oh, I should use 'window' instead of 'form'.

The case is: A parent window (w-parent.w) has a menu. An option from the menu calls another window by 'run w-child.w'.

At that time there are 2 windows. Then if the parent window is closed as a 'winodws-close' event, it can never be bring up again. Even if I try to add 'run w-parent.w' in w-child.w, the w-parent is not shown on screen. But I know it is running at background since I see it exist on the task list when I press ctrl-alt-del.

So what can I do to show w-parent.w again? Thank you alot.
 

m1_ru

New Member
Which version of progress and platform are you running?
Can you localise the problem - make the minimal example of the problem?

In our system we disable close of main window and allow
to close only by choosing menu-item
/* disable close of main window by ESC and alt-F4 keys */
ON WINDOW-CLOSE OF {&WINDOW-NAME} DO:
RETURN NO-APPLY.
END.
ON CHOOSE OF MENU-ITEM m-exit DO:
APPLY 'CLOSE':u TO THIS-PROCEDURE.
END.
WAIT-FOR CLOSE OF THIS-PROCEDURE.
 

NickA

Member
Are you running the child 'persistently'?

This may be a stupid question (It depends what your current level of Progress GUI knowledge is), but could it be that you are not running the child window persistently? In that case you would have two windows with two wait-for's running at the same time - which would cause something like the symptoms you're describing.
 
Can u tell me how to run a window persistently?
And how to disable closing of window by the 'x' box at the upper-right corner?? Thx.
 

mra

Junior???? Member
Hi Kenneth!

Running a window persistent is no different that any other procedure.

DEF VAR hProc AS HANDLE NO-UNDO.
RUN wMyWindow PERSISTENT SET hPROC.
IF NOT VALID-HANDLE( hProc ) THEN
DO:
MESSAGE "Could not start MyWindow" VIEW-AS ALERT-BOX ERROR.
END.

A persistent procedure should not have a WAIT-FOR statement. If you're using appBuilder this will be handled automatically.

Preventing users from closing a window is just a matter of overriding the window-close event.

ON WINDOW-CLOSE OF wMyWindow
DO:
/* Prevent closing */
MESSAGE "No can do!" VIEW-AS ALERT-BOX MESSAGE.
RETURN NO-APPLY.
END.

BUT!!!
Why not allow users to close the main window, and then simply clean up after them?

Through SESSION:FIRST-PROCEDURE and THIS-PROCEDURE:NEXT-SIBLING you can access all procedures (windows) started persistent, and close them one at a time. You can also collect the handles of any window started


Hope it helps!

Regards
Mike
 
Hi Mike,

When I tried to do this as you suggest, I only saw a flash on the screen and the window closed automatically with prompting error message:


DEF VAR hProc AS HANDLE NO-UNDO.
RUN mass.w PERSISTENT SET hPROC.
IF NOT VALID-HANDLE( hProc ) THEN DO:
MESSAGE "Could not start MyWindow" VIEW-AS ALERT-BOX ERROR.
END.


Can you tell me what's wrong? Thx.
 

mra

Junior???? Member
Hi Kenneth

Persistent procedures will be deleted when the calling procedure ends - is this the Case?

If your testing from a procedure editor, your window will flash.

Try adding:

wait-for "close":U of hProc.

After the call.

If you start Pro*Tools / Procedures You'll be able to see all persistent procedures currently running.

Regards
Mike
 

mra

Junior???? Member
Uh!! Ehh! That's quite a mouth full :D

First of all, when you call your windows persistent, they'll run simultaneously (not multithreaded - Big difference). Progress will load a persistent procedure into memory, run the main part, and return to the caller. The new procedure will respond to GUI- and PUBLISHED events. All this means, that you can build applications which have multiple open windows at the same time.

Through the procedure handle (run xxyyzz persistent set hProc), the caller is able to run internal procedures in the persistent procedure. This means you'll be able to build persistent procedure libraries, and make windows which cooperate. In my application I'm having windows which requery data in other sub-ordinate windows.


SmartObjects is heavily based on persistent procedures.


Regards
Mike :awink:
 

Shawn

New Member
Parent Child

NOTE: MY spelling sucks but more importantly.

I have worked in this area a bit.
The best way I have found to deal with this issue is to create a my own windowing system using a Golbal temp table and some recursive functions to find the true parents and children at any level.

If you are running V8.2B and above to see the child you should also initialize the child object.
after you run it persistantly.

Proc RunChild:

RUN childwindow.w PERSISTENT SET hwin1.
RUN initializeObject IN hwin1.
RUN Setparent IN hwin1 (Input wwin:HANDLE).

End proceduere.


In the Child Window

Proc Setparent:
def input param hpasParent as handle.

wWin:pARENT = hpasParent.

End Procedure.

This creates a true parent child link.
There are alot more things that can be done but this is a start.
 
Top