Announcement

Collapse
No announcement yet.

How to make UMG block left and right clicks

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

    How to make UMG block left and right clicks

    Buttons, text boxes, etc. will prevent the events from firing but nothing else. Widgets have the Visibility setting but this doesn't seem to affect anything besides the widgets that already block the mouse.
    I've tried Google but can't find a solution.

    So how can a make a panel or image block mouse input? Surely this is possible.

    #2
    Does no one have any ideas on this?

    Comment


      #3
      if its visible it should block mouseclicks. hit test invisible would be that it appears on screen but clicks go through
      Wishlist us on steam! -> Countryballs: Modern Ballfare
      Join Discord

      Comment


        #4
        It only seems to work with widgets that are already interactive such as buttons and text boxes.
        A button will prevent left click events from firing, but not right clicks. A text box will consume both left and right clicks.
        But panels, images, etc. don't do anything no matter what I set Visibility to.

        Comment


          #5
          you want them just to block the clicks or you want something to happen after you clicked an image etc. ?
          Wishlist us on steam! -> Countryballs: Modern Ballfare
          Join Discord

          Comment


            #6
            Originally posted by MajekPL View Post
            you want them just to block the clicks or you want something to happen after you clicked an image etc. ?
            I simply want it to block left and right clicks.
            The left and right mouse buttons are used to interact with actors in the level, and obviously certain parts of the HUD should block that interaction otherwise the player won't be able to see what they are clicking on.

            Comment


              #7
              So it seems like this is not possible? The visibility setting seems like it should do this, but it doesn't.
              This is a really basic feature, surely I'm not the first person that needed this.
              Last edited by cmann; 05-26-2016, 07:09 AM.

              Comment


                #8
                I've now found that the visibility setting only affects widgets. So a widget set to "Visible" will block interaction with other widgets behind it, but won't prevent mouse input events from firing in the player controller for example.

                So since UMG can't automatically consume mouse clicks, is there some way to check if the mouse is over a specific widget?
                This way, in the player's mouse down event, before performing the line trace I could first check if any part of the hud widget is blocking the mouse.

                Comment


                  #9
                  Visibility controls hit testing. Once you've been hit tested you need to decide what to do with it. To say - block mouse up/down you need to override OnMouseDown and OnMouseUp and return Handled, similar solution for Keys, same for MouseWheel....etc. Everything you want to block just override the event and return handled that will prevent it bubbling up to the viewport where it will be then sent to the player input system.
                  Last edited by NickDarnell; 05-31-2016, 09:24 AM.

                  Comment


                    #10
                    But where do I override OnMouseDown and OnMouseUp?

                    Comment


                      #11
                      In the UserWidget you want to make that can consume mouse clicks head to the Graph view,

                      My Blueprint (Tab) > Functions > Override > On Mouse Button Down/Up

                      Comment


                        #12
                        If you want to block input to widget, you can try something like: place image to whole screen, set image to transparent (alpha 0) and visibility to "hit test visible" or something like that, and you can then switch between "hit test invisible" and "hit test visible" that image in widget blueprint...

                        Override: In widget blueprint, you have at left side "functions" and something in brackets like ("33 overridables"), hover mouse over this text, click and you will get dropdown menu...

                        Comment


                          #13
                          Originally posted by Nick Darnell View Post
                          In the UserWidget you want to make that can consume mouse clicks head to the Graph view,

                          My Blueprint (Tab) > Functions > Override > On Mouse Button Down/Up
                          Originally posted by Name368 View Post
                          If you want to block input to widget, you can try something like: place image to whole screen, set image to transparent (alpha 0) and visibility to "hit test visible" or something like that, and you can then switch between "hit test invisible" and "hit test visible" that image in widget blueprint...

                          Override: In widget blueprint, you have at left side "functions" and something in brackets like ("33 overridables"), hover mouse over this text, click and you will get dropdown menu...
                          Thanks guys, this is exactly what I was looking for.

                          Comment


                            #14
                            For various reasons (due to already having a quite complicated UI setup), this advice wouldn't work for me. However, for anyone who wants a very simple way of blocking UI input..... Just put on a button which covers the extent you want the input blocked, and make its various styles have an alpha of 0, and voila! Probably a dirty hack, but it did the job for me!

                            Comment

                            Working...
                            X