Posts by MTRobin

BECOME PART OF THE COMMUNITY - Sign up here

    Hi Everyone,


    Am I able to get the root index of a layout object by giving the ID of the macro assigned to that object?


    Something like this


    ShowData().DataPools.Default.Layouts[1].ID[2515]


    Where I give the ID number and it returns the index of that layout element.


    Thanks,

    Maxwell

    I think I can get the coordinates the hard way, by getting the object location within the layout, then do some math to get the coordinates on the screen within the layout. I am having trouble getting the current object information. Do you have any insight on which function would help me get the index of the object I touch in a layout view. Then I can get its coordinates within the layout, and go from there.


    Thanks,

    Maxwell

    Hi Everyone,


    Is there a way to tell if the user short pressed or long pressed an executor via Lua?


    I am trying to create a button that acts as a toggle button when short pressed, but a temp when long pressed.


    Thanks,

    Maxwell

    You can also control the color of the bars above the checkboxes, as shown below. I've attached the updated example code.


    Looking at this code, do you know how we can input a custom color instead of using the system colors in the Root folder?


    Looking for something like this:

    Code
    local colorBackground = '3484F0FF'
    --OR--
    local colorBackground = '(52,132,240,1.00)'

    Thanks,

    Maxwell

    I think getting the cursor coordinates would work for me in this case, and would be the simplest. Could you please give an example of how I would get those? I can't find any documentation on how to use Mouse, MouseObj, or TouchObj.


    Thanks,
    Maxwell

    Hi,

    I am on MA3 and trying to get the X,Y coordinates of either the users touchscreen press or the coordinates of the object they touched. Is this possible in LUA?


    Example:

    When the user presses a macro in a layout window I run a LUA function that opens a Popup Input Dialog. I am trying to get this popup to open where the layout object's X, Y coordinates are on screen.


    Thanks,

    Maxwell

    You are absolutely correct. Thank you for your input.


    Best,

    Maxwell

    Hi,


    I am wondering if anyone has been able to get the coordinates of the user input on the touchscreens, or even just able to get the position of the object that was selected? I have created a custom dialog in Lua that is triggered from a macro in MA. When the user taps on the macro in a layout, the popup appears at 0,0. I am able to input coordinates to place the dialog anywhere on the screen, but I would prefer to make it dynamic so the coordinates come from wherever the user tapped. Again, for my purposes this can come from the user tap coordinates or the coordinates of the tapped object on the layout. This would function just like a swipey, but without the 'Swiping' part.


    Thank you,
    Maxwell

    the easiest solution would be to yield while the dialog exists:


    Code
    return function()
      local dialog = GetFocusDisplay().ScreenOverlay:Append('BaseInput')
      dialog.H, dialog.W = 300, 300
      dialog:Append('UIObject').Text = 'Hello World'
      while IsObjectValid(dialog) do coroutine.yield(0.1) end
      Echo('Goodbye world')
    end

    Hi Andreas,


    Thank you for your response. I ended up getting this working using the following code. Would you recommend your solution over the repeat loop I am using at the end? I'm just trying to learn how to make my code as efficient as possible.



    Thanks,
    Maxwell

    Hi,


    I have successfully created a custom dialogue with 9 buttons in a 3 x 3 configuration. I am trying to call my popup dialogue and send the button pressed to a variable in another function. The problem I am having is that the function continues to run in the background while the popup dialogue is active. Therefore my selection in the popup doesn't get injected into the function in the right place. Below is a simplified example of my scenario.


    The "popup" function returns the number of the button that was clicked.


    My issue is that the "getMode" function runs, then the "popup" function runs, and the "getMode" function finishes, then when I click the popup button, it doesn't get assigned to the "mode" variable and the function echoes a nil value.


    Is there a way to have the popup hault the running function until a selection or cancel happens?


    Thanks,

    Maxwell


    Code
    function getMode()
        local mode = popup()
        Echo(mode)
    end