Hello all,
Is there a nice way for a text editor to LOSE the focus when hitting enter/escape? I would like that little square to go away.
I know I can focus another component, but I want to just LOSE focus, not gain focus elsewhere.
- bram
Hello all,
Is there a nice way for a text editor to LOSE the focus when hitting enter/escape? I would like that little square to go away.
I know I can focus another component, but I want to just LOSE focus, not gain focus elsewhere.
- bram
TextEditor::Listener provides methods to check for this particular situations... And there are the virtual TextEditor::returnPressed and TextEditor::escapePressed methods.
Though maybe somebody else can provide a way to forcibly make a component lose focus, or you can mess with making the caret visible.
I know of the listener methods and I have seen that passing the focus to something else does work to remove the focus. I'm just wondering if there is a way to forcibly REMOVE the focus from a component.
- bram
No - something has to have the focus. Probably the easiest way to give it away would just be to focus on the parent component.
[img]http://s3-eu-west-1.amazonaws.com/stvle/48191da1988b84ec471e4c6f9395ff9e.png[/img]
I've added a static method Component::unfocusAllComponents() now - it's very simple but I haven't tested it, so give it a whirl!
Thanks Jules!
OT: I didn't get a notification email about new posts in this thread. Rather annoying...!