LUA: UI

  • Does anyone have a working example of the PopupInput?


    I am also wondering if anyone has an example on how to lay out a UI with rows and columns? For example, multiple rows that each contain text and a checkbox (or other defined elements). I see that this is doable (based on the MA3 Tools plugins) but haven't been able to get to the bottom of it.

  • I was interested in what the MATools guys had done too and noticed that it looks like compiled code and based on some the the text in the file base64 payload it seems they are very close to MA.


    In other words, we may never find out :)

  • I made this cheat for myself for popupinput for myself a while ago:


    Code
    1. -- Popup Box to select from a list of items
    2. local modes = {"Off", "Auto", "Slow", "10% Steps", "Large Jumps", "Small Jumps", "Tiny Jumps", "Random"}; -- The Items
    3. local ret = PopupInput("Select fader test mode", display_handle, modes); -- The popup box sets the variable 'ret'
    4. --or
    5. local r = PopupInput(title, display_handle, modes,"Random",900,500) -- Defaults to Random and places box at X:900,Y:500


    Does anyone have a working example of the PopupInput?


    I am also wondering if anyone has an example on how to lay out a UI with rows and columns? For example, multiple rows that each contain text and a checkbox (or other defined elements). I see that this is doable (based on the MA3 Tools plugins) but haven't been able to get to the bottom of it.

  • I made this cheat for myself for popupinput for myself a while ago:


    Code
    1. -- Popup Box to select from a list of items
    2. local modes = {"Off", "Auto", "Slow", "10% Steps", "Large Jumps", "Small Jumps", "Tiny Jumps", "Random"}; -- The Items
    3. local ret = PopupInput("Select fader test mode", display_handle, modes); -- The popup box sets the variable 'ret'
    4. --or
    5. local r = PopupInput(title, display_handle, modes,"Random",900,500) -- Defaults to Random and places box at X:900,Y:500

    What version did you have this working in? I get errors about the first parameter when trying to run in 1.5 - seems odd since it is just a string.

  • They changed PopupInput() recently. Try this:


    Code
    1. function DisplayPopup(displayHandle)
    2. local modes = {"Off", "Auto", "Slow", "10% Steps", "Large Jumps", "Small Jumps", "Tiny Jumps", "Random"}
    3. local selectedIndex, selectedMode
    4. selectedIndex, selectedMode = PopupInput({title = "Mode", caller = displayHandle, items = modes})
    5. Echo("Selected index: " .. selectedIndex .. ", mode: " .. selectedMode)
    6. end
    7. return DisplayPopup
  • Getting the overlay via the display index and assuming Pult 1, will fail if the Plugin is called from the web-remote.


    instead of

    Code
    1. -- Get the overlay.
    2. local display = Root().GraphicsRoot.PultCollect:Ptr(1).DisplayCollect:Ptr(displayIndex)
    3. local screenOverlay = display.ScreenOverlay

    you could rather use

    Code
    1. -- Get the overlay.
    2. local display = GetFocusDisplay()
    3. local screenOverlay = display.ScreenOverlay

    or (to keep your logic that forces dialog on Display 1, when plugin is called on Display 6&7):

    Code
    1. -- Get the overlay.
    2. local display = GetDisplayByIndex(displayIndex)
    3. local screenOverlay = display.ScreenOverlay
  • This example shows how you can display faders on a dialog. It also shows how a resize corner can be included to allow the user to change the size of the dialog. I've attached the LUA script for this.




    There appears to be a lot of UI controls available for creating dialogs.


    For example, take a look inside any of the "*.uixml" files that can be found below "C:\ProgramData\MALightingTechnology\gma3_1.5.2\shared\resource" on a Windows onPC installation. These files appear to contain an XML definition of the dialogs used by the MA system. This is a useful source of information regarding the names of the available UI controls and their properties.


    Also, if you look at some of the .lua files below that path you will find examples of the signalTable being used to respond to UI events.


    Hopefully that will be of help to others.