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

  • I am curious. Would this be the syntax I would use to listen for 'next' pressed on MA3?

    if signalTable.Group2Click = function(next) then

    do this

    elseif

    signalTable.Group2Click = function(esc) then

    do that

    else

    wait

    end

    been trying to play with

    if gma.canbus.hardkey(110) = 'pressed'

    on MA2 butt haven't really had the time to really dig in to it.

  • I am curious. Would this be the syntax I would use to listen for 'next' pressed on MA3?

    No it doesn't work like that

    signalTable in the scenarioof the OP merely represent the vessel that transports functionality from the plugin to any ui-elements the plugin opens onscreen

    This has no relation to hardkeys (like Next)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!