Search code examples
focusrokubrightscript

How to Set Automatic active = true in TextEditBox using brightscript?


Is there any way to I add texteditbox and SetFocus(true) and his automatic set active = true in a bright script?

using SetFocus I set the focus on textbox Its display that's border and color. But SetFocus(true) not display a cursor. I set active = true its work but IS there any way to I SetFocus(true) only and the cursor is displayed in TextEditBox.


Solution

  • sub init()
     m.TextEditBox = m.top.FindNode("myEditBox")
     m.TextEditBox.observeFieldScoped("focusedChild", "onBoxFocused")
    end sub
    
    sub onBoxFocused(msg as Object)
     box = msg.getROSGNode()
     box.active = box.hasFocus()
    end sub
    

    also, you can add there some other things, like background and etc, and it will be triggered by that event