Object or Touch X,Y Coordinates

BECOME PART OF THE COMMUNITY - Sign up here
  • 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

  • MTRobin
    March 30, 2023 at 6:02 PM
  • to my knowledge:

    only the mouse object has a get-able coordinates (cursor), not the touch object

    in Lua/UI context the touched object is the Layout Viewer Canvas, not the actual macro.

    still I don't think it is impossible to get the screen coordinates of the layout element, just a lot of work and calculation based on the properties of the canvas, and the properties of the layout elements.

  • 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

  • This works great in OnPC. Thank you for your help. I will have to try it on the console touch screen. Do you think the TouchObj function would work on the console instead of MouseObj?

  • I found that this doesn't work on a console. The cursor moves to where I touched, but it does not recalculate the coordinates. Only when I plug in a mouse will the coordinates update.

  • to my knowledge:

    only the mouse object has a get-able coordinates (cursor), not the touch object

    in Lua/UI context the touched object is the Layout Viewer Canvas, not the actual macro.

    still I don't think it is impossible to get the screen coordinates of the layout element, just a lot of work and calculation based on the properties of the canvas, and the properties of the layout elements.

    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

Participate now!

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