Lining up words in textlabel
Posted
#1
(In Topic #1593)
Enthusiast

example of what I need
ID# Name Phone Gender Weight
6088 Blake the Man 907-555-1212 M 177
It is done currently with 2 lines put together with a " <br> " between them. What I get is
ID# Name Phone Gender Weight
6088 Blake the Man 907-555-1212 M 177
There must be an easy way to do this that I am just not getting.
Posted
Regular

Code (gambas)
- TextLabel1.Text = "<TABLE cellspacing=10><TR><TD>ID#</td><TD>Name</td><TD>Phone</td><TD>Gender</td><TD>Weight</td></tr>" &
- "<TR><TD>6088</td><TD>Blake the Man</td><TD>907-555-1212</td><TD>M</td><TD>177</td></tr></table>"
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

GridView is also RichText compliant for tweaks.
but also html TABLE tags work in TextLabel RichText as vuott wisely suggested.
Posted
Regular

Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Guru

Try this code: -
<IMG src="https://www.cogier.com/gambas/GridviewExample.png">
</IMG> Code (gambas)
- ' Gambas class file
- ''Run this code in a Graphical application
- BuildForm()
- GridView1.Columns.count = sHeader.Count + 1
- GridView1.Columns[iCol].Title = sHeader[iCol]
- GridView1.Columns[iCol].Alignment = Align.Center
- With GridView1
- .Rows.Count = 1
- .[0, iCol].Padding = 3
- .[0, iCol].Text = sData[iCol]
- .[0, iCol].Alignment = Align.Center
- .[0, iCol].Foreground = Color.Red
- GridView1.Columns.Width = -1
- .Height = 80
- .Width = 450
- .Arrangement = Arrange.Vertical
- .Padding = 5
Posted
Enthusiast

vuott said
…maybe you want something like :? this?Code (gambas)
TextLabel1.Text = "<TABLE cellspacing=10><TR><TD>ID#</td><TD>Name</td><TD>Phone</td><TD>Gender</td><TD>Weight</td></tr>" & "<TR><TD>6088</td><TD>Blake the Man</td><TD>907-555-1212</td><TD>M</td><TD>177</td></tr></table>"
I tried the table idea before posting. It seemed logical but the table was not supported so did not work. I will try the gridview.
Posted
Guru

sadams54 said
vuott said
…maybe you want something like :? this?Code (gambas)
TextLabel1.Text = "<TABLE cellspacing=10><TR><TD>ID#</td><TD>Name</td><TD>Phone</td><TD>Gender</td><TD>Weight</td></tr>" & "<TR><TD>6088</td><TD>Blake the Man</td><TD>907-555-1212</td><TD>M</td><TD>177</td></tr></table>"
I tried the table idea before posting. It seemed logical but the table was not supported so did not work. I will try the gridview.
Table IS supported.
<- investigates… : hmm seems only QT supports table but GTK does not.
Posted
Regular

Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Enthusiast

cogier said
I agree that using a Gridview is probably the answer.
Try this code: -
<IMG src="https://www.cogier.com/gambas/GridviewExample.png"></IMG>
Code (gambas)
' Gambas class file ''Run this code in a Graphical application BuildForm() GridView1.Columns.count = sHeader.Count + 1 GridView1.Columns[iCol].Title = sHeader[iCol] GridView1.Columns[iCol].Alignment = Align.Center With GridView1 .Rows.Count = 1 .[0, iCol].Padding = 3 .[0, iCol].Text = sData[iCol] .[0, iCol].Alignment = Align.Center .[0, iCol].Foreground = Color.Red GridView1.Columns.Width = -1 .Height = 80 .Width = 450 .Arrangement = Arrange.Vertical .Padding = 5
A little tweaking and this worked out fine.
1 guest and 0 members have just viewed this.


