How to get screen width and height in cell units?

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

    I am writing a plugin which adds Windows onto a given screen.

    I am trying to get the dimensions of the screen in cell units (e.g 17 x 8 cells), so I can set the window's size accordingly

    Things I tried:
    ScreenContents
    Root()["ShowData"]["UserProfiles"]["Default"]["ScreenConfigurations"]["Default"]["ScreenContents"]["ScreenContent 1"]

    It has these properties:

    [Int16 REQUESTEDW] = [<18>]

    [Int16 REQUESTEDH] = [<7>]

    But these number represent the current content's total size, not the screen size.
    (Meaning that if there is a window of size 5x5 starting at (0,0) then we would have:
    [Int16 REQUESTEDW] = [<5>]

    [Int16 REQUESTEDH] = [<5>]

    GraphicsRoot

    Looking at GraphicsRoot

    Root()["GraphicsRoot"]["PultCollect"]["Pult 1"]["DisplayCollect"]["Display 1"]

    It has the MA3 Window size and position, and it has the SCALERATIO,
    So I could theoretically calculate from the pixels, how many cells there are.
    But this seems an overkill...


    Any suggestions?

  • if your still digging, without luck, try this:

    return function()

    local mydisplay = GetDisplayByIndex(1)

    local myscreen = mydisplay:FindRecursive('UiScreen')

    Echo(mydisplay.Name .. ' has a UI screen area of ' .. myscreen.ViewW .. ' by ' .. myscreen.ViewH ..' Cells')

    end

  • I solved it like this:
    (Code snippet written in TypeScript)
    It pretty robust.


  • Andreas
    But your solution is much better (not a hack like mine) , you strike again !
    How do you get these insights?
    I was looking at the children of the Display Object, and didn't dig deep enough.

    So the UiScreen is here:
    Root()["GraphicsRoot"]["PultCollect"]["Pult 1"]["DisplayCollect"]["Display 1"]["ScrollIndicatorBox"]["ScreenScroll"]["ScrollBox"]["UiScreen"]


    fI you would like to get a glimpse of the plugin I am working on,
    login to my web-site (under-construction):

    http://www.ma3-pro-plugins.com

    after you login, I will give you permissions to download the beta version

    Thanks again.

    BTW:
    Clintos You too


    And I'll make you a Beta-Tester (-:

Participate now!

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