WebListbox vertical text alignment

I have a weblistbox with multiline enabled. The text vertically aligns to the center of the cell. Is their no way to get the text to align to the top of the cell? Someone else asked this same question here on the forum and never got an answer.

mark

Nobody knows?

Define a style with your desired alignment property . You can apply it to different properties of the weblistbox as required:

  • style
  • columnstyle
  • selectionstyle
  • columnheaderstyle
  • …and a few others

If you defined a general style in the IDE, you can still override it for certain columns for example. I have listboxes with some columns left aligned, others right aligned and others still with center aligned. Works with single line and multi-line. Setting alignment with styles works very well in my applications.

Perhaps may want to take a quick look at this page.

hope this helps.

I can’t find the vertical-align option in Xojo. The default WebListbox cell has this code (in my test app):

<td style="min-height: 60px; height: 60px; width: 337px; min-width: 337px; max-width: 337px;;">This is a test</td>

to align that cell to top this code could be shown:

<td style="min-height: 60px; height: 60px; width: 337px; min-width: 337px; max-width: 337px; vertical-align: top;">This is a test</td>

maybe a missing feature?

Thank you, Alberto DePoo, for your inspiration.

set ListBox1.MinimunRowHeight = 110

Dim strInfo As String = "<raw><table width=300 gorder=0 height=110><tr><td valign=top>" strInfo = strInfo + "line 1" strInfo = strInfo + "<br/>Line 2" strInfo = strInfo + "<br/>Line 3</tr></td></table></raw>" ListBox1.AddRow("test1", strInfo) ListBox1.AddRow("test2", strInfo)

of course… vertical alignment. There is no option for that. I was thinking horizontal alignment. Indeed, it is a nice feature request to send in Feedback, especially with the new Web framework being developed.

Found the feature request: <https://xojo.com/issue/19012>, I hope they consider this for Web 2.0
Reading the case I don’t know if something has changed since it was created.

This in app.HTMLHeader will set all tables content to align top:

<style> td {vertical-align: text-top;} </style>

You can also put that into a pagesource, so it affects only the webPage it is resting on.

And indeed, this attribute is missing from Xojo’s Webstyles.

You may want to file a feedback case.

if has ListBox1.CellPicture

<style> td {vertical-align: top;} </style>