ui icon indicating copy to clipboard operation
ui copied to clipboard

textfield .RequestFocus()

Open andrewarrow opened this issue 5 years ago • 4 comments

Hello, I've been using https://github.com/dontpanic92/wxGo for a while but moving to this system and it's great! The one thing I'm missing is making a textfield have the blinking cursor with a request focus call. I was thinking about using:

https://github.com/go-vgo/robotgo

To simulate a mouse click inside the textfield. Is this a bad idea?

andrewarrow avatar Jul 24 '19 20:07 andrewarrow

oh, I see. If I do:

    mainwin.Destroy()
    mainwin = ui.NewWindow("Testing", 800, 480, true)
    mainwin.SetChild(child)
    mainwin.Show()

My textfield has focus!

andrewarrow avatar Jul 25 '19 20:07 andrewarrow

This is the wrong solution. There should be a SetFocus function at some point (not yet), though I don't know why the field isn't getting focus by default if you are creating it before the window is first shown.

andlabs avatar Jul 25 '19 21:07 andlabs

I make a window, place a button there to say "start". Then the event for that button clears the screen and adds a textfield. But the textfield has no focus when I do it that way. Only when I remove the mainwindow on start button click. (Or have a textfield on that first screen with the start button)

andrewarrow avatar Jul 25 '19 21:07 andrewarrow

Yeah, so I'll need to add a SetFocus function, which isn't even in libui yet.

andlabs avatar Jul 25 '19 22:07 andlabs