Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: guientry - Constructor Up: widgets - Module Previous: gopher.fromms - Function


guientry - Tool



Package display
Module widgets


Postscript file available

Tool for generating widgets for type-in of a GUI

include "guientry.g"

Constructors
guientry Make a guientry tool
Functions
array Make a widget for an array entry
boolean Make a widget for a boolean entry
booleanarray Make a widget for a boolean array entry
check Make a widget for a check entry
choice Make a widget for a choice entry
direction Make a widget for a direction entry
done Destroy this tool
doppler Make a widget for a doppler measure entry
epoch Make a widget for a epoch entry
file Make a widget for a file entry
frequency Make a widget for a frequency measure entry
list Make a widget for an extensible list of entry widget
measurecodes Make a widget for entry of measures codes
minmaxhist Constructs a widget for the entry of a range.
position Make a widget for a position entry
quantity Make a widget for a quantity entry
radialvelocity Make a widget for a radialvelocity measure entry
range Make a widget for a range entry
record Make a widget for a Record entry
region Make a widget for a region entry
scalar Make a widget for a scalar entry
scalarmeasure Make a widget for a scalar measure entry
string Make a widget for a string entry
twoentry Make a widget for a range entry, providing two entry boxes next to each other labelled 'min' and 'max'. This is used by minmaxhist, and is not intended for independant use.
type Return the type of this tool
untyped Make a widget for a untyped entry



Description

This tool generates Tk widgets for the entry of various types of Glish variables. This tool is used in the autogui. Note that guientry is served by the widgetserver and so that should be used to get access to a guientry.

The exact behavior of the generated widget depends upon the type of entry but in general:

  • The user may type in a value or a variable.
  • A value can entered as a number in the entry field.
  • A variable is entered by name only.
  • A value may also be unset by using the unset button under a popupmenu menu.
  • Either original or default values may be restored using the buttons under the popupmenu menu.
  • Values may also be inserted via the insert function. Either a value (e.g. 0.7), a string (e.g. '0.7'), or a variable (e.g. x or sqrt(y)) may be entered.
  • Once initialized, a given widget can be used only for one type of argument (i.e. integer, double, complex). An attempt to enter a value of another type will generate an error.
  • The widget always returns a a variable of the appropriate type via the get function. If the value of the widget is illegal then an illegal value is returned. This may be check for using the is_illegal() function.
  • Entry of a valid value by any means generates a value event that has as an argument the value entered.
  • The widget can be constructed so that the user cannot enter values directly (editable=F). This is used in the autogui for output-only values.

The various functions of guientry generate a subsequence that can be used to interact with the widget. The function and events supported by the subsequence are:

.get()
Function to get the current value. WYSIWYG applies.
.insert(entry)
Function to insert a value into the widget.
->insert(entry)
Event to insert a value into the widget.
->value(entry)
Event to designate that a user entered a new value.
.insertandemit(entry)
Function to insert a value into the widget and emit a value event if the value is valid.
.setwidth(width)
Function to set the total width in characters of the entry field(s).
.clear()
Function to clear the current value.
.addtowrench
Function to add a callback function to the wrench.
hlp
Argument to specify popup help

Parsing of entries is performed using the entryparser tool.

Most widgets have a popup menu that allows any of a number of operations. The standard ones are:

Original
Revert the entry to the original value that was first displayed.
Default
Revert the entry to the default value for this actual widget.
Unset
Toggle unset value. If the current value is not unset then it is changed to be so, if it already is unset then the original value is set.
Copy
Copy the current entry to the clipboard whence it may be retrieved using dcb.paste().
Paste
Paste the current entry from the clipboard. An entry can be inserted in the clipboard using dcb.copy(value).

In addition, other operations may be present, as appropiate. For example, those widgets for accessing files of various types can bring up an interactive file chooser.

One may add functions to the wrench, using addtowrench. The signature of the function is as in the following example. Note the use of the function insertandemit to insert the value and emit a value event if the value is valid. This is obviously required if a value is to be inserted into the widget.

#
# Addition to the wrench
#
  private.buttons.antennas := private.guientry.array();
  private.getantennas := function(ref self, ref its) {
    include 'gopher.g';
    wider private;
    self.insertandemit(dgo.getantennas(private.ms.name()));
  }
  private.buttons.antennas.addtowrench('Interactive', private.getantennas);



Example
include 'guientry.g'   
f := dws.frame();
ge := dws.guientry()
s := ge.scalar(f, value=30.0);
whenever s->value do {
  print 'Gui selected a scalar ', s.get();
}
q := ge.quantity(f, value='100Hz');
whenever q->value do {
  print 'Gui selected a quantity ', q.get();
}
m := ge.measure(f, value='dm.direction(\'b1950\', \'0deg\', \'0deg\')')
whenever q->value do {
  print 'Gui selected a measure ', m.get();
}




next up previous contents index
Next: guientry - Constructor Up: widgets - Module Previous: gopher.fromms - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15