Instead of using pixels to define position and (in some cases) size of GUI objects, we could use relative units, as seen on this table (from w3schools: http://www.w3schools.com/cssref/css_units.asp):
Meaning that we could make our GUIs automatically adjust to screen sizes or similar criteria.Unit Description
em Relative to the font-size of the element (2em means 2 times the size of the current font) Try it
ex Relative to the x-height of the current font (rarely used) Try it
ch Relative to width of the "0" (zero)
rem Relative to font-size of the root element
vw Relative to 1% of the width of the viewport
vh Relative to 1% of the height of the viewport
vmin Relative to 1% of viewport's smaller dimension
vmax Relative to 1% of viewport's larger dimension
%
px pixels (1px = 1/96th of 1in)
This, eventually, could allow us to use an unique interface for mobile and desktop (this idea must be tested and adjusted)
For this, the library should be modified to accept string as coordinates and sizes, in such way to work like that:
Code: Select all
oMain = new Form( "HMGSCRIPT Main Demo (Desktop Style)", '90%' , '90%' );