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


next up previous contents index
Next: gchooser - Constructor Up: widgets - Module Previous: fontchooserwidget - Constructor


gchooser - Tool



Package display
Module widgets


Postscript file available

Tool for generating widgets for choosing items interactively

include "gchooser.g"



Description

This tool generates a Tk widget for choosing items interactively. The items must be associated with x, y coordinates, and a label. The items are plotted using the pgplotter, and the user is allowed to select items by left-clicking or to deselect items by right-clicking. The plot frame may also be printed as a postscript file or saved as an AIPS++ plot file.

An example of the use of gchooser is given in figure 1.12.

The constructor returns a subsequence with functions:

self.done
Delete this widget
self.get
Get a record containing information on the choices
self.insert
Insert a set of choices as a vector of the selected indices.

The events are:

self->select
Returns index selected
self->deselect
Returns index deselected
self->values
A set of values was accepted. The returned record contains information about the choices.

The selection works as follows:

To select a region
Click mouse button 1 (usually the left hand button) and drag over the region that you wish to select. All elements in the region delineated are selected, and the items selected are plotted in green.
To select a given element
Click mouse button 2 (usually the middle button) near a label. The item selected in plotted in green.
To deselect a given element
Click mouse button 3 (usually the right hand button) near a label. The item deselected in plotted in red.
To select all items
Click the All button in the bottom left hand corner. All items will be plotted in green.
To dselect all items
Click the None button in the bottom left hand corner. All items will be plotted in red.


An example of a graphical chooser. Selected items are in green.
If the argument axes is set to 'sky', then the axes are labelled according to interpretation as Right Ascension (x) and Declination (y).



Example
include 'gchooser.g'   
include 'table.g'   
t:=table('3C273XC1.ms/ANTENNA');
position := t.getcol('POSITION');
labels := t.getcol('NAME');
indices := t.getcol('ANTENNA_ID')+1;
t.done();
x := position[2,];
y := -position[1,];

gc := gchooser(labels=labels, indices=indices, x=x, y=y, autoref=T,
	 plottitle='Antenna locations',
	 width=500, height=500);
whenever gc->values do {
  print "Values are ", $value;
}
whenever gc->select do {
  print "Selected ", $value
}
whenever gc->deselect do {
  print "Deselected ", $value
}
-
Selected 4
Selected 28
Selected 11
Selected 26
Selected 17
Selected 15
Selected 18
Selected 24
Values are [selection=[4 11 15 17 18 24 26 28] , labels=VLA:W6 VLA:OUT
VLA:N2 VLA:N4 VLA:E4 VLA:E6 VLA:E2 VLA:W2, x=[-207.86 37.1272 32.3322
25.3736 170.777 304.882 77.7937 0] , y=[-78.7424 14.7828 44.846
89.6066 -20.8221 -55.868 3.48509 0] ]




next up previous contents index
Next: gchooser - Constructor Up: widgets - Module Previous: fontchooserwidget - Constructor   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