Useful Procedures
procedure self
The name of the task (which should also be the name of the parent frame
widget) should be set in the global variable frame. By default
the variable frame is set to the task name.
The frame title (which will be written by the window manager in the window
title bar) should be set in the global variable frametitle.
By default the variable
frametitle is set to a null string.
The icon title (which will be used to label the icon when the window is closed)
should be set in the global variable icontitle.
By default the variable
icontitle is set to a null string
The procedure self may have the argument
frame-name which returns the
frame name; the argument frame-title which returns
the frame title or the
argument icon-title which returns the icon title.
example of use
:frame [self frame-name] :label "[self frame-title]" :icon-name "[self icon-title]"
procedure click
The call-back mechanism from the widgets requires that a click procedure
exist. The library contains a default click procedure which may be used if the
rules enforced by it are acceptable.
The frame name containing the widget is stored in the TCL global variable
FRAME; the command returned is stored in the TCL global variable
COMMAND and the widget returned is stored in the TCL global variable
WIDGET.
If the command is :quit then
the procedure click-quit is called with
FRAME as an argument.
If the call-back is from WIDGET then an attempt is made to call the
procedure click-widget
if it exists. The number of argument in the supplied procedure is
checked. Zero or one argument (to hold returned value) are acceptable. If no
procedure with the name click-widget is found then an attempt is made to
invoke the procedure click-default. Again zero or one arguments are
acceptable. If no procedure with the name click-default is found then the
call-back is logged to the diagnostic stream and ignored.
procedure click-quit
Accepts zero or one argument (a frame widget name). The frame is iconized.
The default frame is the top level frame from the application.
procedure start
If the application is new (determined by the value of the TCL global variable
started) the procedure first calls the procedure
make-frame otherwise it
deiconizes the frame and brings it to the front on the screen. The procedure
click-redisplay
is called if it exists.
procedure finish
Destroys the frame and sets the TCL global variable started to its initial
value.
A number of procedures are available which can be used to control frame
widgets. By default if a frame widget name is not supplied then they act on
the parent frame for the task.
procedure open-frame
(also bring-to-front which is an alias)
Accepts an optional argument which is a frame widget name. Causes the
frame to be deiconified if it is closed and the footer width to be configured
using the width of the displayed frame.
procedure show-frame
As open-frame except that the footer width is not configured. Should be used
if the width of the frame may be unreliable - ie immediately after creation.
procedure close-frame
Accepts an optional argument which is a frame widget name. The frame is iconified.
procedure destroy-frame
Accepts an optional argument which is a frame widget name. The frame is destroyed.
This is normally only done when the task is deleted or the frame is unlikely to be
required again.
procedure centre-frame
Positions the frame in the center of the screen. Accepts an optional argument
which is a frame widget name.
procedure position-frame
position-frame x y [frame]
Positions the frame at the screen screen co-ordinates x y. Accepts an
optional argument which is a frame widget name.
Procedures which generate general purpose dialog or transient pop-up
windows.
procedure midas_dialog
This procedure accepts the same arguments as tk_dialog which it replaces.
It contains a number of implementation changes to circumvent problems in
tk_dialog. The global variable dialog_wraplength (which has the default
value 6I) controls the width of the dialog window.
procedure midas-warning
midas-warning msg
Creates a warning dialog pop-up window containing the text msg
and a button
labelled continue. The procedure returns only after a mouse click on the
continue button.
procedure midas-report
midas-report msg
Creates a report dialog pop-up window containing the text msg and a button
labelled OK. The procedure returns only after a mouse click on the
OK button.
procedure midas-confirmation
midas-confirmation msg
Creates a confirmation dialog pop-up window containing the text msg and
buttons labelled cancel and continue. The procedure returns only after a
mouse click on one of the buttons. The procedure returns the value 0 if the
cancel button is selected and the value 1 if the
continue button is selected.
procedure midas-error
midas-error error msg
If error is not a null string then it is an error code
returned by a Midas library
routine. An error report is constructed using error, any
text associated with
error and msg.
An error report dialog pop-up window containing the text
generated and buttons labelled continue and
abort is created. The
procedure returns only after a mouse click on one of the buttons. The
procedure returns the value 0 if the continue button is selected and the value
1 if the abort button is selected.
procedure display-midas-error-report
display-midas-error-report p error msg
If error is not a null string then it is an error code returned by a Midas library
routine. An error report is constructed using error, any
text associated with
error and msg. An error
report dialog pop-up window containing the text
generated and buttons labelled continue and
Trace Stack is created. The
procedure returns only after a mouse click on one of the buttons. The
procedure returns the error report text. Note that the first argument (p) is no
longer used.
procedure remove-midas-error-report
remove-midas-error-report args
Retained for compatibility with previous versions. Has no current action.
procedure midas-show-file
midas-show-file file
Displays the contents of the file having path file in an information frame
containing a text scroll window.
procedure midas-information
midas-information text
Displays the contents of the argument text in an information frame containing
a text scroll window. This procedure should be used in preference to
midas-report and midas-warning when the amount of text may be excessive for
insertion in a dialog pop-up window which cannot be scrolled.
procedure midas-save-window
midas-save-window name
Normally called by the default binding to the Control+S keyboard sequence.
Permits the contents of a text or listbox window to be saved to a disc file. A
browser window is started to obtain the filename to be used.
UNIX captures the window using the xgrabsc utility.
procedure midas-print-window
midas-print-window name
Normally called by the default binding to the Control+P keyboard sequence.
Permits the contents of a text or listbox window to be printed.
UNIX captures the window using the xgrabsc utility.
procedure midas-save-object
midas-save-object WIDGET
Normally called by the default binding to the Shift+Control+S keyboard sequence.
As the midas-save-window procedure except acts on the currently selected WIDGET only.
procedure midas-print-object
midas-print-object WIDGET
Normally called by the default binding to the Shift+Control+P keyboard sequence.
As the midas-print-window procedure except acts on the currently selected WIDGET only.