[Lazarus] Displaying Tree Data from a Shell/Terminal command in a TListView [Linux Debian]

wkitty42 at windstream.net wkitty42 at windstream.net
Sun Nov 27 11:06:26 CET 2022


On 11/26/22 8:24 PM, Aruna Hewapathirane via lazarus wrote:
> After asking for help on the Lazarus forum  I twiddled with the font size and 
> then it displayed the tree lines perfectly but I would like to know if there is 
> a way to do this using a TListView without having to be stuck with a Monospace 
> font and a specific font size?

no, there is not really any way to do this without using a monospace font... 
terminals are monospace by design... their resolutions are represented by the 
cols*rows of their characters... eg: 80*24, 80*43, 132*24, 132*43...

each character is in a cell that has a fixed width and height... some common 
cell sizes are 9*12, 9*14, 9*16, 6*12... these are not pixels, though... pixels 
were not a thing when these were designed... they are basically dots in a raster 
cell... these cells are what are counted for terminal resolutions because each 
cell holds one character and terminals are character based, not pixel based...

not only do you have the vertical spacing but also the horizontal... note in 
your image that your column spacing is off so that needs to be fixed, too... 
note how your proportional spacing image cannot properly align the columns of 
information... FSTYPE, FSVER, LABEL, UUID, FSAVAIL, FSUSE%, and MOUNTPOINT...

if you are going to replicate the output of a terminal on a graphic canvas, 
monospace fonts are the best and easiest way... especially if you are going to 
easily deal with tabular output and column alignment... this because you don't 
have to do any extra work to get everything aligned properly...

then there's the aesthetics... personally speaking, seeing, for example, the 
UUID column in proportional font would drive me bananananananananas... 
columnar/tabular data is meant to be displayed in a fixed width format... 
proportional fonts simply cannot properly do that...


-- 
  NOTE: No off-list assistance is given without prior approval.
        *Please keep mailing list traffic on the list where it belongs!*


More information about the lazarus mailing list