Proper way to be notified of textwidget enter/leave focus event? | developer.brewmp.com Proper way to be notified of textwidget enter/leave focus event? | developer.brewmp.com

Developer

Proper way to be notified of textwidget enter/leave focus event?

Forums:

I am struggling trying to catch the event of when a textwidget receives/looses the focus. I have tried setting iwidget_setfocuslistener() as well as adding to a listener to the textmodel but neither seems to work. Conceptually, I thought that the focuslistener would then throw one of either {EVT_WDG_SETFOCUS or EVT_MDL_FOCUS_CHANGE} but neither is ever hit.

What is the correct way to register for this event?

Thank you,

IWIDGET_SetFocusListener() is badly named. It sets a listener on the widget's view model. For list widgets, when the user changes which item is selected the view model will receive EVT_MDL_FOCUS_CHANGE.
But that's not what you want. You want to add a handler to the widget with IWIDGET_SetHandler(). This handler will receive EVT_WDG_SETFOCUS when the widget gets or loses focus.
-Erik

IWIDGET_SetFocusListener() is badly named. It sets a listener on the widget's view model. For list widgets, when the user changes which item is selected the view model will receive EVT_MDL_FOCUS_CHANGE.
But that's not what you want. You want to add a handler to the widget with IWIDGET_SetHandler(). This handler will receive EVT_WDG_SETFOCUS when the widget gets or loses focus.
-Erik