Hot Door CORE Forum
widget lose-focus for text and combo boxes - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: Feature requests (http://hotdoorcore.com/forum/forumdisplay.php?fid=7)
+--- Thread: widget lose-focus for text and combo boxes (/showthread.php?tid=101)



widget lose-focus for text and combo boxes - Rick Johnson - 09-14-2016

CORE text boxes and combo boxes leave the field open for editing after running its callback, which interferes with using keyboard commands for other AI functions. In Adobe's panels, e.g., the stroke weight combo box, the text loses focus when the user presses the Enter key, and also when a menu selection is made. I tried setting the widget's Contents-Changed callback so that a benign element such as a divider took the focus. This works when selecting an item from the popup menu (giving it a behavior like Adobe's). A lose-focus method for widgets would sure be nice. Is there a straightforward workaround for when a user presses Return or Enter? I noticed CADtools loses focus on Enter.


RE: widget lose-focus for text and combo boxes - garrett - 09-14-2016

In your value-changing/ed callback, call the lastCharTyped() method on the field and check the return value for "\n" or "\r". This will allow you to detect the enter/return key being pressed.

When you want a widget to lose focus, call the blur() method on the widget.


RE: widget lose-focus for text and combo boxes - Rick Johnson - 09-17-2016

Thank you, Garrett!