Previous IDL Reference Guide: iTools Object Classes Next

IDLitUI::GetWidgetByName

Syntax | Return Value | Arguments | Keywords | Example | Version History

The IDLitUI::GetWidgetByName function method returns the IDL Widget ID of a widget that has been registered with the user interface object via a call to the IDLitUI::RegisterWidget method.

Syntax

Result = Obj->[IDLitUI::]GetWidgetByName(Name)

Return Value

Returns the widget identifier (a long integer) of the widget specified by the Name argument, or 0 if the widget was not registered with the iTool system.

Arguments

Name

Set this argument to the name that the desired widget was registered with.

Keywords

None

Example

This method can be used to determine whether a given widget already exists and act accordingly. For example, the following code checks to determine whether a widget registered as myWidget exists; if it does, that widget is mapped and un-iconified:

wID = oUI->GetWidgetByName(myWidget)  
IF(wID NE 0) THEN BEGIN  
   WIDGET_CONTROL, wID, /MAP, ICONIFY=0 ;; show the widget  
   RETURN  
ENDIF  

Similar code is used in many of the widget interface elements used by the standard iTools included with IDL.

Version History

6.0
Introduced

  IDL Online Help (March 06, 2007)