This project is read-only.

Set focus to a particular text widget?

Sep 28, 2014 at 2:01 AM
I've been playing around with Ruminate recently, and noticed that there doesn't appear to be a way to programmatically set focus to particular text box?

In my test app, I have a SingleLineTextBox and a few other controls. If I click the text box, I can start entering text - no problem. But, I don't seem to be able to set focus to the box via code so that the user doesn't have to click first.

I attempted to add a setfocus method to the gui class, which calls another method I added to InputManager which sets PressedWidget and FocusedWidget to my text box. However, it doesn't appear to be having the desired effect.

Am I just missing some obvious way to set the focus? IsFocused only supports get.
Sep 28, 2014 at 2:45 AM
I figured out the reason my new SetFocus method wasn't working. Focus actually needed to be set to the _innerTextBox widget used by the SingleLineTextBox. So, I have a hacky workaround in place, until I properly override the mouse/keyboard events to pass down to that widget from the parent SingleLineTextBox.