Monday 19 November 2018

Pixel Perfect Positioning

Have you ever had trouble precisely positioning UI controls using the Gen toolset Window designer? Apart from the difficulty of doing so with the mouse (which is solved in Studio Developer by allowing you to move controls one pixel at a time with the keyboard or by typing in the co-ordinates), sometimes you cannot do so.



The reason is that for historical reasons the x and y co-ordinates for the window design are stored in the model using an OS/2 co-ordinate system since this was the first operating system that Gen GUI design worked on. For the Windows co-ordinate system used by the generators and for displaying the co-ordinates in the UI designer, the co-ordinates are converted but with the possible loss of 1 px since the OS/2 co-ordinate system is less precise than the Windows one.

A preference in the Studio Developer UI designer is to use Pixel Perfect Positioning. When enabled, whilst the designed co-ordinates are stored in the same OS/2 system in the model for use by the generators and the old toolset with the possible loss of precision, a hidden additional property is stored to ensure that the actual pixel value is retained. Whilst the Gen generated GUI and web windows will still suffer from the loss of precision of up to 1 pixel, when generating a Rapide application the Rapide generator uses this additional property to ensure that the co-ordinates used are correct without any loss.

No comments: