Applications may consist of multiple frames, either permanent, or temporary such as for opening a `settings' window. This section discusses how frame references can be found, as well as how frames can force the user to deal with this frame first, in favour of all the other frames of the application: modal frames.
The class application
is the key to this section. An
application is a
subclass of visual, and
optionally located between display
and frame in the visual
consists-of hierarchy. It defines the `application<-
member'
method to located named frames, and thus supports locating frames
similar to other graphicals as described in section
10.4.
A frame is made part
of an application
using the method
`frame->
application'.
The application to which a frame is related may be changed. Frames are
not required to be part of an application.
->
modal'.
The application to which a frame belongs may be changed at any time. Using the @nil argument, to frame is detached from any application.
This method invokes `application->
delete'
to the application currently holding the frame (if any) and `application->
append'
to the application receiving the frame. These methods may be redefined
if an application wants to keep track of its associated frames.
<-
name'
returns the argument name. See also `device<-
member'
and section 10.4.
The term transient window is taken from X11. A transient window (frame) is a frame that supports another frame. Transient windows are normally used for prompting. The related method is:
->
status: {unmapped,hidden,iconic,open}')
of the main window are forwarded to the transient windows. If the main
window is destroyed, so is the transient window.
The method `frame->
modal'
works in combination with class
application and
transient frames to define what frames are temporary insensitive to
events, forcing the user to operate on the modal frame first.
<-
application,
the frame I am <-
transient_for, or none. A common
sequence to display a modal dialog window centered on a frame is below.
Note that, instead of `frame
->
open_centered', one could also have used `frame<-
confirm_centered'.
settings(Frame) :-> "Open settings dialog":: new(D, dialog(settings)), send(D, transient_for, Frame), send(D, modal, transient), ..., <fill the dialog>, ..., send(D, open_centered, Frame?area?center).
Instead of using the center of a frame, the method can also use the location of @event to position itself. The code fragment for that is:
..., ( send(@event, instance_of, event) -> get(@event, position, @display, EventPos) ; EventPos = @default) ), send(D, open_centered, EventPos).