MGH_WIDGET_SELF Name
MGH_WIDGET_SELF Purpose
Support the retrieval of object refernces from, and the storing of object
references in, structures of type MGH_WIDGET_SELF. These are associated with
the UVALUE of a widget element, to provide a bridge between the widget tree
and an associated widget object.
Category
Widgets.
Calling Sequence
There are three modes of operation, controlled by the type of the positional
argument and keywords:
1: Store an object reference in an MGH_WIDGET_SELF structure
struct = MGH_WIDGET_SELF(STORE_OBJECT=objref)
2: Retrieve an object reference from an MGH_WIDGET_SELF structure
objref = MGH_WIDGET_SELF(struct, FOUND=found)
3: Search for an MGH_WIDGET_SELF structure in the children of widgetID, then
retrieve and return the object reference.
objref = MGH_WIDGET_SELF(widgetID, FOUND=found)
Positional Parameters
arg
A scalar of type structure (calling sequence 2) or integer
(calling sequence 3). Ignored for calling sequence 3.
Keyword Parameters
FOUND
For calling sequences 2 & 3 this keyword returns 1 if an object
reference has been found otherwise 0. Note that the object
reference may not be valid, even if FOUND is 1.
STORE_OBJECT
Set this keyword to an object reference to select calling sequence 3.
Outputs
Depends on calling sequence.
THE CONVENTIONS FOR STORING MGH_WIDGET_SELF STRUCTURES
The classes that currently store MGH_WIDGET_SELF structures are MGH_GUI_Base
and MGH_GUI_PDmenu. They store the structure in the UVALUE of the first or
second child of the object's base widget (BASE property). The widget tree
is set up--with some difficulty, I might add--so that this widget never
generates events. (If it did, then the UVALUE might be needed for storing
callback structures.) It can't always be the first child because on top-level
bases this would be the menu-bar base and we definitely do want to use callbacks
for that.
As a slight generalisation, the MGH_WIDGET_SELF function (calling
sequence 3) looks for the structure in *all* the children of the widget.
Comment
Yes, I agree that it is ugly to bundle three fundamentallly
different modes of operation in one function. I do it this way
because I want to keep things localised and IDL has no suitable
larger units of organisation than functions.
###########################################################################
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, Jun 2001:
Written.