Programming Guide : Programming Frames : How You Can Invoke Frames : Pop-up Frames
 
Share this page          
Pop-up Frames
The openframe, callframe, and gotoframe statements enable you to open a frame as a pop‑up frame. Pop‑up frames are closely connected to the calling frame, always displaying on a layer above it and never iconifying independently of it (the pop‑up is always iconified whenever the calling frame is iconified).
Pop‑up frames are useful when you want to force the user to provide information or acknowledge a warning prior to continuing the action of the calling frame. Because the pop‑up can never be hidden by the calling frame, it serves the purpose of gathering information better than an ordinary called frame (which could get lost behind the calling frame).
In addition to enabling you to define your own frames as pop‑ups, OpenROAD provides four types of predefined pop‑up frames. This section discusses user-specified and predefined pop‑up frames.
How You Can Create Your Own Pop-up Frames
You specify a frame as pop‑up by setting IsPopup to TRUE in the optionlist when you invoke the frame's Property Inspector.
User-specified pop‑up frames can be invoked to display on top of active and inactive parent frames. To access an active parent frame that has been covered by a child pop‑up, the user must move it adjacent to the pop‑up. The parent can never overlay the pop‑up, which prevents the pop‑up from being hidden by the parent. You can specify the usual frame attributes for a pop‑up frame, such as resizability.
Pop‑up frames must be called by a parent frame or procedure. Starting frames cannot be pop‑ups. If a pop‑up is specified as the starting frame for an application, it is treated as a standard frame at runtime, as is a pop‑up frame run from the Go menu of the Frame Editor.
If a pop‑up frame is invoked by an object that is not itself viewable, such as a procedure or ghost frame, it displays in relation to the closest viewable ancestor (for example, the frame that called the procedure).
How You Can Use Predefined Pop-up Frames
The four predefined pop‑up frames display in the center of the calling frame and always make it inactive. Only after the pop‑up frame is closed does the calling frame become active again.
The following table describes the four types of predefined pop‑up frames:
Pop‑up Frame Type
Contains
Information
A message and an OK button
Confirm
A message, a Cancel button, and an OK button
Reply
A message, a prompt line, a Cancel button, and an OK button
File
A message, a file selection area, a Cancel button, and an OK button. (Your window toolkit determines the appearance of the file selection area.)
The following illustrates a Confirm pop‑up frame:
How You Can Call Predefined Pop-up Frames
Predefined pop‑up frames can be called only for the current frame or procedure. To call them, you invoke one of four methods of the ProcExec system class:
InfoPopup
ConfirmPopup
ReplyPopup
FilePopup
The syntax is:
CurFrame.method(parameters)
or
CurProcedure.method(parameters)
method
Refers to one of the four previously mentioned methods. For more information about the parameters available, see the ProcExec system class in the Language Reference Guide.
You also can open Information and Reply pop‑ups with the OpenROAD message and prompt statements. For more information about using these statements, see A Simpler Process for Creating Information and Reply Pop-ups.
To specify the value of a parameter, you must enter the parameter name followed by the value. The following example from the video_detail frame script uses the ConfirmPopup method to verify that the user wants to delete the video. The messagetext parameter specifies the text displayed in the pop‑up frame.
on click delete_button =
begin
    status = CurFrame.ConfirmPopup(messagetext =
        'You are going to delete this video.');
    if status != PU_OK then
        resume;
    endif;
...
ConfirmPopup, ReplyPopup, and FilePopup have return values. You must specify a variable of the appropriate type to receive the return value. In the previous example, the status variable is used to hold the return value.
Both the ReplyPopup and FilePopup methods have reply parameters. For the ReplyPopup method, this parameter contains a response that the user enters. For the FilePopup method, this parameter contains a file that the user selects. This reply parameter is a reference variable of type StringObject (for more information about the StringObject system class, see Working with Images and Text Strings).
When you invoke the ReplyPopup or FilePopup method, you can specify this parameter to display an initial reply in the pop‑up frame. For example, with the FilePopup method you can use the reply parameter to specify a default file selection. If the user types in a different reply or selects a different file name, the value of the reference variable is updated.
A Simpler Process for Creating Information and Reply Pop-ups
The OpenROAD message and prompt statements provide an alternative process for opening Information and Reply pop‑up frames, respectively. These frames function identically to the pop-up frames you open with the InfoPopup and ReplyPopup methods.
The OpenROAD message statement opens an Information pop‑up frame that displays a specified message. The syntax of the message statement is:
message varchar_expression
The OpenROAD prompt statement opens a Reply pop‑up frame that displays an entry field with the specified message as a prompt. You specify the variable name in which to store the user's response. The syntax of the prompt statement is:
variable = prompt varchar_expression
variable
Specifies any varchar variable in the frame
varchar_expression
Contains any variables, constants, or expressions