Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Ask Reuben 40 - Right Justified Labels  (Read 5076 times)
Reuben B.
Four Js
Posts: 1108


« on: July 30, 2020, 05:10:46 am »

To understand why your right justified field labels may not right align as intended, it is first necessary to have an understanding of …

   • fonts, and the concept of monospaced fonts, and proportional fonts.
   • how field labels inside a .per are compiled as a LABEL widget with a posX and gridWidth property.

A font has the property that it is either monospaced or proportional.  A monospaced font has the property that each character takes up the same amount of space.  A proportional font has the property that each character will take up a different amount of space.  Typically i is the narrowest, whilst M or W are the widest.

When compiling raw text inside a Genero form, a LABEL is created that has a posX and gridWidth property.  If a proportional font is used, then two words with the same posX and gridWidth values are not guaranteed to end in the same position.  As a result whilst the developer might have intended this raw text to right align, there is no guarantee that they will.

The solution is to explicitly define a LABEL and use the JUSTIFY=RIGHT property.  Explicitly defining a LABEL also has other advantages.

Read more at https://4js.com/ask-reuben/ig-40/

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines