
300 Chapter 13: Creating a User Interface Service
Creating a New UI Service iTool Developer’s Guide
Example
The following example routine is the full definition of the ScaleFactor user
interface service described in the previous sections. It is presented here again for
completeness, so you can see the entire function at once.
FUNCTION IDLituiScaleFactor, oUI, oRequester
; Retrieve widget ID of top-level base.
oUI->GetProperty, GROUP_LEADER = groupLeader
; Retrieve geometry information and calculate offsets.
IF (WIDGET_INFO(groupleader, /VALID)) THEN BEGIN
geom = WIDGET_INFO(groupLeader, /GEOMETRY)
xoffset = geom.scr_xsize + geom.xoffset - 80
yoffset = geom.yoffset + (geom.ysize - 400)/2
ENDIF
; Retrieve the current scale factor from the selected object.
oRequester->GetProperty, SCALE_FACTOR = factor
; Display the IDL widget interface allowing the user to
; change the scale factor. The new scale factor is returned
; as the result of this function. If the specified value is
; not a valid scale factor, the integer 1 is returned in
; result.
result = IDLitwdScaleFactor( GROUP_LEADER = groupLeader, $
FACTOR = factor, XOFFSET = xoffset, YOFFSET = yoffset)
IF result EQ 1 THEN RETURN, 0
; Set properties on the selected object.
oRequester->SetProperty, SCALE_FACTOR = result
; Return success.
RETURN, 1
END
Creating Supporting User Interface Elements
It is beyond the scope of this manual to provide general information on the creation
of user interfaces. For information on creating a user interface using the IDL widget
toolkit, see “Creating Graphical User Interfaces in IDL” (Building IDL Applications).
The following are some suggestions for creating IDL widget interface code for iTool
user interface services.