Project Size via script - Forum

Forum Navigation
You need to log in to create posts and topics.

Project Size via script

I am developing a sample app where I need to reference the width and height of the Project via script.

NAB.Width and NAB.Height don't suffice because I have set the size of the app (Project >> Properties >> Size) to be much smaller than the size of my browser's Window.

Unlike VisualNEOWin, there does not appear to be a Reserved Variable for this.

Is it possible to have this info available as Reserved Variables ?

Is it possible to extract this information using GetObjectInfo or other javascript ?

Hi @gaev,

Please, take a look at the "responsive-template" sample included on the VisualNEO Web installation.
In VisualNEO Web, every page can have a different size, so there is not really a Project size.
By default every page have the same size identical to the project size and the <body> tag (page container), but you can change the size of each page through:
Project->Properties->Styles

body{
   width:100%;
   height:100%;
}
#MyPage{
   width:500px;
   height:350px;
}

Or you can also try using percentages:

body{
  width:100%;
  height:100%;
}
#MyPage{
  width:70%;
  height:70%;
}

But in both situations, remember to reposition the page so it keeps centered by adding this command on the page code tab:

SetRelativePosition "MyPage" "middle" "center"
GetObjectInfo "MyPage" "width" [theWidth]
GetObjectInfo "MyPage" "height" [theHeight]

Use the last code to get the width and height properties from a given page.

Gaev has reacted to this post.
Gaev

@luis:

Thanks for the information.

Pages are just a higher level container (div); I should have noticed that each page had an id (matching its given name).

GetObjectInfo worked as expected.