Widget Proc Behaviors

These widget behavior functions add other useful behaviors to widgets. These functions cannot be attached to a widget; they must be called from your widget function.


XPUSelectIfNeeded

function

This causes the widget to bring its window to the foreground if it is not already. inEatClick specifies whether clicks in the background should be consumed by bringing the window to the foreground.

XPLM_API int        XPUSelectIfNeeded(
                         XPWidgetMessage      inMessage,
                         XPWidgetID           inWidget,
                         intptr_t             inParam1,
                         intptr_t             inParam2,
                         int                  inEatClick
                    );

XPUDefocusKeyboard

function

This causes the widget to send keyboard focus back to X-Plane. This stops editing of any text fields, etc.

XPLM_API int        XPUDefocusKeyboard(
                         XPWidgetMessage      inMessage,
                         XPWidgetID           inWidget,
                         intptr_t             inParam1,
                         intptr_t             inParam2,
                         int                  inEatClick
                    );

XPUDragWidget

function

XPUDragWidget drags the widget in response to mouse clicks. Pass in not only the event, but the global coordinates of the drag region, which might be a sub-region of your widget (for example, a title bar).

XPLM_API int        XPUDragWidget(
                         XPWidgetMessage      inMessage,
                         XPWidgetID           inWidget,
                         intptr_t             inParam1,
                         intptr_t             inParam2,
                         int                  inLeft,
                         int                  inTop,
                         int                  inRight,
                         int                  inBottom
                    );