Programming Guide


Gets a handle to a widget

#include <smmwuser.h>
HWND sm_mw_widget(int widgetnumber);
HWND sm_mwn_widget(char *widgetname);
HWND sm_mwe_widget(char *widgetname, int element);
#include <smxmuser.h>
Widget sm_xm_widget(int widgetnumber);
Widget sm_xmn_widget(char *widgetname);
Widget sm_xme_widget(char *widgetname, int element);

widgetname, widgetnumber
Specifies the widget whose handle you want to get. (See the Returns section for unavailable widget types.)

If the widget is an array, specifies element whose handle you want to get.


C only



sm_widget gets a handle to the specified widget or widget element—in the case of Windows applications, a HWND handle; under Motif, a Widget ID. You can pass this handle to Windows and Motif functions when you want the window manager to act directly on a Panther widget.

For more information about corresponding Motif and Panther widget types, refer to "Widget Hierarchy" in Configuration Guide.

Note: For scale widgets, list box widgets, and multiline text widgets in Motif applications, sm_xm_widget and its variants return the widget ID of the scroll bar. Use XtParent to obtain the ID of the scale, list box or multiline text widget. For list boxes in Windows applications, sm_mw_widget and its variants return a handle to the list box itself. SDK function calls such as GetScrollPos use the list box's handle and a flag that identifies the desired scroll bar.