Creating a set of buttons with oncick events on them - unreal-engine4

I have an array of objects in my game, and I want to create buttons in the UI, based on object count in array. In menu construction script, array is scanned for objects, and for each of them button is created, and labeled by object name.
Now I want to do onclick event for these buttons which will display info about respective object in the UI. So I need to somehow create a onclick event for each of appearing buttons, or create universal onclick event for this group of buttons, which will read object name from button and search for that in the array. Is it possible to create events for objects which are going to appear during game? Please suggest.

Workaround - by onclick event get buttons array and find which is hovered by mouse ATM

you could make a widget object containig the button with the onclick event, then in the contruction script you create the widgets.
Here you can find some documentation for widgets:
https://docs.unrealengine.com/en-US/Engine/UMG/UserGuide/WidgetBlueprints/index.html
https://docs.unrealengine.com/en-US/Engine/UMG/UserGuide/CreatingWidgets/index.html

Related

jQuery Parent checkboxes with child radio buttons

Hello I am trying to figure out if we can have a checkboxlist with child radio buttons?
Something like this
Is it possible in jstree? Does anyone have an example? When the checkbox is checked then we should show the children radiolist and if it is unchecked it should be hidden.
And also the data can be an AJAX call to get the data from the db.

How to get DOM node in Ext.view.View by Record?

I am using ExtJS 4.2.3 to create a small JavaScript application. In that application i have a Ext.view.View with a custom template to show the data.
On select/deselect i would like to animate a part of the item. At the moment i am using the select/deselect events of the Ext.view.View to trigger the animation. The problem is that this events only get a reference to the record that was selected/deselected. How can i get the matching DOM node within the Ext.view.View in order to trigger the animation?
Use Ext.view.View.getNode method to get the selected HTML Element, from selected Record object
Ext.view.View

C++ Builder 6 Different Popup menu on Items and Subitems of a TreeView and No Popup on empty area

I want to have different popup menu on Items and SubItems and NO Popup menu on empty area of a TTreeView is that possible ?
I want something like the pictures bellow
There are two ways you can do that.
Create 2 separate TPopupMenu objects with the desired menu items, do not assign either one of them to the TreeView's PopupMenu property, and then use the TreeView's OnContextMenu event to call the Popup() method of whichever TPopupMenu you need based on which node the user is clicking on.
Create 1 TPopupMenu object and put both menu items in it, and assign it to the TreeView's PopupMenu property, then use the TPopupMenu.OnPopup event to show/hide the menu items based on which node the user is clicking on.
In either case, you can use the TTreeView.GetNodeAt() method to determine which node is located at the coordinates of a mouse click, if any.

Choose correct UIButton on dynamiclly created buttons without tags

I am loading up a plist file and creating buttons based on this file. These buttons can change at any point during the application running (which will trigger an update of all the buttons etc).
One set of buttons represents a list of categories. So I may have a house button, car button, etc. No matter what button is pressed it will call my categoryButtonPressed:(id) sender function. I need to know what button called it and load a second set of data based on the button (category) that was pressed.
So if I press the house button, the function needs to load the house data, but how can I determine what button was pressed in that function. If I use tags I have to know that the house button is tag 1, car is tag 2 and so forth. BUT I don't know if there will even be a house button until I read that file. Do I need to code the tag into the plist file as well?
OR is there a way to loop through my Array of UIButtons and determine this? Any advice?
And last, if I create my own extended version of UIButton that added a "name" variable, would I would still be out of luck because the action would pass the UIButton base and comparing my extended class to the base would always fail correct?
Thanks for any and all help!
And last, if I create my own extended
version of UIButton that added a
"name" variable, would I would still
be out of luck because the action
would pass the UIButton base and
comparing my extended class to the
base would always fail correct?
The action is passed by whatever control, of whatever class, the action was registered with. Creating your own custom button with additional properties seems like the way to go.
You could also set the tag of the button as the index in your button array, or the index in the plist that the button corresponds to.

Listener function for gwt widgets

For my project when a button is clicked, the click event should then wait and listen to the next two clicks on different widgets and then connect them so as to form relationship between them.
Right now i an trying to use FocusListener without success. Any suggestion will be of great help.
Thank you.
I would think you'd just want an ClickListener for each object. Handle "enabling" the other two objects in the first object's click event, then when those two objects are clicked on, invoke the method to form the relationship. You don't want to wait in the first object's event handler.