Announcement

Collapse
No announcement yet.

Returning keyboard focus after closing UI

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Returning keyboard focus after closing UI

    Hai

    I'm trying to do one simple thing; give the game viewport keyboard focus after I hide a panel containing an EditableTextBox. This isn't happening. I've tried the ClearKeyboardFocus and SetFocusToGameViewport nodes with no luck, and also tried putting in a small delay.

    Click image for larger version

Name:	ui.png
Views:	1
Size:	107.2 KB
ID:	1216379

    On a key press, if it's not already open, the panel containing the EditableTextBox is set to visible and given focus so you can start typing immediately. This works fine.
    On text commit, using a 'Switch on ETextCommit' node, I have it set the text box to hidden (after handling the text entered). Then I'd like to be able to press the key again to re-open said EditableTextBox and type in it again, without having to click the mouse button. At the moment, I have to click in the viewport after closing the text box before I can open it again.

    Does anyone know a fix for this? Many thanks in advance

    #2
    There is a node SetKeyboardFocus, if you target the editable box, it should work. In case this does not work or it not something you're after, could you clarify where the keystrokes are originating from? Controller or the widget itself?
    Last edited by Everynone; 04-11-2017, 10:51 AM.

    Comment


      #3
      this i show i do it in my project in my player controller i create a on enter pressed event .

      Click image for larger version

Name:	730de5e11300420995b9c4368f61e425.png
Views:	1
Size:	78.2 KB
ID:	1126309

      when the enter key is pressed it calls a custom event inside the widget i am trying to focus.
      then like everynone suggested here you just use the set keyboard focus

      Click image for larger version

Name:	cb6c4857853b48e392ededeccfca8188.png
Views:	1
Size:	150.7 KB
ID:	1126310

      the branch is for checking if the widget already has focus in which case we dont do anything but if it doesnt have focus it sets the focus to the widget. in my case i am also at the same time setting the visibility of another widget this is because in my game i have another function that hides the chat system when not in use .

      Comment


        #4
        Try EniGmaa's solution first. I don't really know, if this will help, but there are 3 nodes, which could be of help. They should be self explanatory by their names.

        Click image for larger version

Name:	9b99c3c990f0446790b0f9187fd3c26e.png
Views:	1
Size:	98.9 KB
ID:	1126315

        It doesn't exactly focus your keyboard, but it forces the widget to get into certain modes and changes the focus behaviour of the widget.
        Main channel:
        https://www.youtube.com/channel/UCGC...o9s3YcA/videos

        Comment

        Working...
        X