Announcement

Collapse
No announcement yet.

setting visibility of a widget from another widgets button?

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

    setting visibility of a widget from another widgets button?

    Dont know why this is but i cant seem to get a button in one widget to set the visibility of another widget. but i can bind a key to set its visibility. the widget im trying to set visible has a canvas panel and in the canvas panel a vertical box that is set to hidden. now it works fine if i do it from my characters blueprint but not from the button it self im calling the right variable but it just wont work.

    #2
    That's pretty easy. Let's say you want widget1 to hide widget2.
    In widget1 you'd create a variable of type widget2. Then, when widget2 is created with "Create widget", cast to widget1 and set the variable in widget1 as the return value of the "Create widget" node.
    Then from that variable in widget1 you will be able to use it to set its visibility to whatever you want.

    Comment


      #3
      yeah done that still dont work everything is set up so that i got a bool that will check if the menu is active. i have tried casting i have tried making a variable just for that inventory but i cant get the inventory to open an close. the input key i got set up works the same way you just subscribed. but instead of a widget im calling it from the character blueprint and that one works fine. but when i try the same setup from a widget with another button it dont work. and i get errors saying access none for every time i press the button.

      als o i should add that the widget it self is already created. its the vertical box with in that widget that im trying to set the visibility on. in other words the widget it self is already added to view port.
      Last edited by invayne; 12-14-2014, 01:47 PM.

      Comment


        #4
        Originally posted by invayne View Post
        yeah done that still dont work everything is set up so that i got a bool that will check if the menu is active. i have tried casting i have tried making a variable just for that inventory but i cant get the inventory to open an close. the input key i got set up works the same way you just subscribed. but instead of a widget im calling it from the character blueprint and that one works fine. but when i try the same setup from a widget with another button it dont work. and i get errors saying access none for every time i press the button.

        als o i should add that the widget it self is already created. its the vertical box with in that widget that im trying to set the visibility on. in other words the widget it self is already added to view port.
        You are probably not setting up the variable properly if it says "Accessed None" or you didn't cast the variable properly.

        Comment


          #5
          You could just create a visibility binding (for the object you want to change the visibility of) in your details panel, and promote its input to a variable.
          Then, set that variable when your button is pressed.

          Comment


            #6
            if im using the same variable to allow the i key to open the inventory and it works fine. then doing the same thing from the on click event for the button should pull the same results so the problem is that even if i do everything exactly the same as the input key call it dosent open and close the menu. it does nothing and i get accessed none for the error. i know the variable that i have it bound to works since its also being used for the input key event and calls the menu fine. so the issues lies with why cant the widget im calling from access the inventory widget. now im not trying to set the whole widget visible just the menu inside the other widget the canvas panel that it resides in is set to hit test self invisible. like any other canvas.

            Comment


              #7
              So after deleting the widget i was using and remaking it i can get the button to work problem is now if i use the button it calls a second copy of the inventory the one i call with the i key works fine and shows the items in the inventory but when i call it with the button it calls a completely new inventory so even if its open a new one pops up.... so im a little confused.

              Comment


                #8
                You really should read at least a bit of documentation before trying to blueprint. If you don't learn enough and end up making really messy blueprints for a long time, you will regret it.

                https://docs.unrealengine.com/latest...rol/index.html
                Last edited by Xendran; 12-15-2014, 10:36 AM.

                Comment


                  #9
                  xendran if im already checking to see if something is visible or not and the menu is already up then it should work in the same aspect so i dont see what your getting at with your comment there i use a branch before i use flipflop to open close the menu. if i hit "I" and my inventory comes up it should also work to were if i hit the button it should also close it. but thats not the case instead its creating a duplicate. i dont see how im creating a duplicate when the menu is already there.

                  Comment


                    #10
                    You didn't indicate at all that you had actually tried using branch/flipflops.
                    At this point, you're going to have to show us the nodes because a correctly set up branch or flip flop should work just fine (and i have done it many times in my HUD/Menu system).

                    Comment


                      #11
                      Originally posted by invayne View Post
                      So after deleting the widget i was using and remaking it i can get the button to work problem is now if i use the button it calls a second copy of the inventory the one i call with the i key works fine and shows the items in the inventory but when i call it with the button it calls a completely new inventory so even if its open a new one pops up.... so im a little confused.
                      If you have your other widget within another widget you can also use the "Add Child" option instead of creating a new widget which might cause problems.

                      Comment


                        #12
                        ok heres some pics first pic here is of the inventory widget on click event



                        this second one is on the characters bp for the input event that calls the menu



                        and last this is what they look like when you use both in game there is an animation connected to the menu thats why they are not lined up but thsi allows me to show you they do duplicate.

                        Comment


                          #13
                          What's up with those booleans? You seem to have two both for being in the menu, rather than one for being in menu and one for being in an animation.
                          I also recommend collapsing an inventory, not hiding it.
                          Here's an example of how i set up my item hotkey slots. I dont actually set visibility here, but it gives you an idea of how i control the flow:

                          Click image for larger version

Name:	ba6f10f850.png
Views:	1
Size:	214.8 KB
ID:	1062183

                          Also, i recommend having the functionality of the action inside of UMG, not your character blueprint. You should create an event in the UMG graph and then simply call that event from your character blueprint.
                          When i said bind the visibility, i meant using actual bind nodes like this:




                          Not exactly the same of course since different games have different UI setups, but it should give you some ideas.
                          Last edited by Xendran; 12-15-2014, 07:47 PM.

                          Comment


                            #14
                            ok ill try that tomorrow and see if i can get it to work thanks for the info.

                            Comment


                              #15
                              binding isnt working either i just keep getting duplicate menus so i decided to just take the buttons out and go with keybinds. would have liked to have given that option to players but i cant seem to stop the duplicate windows from appearing no matter how i set it up. worse part is that one of them acts as a inventory while the other is just a blank duplicate. now for the head ache of trying to implement drag and drop with umg. thanks Xendran for the ideas and help!

                              Comment

                              Working...
                              X