nsDialogs GUI editor
Hello,
I am thinking about writing some simple nsDialogs GUI editor. Designing interface takes to long (creating controls and set its properties).
I thought, it will be much easier, if I write some simple tool, where I can drag and drop components on form and set its properties, like
position, dimensions, colours etc...
But, the first problem is dialog size... Lets say, I want to create standard 1018 custom page. This means, the page has 300u width and
140u height. The problem is that program can run on different screen resoultions with different DPI settings. However my tool will operate
on pixels, not dialog units.
My PC screen resolution is 1920x1200[px] with 96 DPI. So, the page width is 450px, height is 228px. Is there any simple way to code it,
that on every PC I got the same positions of components? I mean, if I put Label on form, lets say in position:
Left: 30px, Top: 40px (width: 100px, height: 10px) this may be displayed differently on other PC.
So, to resolve this problem, I understand I must write controls dimenstions in script with "u" sufix, like for example: 100u - this will be
then displayed the same in every PC. Problem is how to write my pixels position in "u" units (dialog units).
I got this (U = control dimension in dialog units):
U = Dialog_Unit_Max *(100*Control_Dimension_Px/Dialog_Px_Max) / 100
where:
Dialog_Unit_Max = 300 for 1018 custom page,
Control_Dimension_Px = for example left position of control - 30px (in pixels)
Dialog_Px_Max = 450 px for 1018 custom page
So, even if I design GUI in pixels, I can write it using "u" units.
Is this method OK? Or I forgot about something (like DPI conversion)... Have anyone of you though about it?
-Pawel