LUA custom buttons metadata

BECOME PART OF THE COMMUNITY - Sign up here
  • Hi Guys,


    This thread helped me a lot LUA: UI

    currently I'm created some screens using that code, but there is one thing I'm currently looking for.


    on creating custom buttons like this:

    Code
    tblOptions[x] = optionsGrid:Append("Button")
    tblOptions[x].Text = "Text displayed on the button"


    actions are linked to that button using:

    Code
    tblOptions[x].PluginComponent = myHandle
    tblOptions[x].Clicked = "SelectionAttributeClick";

    finally, I catch that click action using:

    Code
    signalTable.SelectionAttributeClick = function(caller)
        local button_text = caller.Text;
    end


    In this example, caller.Text will return the value of that button, which is "Text displayed on the button"


    mostly, it worked well for me, but I'm wondering if we can check which properties are also available to set for (in this example) a custom button? With properties, I mean like those in my example code: Text, PluginComponent, Clicked , ..


    The goal I want to reach is to check if I can store extra information within that button object, which can be collected when I press that button.. like for example some ID's, or other info.


    this code is not working, but I try to do something like:

    Code
    tblOptions[x].Metadata = 'Group1'

    so when I click that button, I can retreive that Metadata information like

    Code
    signalTable.SelectionAttributeClick = function(caller)
        local group_name = caller.Metadata;
    end
  • I would use different functions for each group of buttons:


    tblOptions[x].Clicked = "Group1Click"

    --

    AnotherTblOptions[x].Clicked = "Group2Click"

    --

    signalTable.Group1Click = function(caller)
    Echo("ButtonGrp 1 Button " .. caller:Index())
    end

    --

    signalTable.Group2Click = function(caller)
    Echo("ButtonGrp 2 Button " .. caller:Index())

    end