MGH_GUI_SETLIST__DEFINE Class
MGH_GUI_SetList Purpose
This class implements a GUI application for selecting an integer value
from an enumerated list.
Calling Sequence
MGH_GUI_SetList supports two modes of operation. In the first,
a client object is specified and the dialogue exchanges information
with the client by calling the client's methods. An example of the
calling sequence is (within a method of the client object):
mgh_new, 'MGH_GUI_SetList', CLIENT=self, CAPTION='Style',
/FLOATING, GROUP_LEADER=self.base, $
ITEM_STRING=['Points','Mesh','Filled','Ruled XZ','Ruled YZ'], $
PROPERTY_NAME='STYLE'
The dialogue gets the value of the client's STYLE property during
initialisation and then sets the value of the same property when
the user presses the Apply or OK buttons (or, in IMMEDIATE mode, whenever
the droplist value is changed). This mode of operation
can be used with or without blocking in the dialogue.
In the second mode, there is no client & information is extracted
from the object after the widget is destroyed--this only works if the object
is blocking or modal. Thus
odlg = obj_new('MGH_GUI_SetList', /BLOCK, CAPTION='Style' $
, ITEM_STRING=['Points','Mesh','Filled','Ruled XZ','Ruled YZ'])
odlg->GetProperty, STATUS=status, VALUE=value
obj_destroy, odlg
if status then print, 'Style is ',value else print, 'Cancelled'
There is no need to specify PROPERTY_NAME in this call because there is
no interaction with any client objects.
Properties
The following properties are supported:
CAPTION (Init)
The caption that appears to the left of the text entry fields.
The default is the property name in lower case.
CLIENT (Init, Get, Set)
A reference to the object with which this object will exchange
information. The client must support GetProperty and SetProperty
methods which accept 'PROPERTY_NAME' as a keyword. It must
also support Update and Show methods. (Subclasses of
MGH_GUI_Base inherit Update and Show.)
IMMEDIATE (Init, Get)
Set this property to 1 to cause the client to be updated every time the
droplist value is changed. The default (IMMEDIATE=0) is for the client
to be updated only when the OK or APPLY button is pressed.
ITEM_NUMBER (Init, Get)
An array of numbers, dimensioned (N_ITEMS), specifying the
acceptable values for the property. Default is indgen(N_ITEMS)
ITEM_STRING (Init, Get)
An array of strings, dimensioned (N_ITEMS), specifying the
text to appear in the droplist. Default is strarr(N_ITEMS)
N_ITEMS (Init, Get)
The number of droplist items, each representing an acceptable
integer value. N_ITEMS need not be specified explicitly
if it can be deduced from ITEM_STRING or ITEM_NUMBER.
PROPERTY_NAME (Init, Get)
The name of the client property to be managed by this dialogue.
STATUS (Get)
Equal to 1 if the OK button has been pressed, otherwise 0. This
property is of interest only in blocking or modal operation.
VALUE (Get, Set)
This is the dialogue's copy of the property value.
Several other properties are inherited unaltered from the superclass, MGH_GUI_Base.
The following property is inherited with additional functionality:
MANAGED (Init, Get)
This keyword can still be retrieved via GetProperty, but in
addition it is accepted by the Init method, where it specifies
whether Init should call the Manage method. The default (1 =
manage the object immediately) allows a simpler creation
sequence and will normally be satisfactory *except* when the
widget application is (or could be) blocking and there is some
reason to interact with it programmatically--in a way that
requires its widgets to be intact--after initialisation.
(Recall that the Manage method of a blocking widget object
does not return until the widget hierarchy has been
destroyed.) For example a subclass of MGH_GUI_SetList might
call MGH_GUI_SetList::Init with MANAGED=0 then call the Manage
method at the end of its own initialisation prcoess.
###########################################################################
This software is provided subject to the following conditions:
1. NIWA makes no representations or warranties regarding the
accuracy of the software, the use to which the software may
be put or the results to be obtained from the use of the
software. Accordingly NIWA accepts no liability for any loss
or damage (whether direct of indirect) incurred by any person
through the use of or reliance on the software.
2. NIWA is to be acknowledged as the original author of the
software where the software is used or presented in any form.
###########################################################################
Modification History
Mark Hadfield, 2000-01:
Written.
Mark Hadfield, 2001-01:
Added the IMMEDIATE keyword.
Mark Hadfield, 2004-06:
- Now uses IDL 6.0 logical handling.
- Code for constructing GUI updated to use the facilities of MGH_GUI_Base
and MGH_GUI_PDmenu as much as possible.