Announcement

Collapse
No announcement yet.

Question Regarding UMG

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

    Question Regarding UMG

    Hello!



    so I created a multiplayer chat system and all working well.

    now I wanted to implement "Enter" to send the text instead of putting a new line or pressing a button to send the text.

    could somebody help me figure this out, as most games , actually all games have this feature.


    thank you.

    #2
    One way of doing it is to override the "OnKeyDown" function in your widget.

    Click image for larger version

Name:	Unbenannt.png
Views:	3
Size:	59.4 KB
ID:	1581488

    In there you can check which button was pressed and then execute your logic. You hav eto make sure, that this widget is being focused though.

    Comment


      #3
      Another way would be to setup an input event in your player blueprint, which checks if the player is currently in the chatbox and if that is the case execute the send function in your widget

      Comment


        #4
        i'll test that, even tho I think I tried this but without focus perhaps

        Comment


          #5
          Let me know if it worked

          Comment


            #6
            it didn't even tho I checked focused on the WB and the HUD itself, works only when focus is cleared from the WB, for instance I type something and press enter it does nothing, but when I click on the screen (else where then the WB itself) it sends the text.

            Comment


              #7

              Comment


                #8
                I couldn't find a node other then Is Mouse Button Down.

                enlighten me please ;P

                Comment


                  #9
                  ok I solved it, but in a very deferent method but it works the way It should.

                  Comment


                    #10
                    You have to get the key from the "InKeyEvent" input

                    Click image for larger version

Name:	Unbenannt.PNG
Views:	3
Size:	34.8 KB
ID:	1581560

                    Comment


                      #11
                      I need a way to clear the focus from the WB, because when I enter and it sends the text , the text box still has the focus and I could keep typing

                      Comment


                        #12
                        so that way I want this to function is, when the widget doesn't have focus and I press enter, it will focus the text box, and if I press enter again it sends the text and clear the focus from the text box.

                        Comment


                          #13
                          I cant find a note that "CLEARS" the focus from a widget, but I could make it focus on another widget instead

                          Comment

                          Working...
                          X