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.
Result = Obj->[IDLitUI::]GetWidgetByName(Name)
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.
Set this argument to the name that the desired widget was registered with.
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.