user manual
Chapter 13: Creating a User Interface Service 309
iTool Developer’s Guide Example: Changing a Property Value
Discussion
When the user clicks the OK button, the current value of the editable text widget is
placed in the pointer stored in the state structure’s
pName field.
Creating an Operation that Calls the Service
In order to launch the SrvExample user interface service, the user must be able to
select an operation that calls the DoUIService method. This example uses an
IDLitDataOperation named opName, which simply retrieves the list of currently
selected items and calls the SrvExample user interface service. The code for this
operation is stored in a file named
opname__define.pro that is located in a
directory that is included in the IDL !PATH system variable.
FUNCTION opName::Init, _REF_EXTRA = _extra
; Initialize the operation, setting the "show UI" property.
; Note that this operation will operate on all iTool
; component types.
success = self->IDLitDataOperation::Init( $
NAME="Rename Component", $
DESCRIPTION="Rename an iTool component", $
/SHOW_EXECUTION_UI, TYPES='', _EXTRA=_extra)
RETURN, success
END
FUNCTION opName::DoExecuteUI
; Get a reference to the current iTool and
; make sure it is valid.
oTool = self->GetTool()
IF (oTool eq OBJ_NEW()) THEN RETURN, 0
; Get the list of selected items.
selItem = oTool->GetSelectedItems()
; Call the UI service on the first item in the list
; of selected items.
RETURN, oTool->DoUIService('Example Service', selItem[0])
END