widget button in unreal engine 5.3

Hi my widget is not showing a drop down menu and my variables are not editable in a widget even though I have created bindings for the variables. I am wondering for Unreal engine 5.3 is there is a better way to reference button functions instead of binding. Is it do with the common ui plugin?

Did you set the “Is Variable” checkbox for your widget? Not sure about why the dropdown isn’t showing though. For your child widget, you’ll have to open it up in its own editor window and turn on the little eyeball icon next to any variables you want to be able to edit from another widget.

Hi thanks for your reply and yes the child widget is variable is definitely checked. Should I use on pressed instead of on clicked instead? I have attached some screen shots.


I’m not following what you’re trying to do. Are you trying to change something in Button_44 from the first graph? If so, where from?

Also, Button_44 is a child widget to InventoryTestSlot_WB. My guess is you have InventoryTestSlot_WB added in another widget and you want to access Button_44 from there. Is this correct? If so, then you need to get the child widget of InventoryTestSlot_WB (specifically Button_44) and click on the little eye icon OR what you should do is just add an event to InventoryTestSlot_WB to do what you want.

Unfortunately, these are all guesses as to what you want to do. I’d need further information on what you want to do and I’m almost certain I can suggest ways of going forward.

We need to know what you are trying to edit. Are you trying to edit it from a blueprint? If so, where from?

Hi thank you for your reply , i really appreciate it and sorry for the late reply as I have just seen your message. So yes Button 44 is child of InventoryTestSlot_WB and I have dragged InventoryTestSlot_WB into InventoryTest_WB under a grid panel. I have attached a screenshot of the designer tab for you to see. i have attached a shot of the on clicked event for button 44 in the InventoryTestSlot. Yes I wondered if I needed to attach another function to the on clicked event as well?
thanks


INVENTORYSLOTCLICKEDScreenshot 2024-04-19

I think what your trying to do is get the reference to the instanced button in the slot. Should be able to get it from the Widget Slot->MyButton-> BindEventToOnClicked

So you use the Slot Variable that is added to the widget when you add it in designer.
If your adding it at runtime you would need to save the save the widget as a variable when creating it then do the same thing.

Are you trying to have something happen when Button_44 is clicked? If so, then you need to bind to the event dispatcher you created. You can bind directly to the OnClicked event like the other commenter indicated, but I’m assuming you’re keeping track of what inventory slot is active and you’d like to pass that along. Your event dispatcher looks fine for this.

What you need to do is Bind an event to the ButtonWasClicked dispatcher of InventoryTestSlot_WB. Have you done this?

Edit: Oh… I just noticed you have many InventoryTestSlot_WB’s. You’ll need to bind to each one’s ButtonWasClicked dispatcher. That can be a pain.

If you have a fixed amount, I’d put them in an array and iterate over them to bind the event.

If you are creating them dynamically, then you’ll need to track them manually and ensure you bind to each one’s ButtonWasClicked event dispatcher.

BTW, UE Widget slots are different than what you’re doing. I think you just named them “slots”. But in widgets, there’s something in the editor called a slot and it’s quite different.

Hi thanks to you both , yes I’m basically trying to pass button reference from the slot widget to the inventory widget. I will look into attaching the on clicked event to the button and see if that works. And just to clarify I was following the Wes ball umg inventory tutorial and I think from memory he was using engine 4.26 and I’m using ue 5.3 so some of the nodes and connections may be different. Also at the moment the inventory binding is working so it’s popping up on screen, I can grab the pick-up item and destroy it. The only thing that is obviously not happening is the pick-up item is not passing through to inventory slot. In the pickup I have added the struct reference.

Hi again,

I just realised what I should have also said was in the InventoryTest widget I have three buttons called Action, Drop item and cancel and these three buttons dont have bindings to the on clicked event before firing the inventory fuctions such drop , use etc.

If you want the button in the widget “InventoryTestSlot_WB” to call the delegate made in the Inventory widget you need to give the slot a reference to the instance of the “InventoryTest_WB” and then use that on the button clicked event to call the delegate.


Added the Int param that is passed so it is clearer -



Thanks a lot I will have a look those shots you sent earlier. I just tried binding to the three buttons in InventoryTest but I am not sure if i did it right. thoughts?

If there’s only one of each button, just click on the + sign next to the OnClick event and add your graph directly. No need to manually bind to the event.

Okay thanks for your reply will try that.