About   |   Getting Started   |   Downloads   |   Documentation   |   Forum


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
widget lose-focus for text and combo boxes
09-14-2016, 10:14 AM
Post: #1
widget lose-focus for text and combo boxes
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.
Find all posts by this user
Quote this message in a reply
09-14-2016, 10:49 AM
Post: #2
RE: widget lose-focus for text and combo boxes
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.
Find all posts by this user
Quote this message in a reply
09-17-2016, 08:27 PM
Post: #3
RE: widget lose-focus for text and combo boxes
Thank you, Garrett!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)