Announcement

Collapse
No announcement yet.

Widgets: how manage a lot of buttons?

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

    Widgets: how manage a lot of buttons?

    Hi all,

    I will have an "inventory" widget with a lot of buttons, 50 buttons+,
    instead of manuallly place 50 event "On Clicked (BTN_01).."
    can i have 1 event general evnet (on click button), and then ask , if is BTN_01 , do this, if BTN_02 do this...?

    I am little lost,
    maybe i can use Event dispatchers? how?
    maybe i can place custom widget inside the inventory and , let the child-widget talk to the parent? how?
    other options?

    thank you

    #2
    can i have 1 event general evnet (on click button), and then ask , if is BTN_01 , do this, if BTN_02 do this...?
    You can do much better than this. Wrap each button in a widget - this gives you a fully configurable widget. Create a dispatcher that broadcasts data from the button. So you can do this, for example:

    Button with an enumerator and a dispatcher:

    Click image for larger version  Name:	widgetbutton.jpg Views:	0 Size:	103.5 KB ID:	1796366‚Äč
    Flagging any variable as Instance Editable, allows you to modify it on the parent:

    Click image for larger version  Name:	parentbuttons.jpg Views:	0 Size:	38.7 KB ID:	1796367

    And then the parent can do this:

    Click image for larger version  Name:	parent.jpg Views:	0 Size:	167.6 KB ID:	1796368

    Whenever a button is clicked, the event at the bottom gets executed. This can be leveraged in many ways. No need for more wires.
    Last edited by Everynone; 08-03-2020, 11:45 AM.

    Comment


      #3
      And you can do this from outside of the parent widget; you can actually use a dispatcher to evoke events in another actor, here in the LB but it can be anything, of course:

      Click image for larger version

Name:	sendtoActor.jpg
Views:	34
Size:	141.1 KB
ID:	1796374

      Above, any click from a button will trigger an event in this particular actor, pushing in enumeration data defined in the second screenshot. Binding / unbinding can be done dynamically so you can hook events like this on the fly and without worrying about those actors getting destroyed.

      Comment


        #4
        1000 Thanks man Everynone
        I really appreciate it,
        So much stuff to learn, i will try all this,
        Thanks again

        Comment

        Working...
        X