Popup Windows

KMoody

Member
I want my program to do the following:
  1. If the user clicks a button, the main window will freeze and another window will pop up on top of it.
  2. If the user clicks a button in the popup window, the popup window will close and pass information to the main window, which will unfreeze.
I've managed to get the popup window to appear, but I cannot close it and return to the main window. How can I do this?

Edit: I figured it out! I was looking for a "close" command, but for my purposes, setting the window widget VISIBLE attribute to false is just fine.
 
Last edited:

Cringer

ProgressTalk.com Moderator
Staff member
As for closing your window, look at
Code:
APPLY "CLOSE" TO THIS-PROCEDURE
Hiding the window will mean you will potentially have running instances of the program hidden away that never get cleared up. Essentially a memory leak.
 

KMoody

Member
Thanks.

I tried using that snippet of code with the cancel button's on choose behavior, but the button doesn't do anything when clicked. When I tried "APPLY "window-close" TO FRAME framePopup." instead, my "WAIT-FOR CLOSE OF CURRENT-WINDOW." code at the end of the program threw this error:

None of the widgets used in the WAIT-FOR statement are in a state (such as SENSITIVE) such that the specified event can occur. WAIT-FOR terminated. (4123)​

So how can I return to the main frame?
 
Last edited:

Cringer

ProgressTalk.com Moderator
Staff member
Without seeing your code it's hard to comment. Is there any way you can upload a simplified version of your code to look at?
 

gnome

Member
Try reading on "publish - subscribe" keywords. You can use such keywords to execute a procedure in a called procedure/window and also: the called procedure can execute an internal procedure of the main proc/window.
 

KMoody

Member
Okay, I fixed the issue by placing the popup code in a separate procedure. That way, when you click "Close" to run the trigger code "APPLY "CLOSE" TO THIS-PROCEDURE", only the popup gets closed.

If you don't put the popup in a separate procedure, the trigger code of "APPLY "CLOSE" TO THIS-PROCEDURE" will close the main procedure. That's probably why I was getting Error 4123 on "WAIT-FOR CLOSE OF CURRENT-WINDOW"; the program didn't have anything to wait for!

Thinking back, that should have been obvious to me. :oops:

Thanks for your help, everyone!
 
Top