ListBox Desktop cell expand according to the size of the text

how can I make the row of the listbox that when in text is larger than the cell expand according to the size of the text

You can’t. Listbox rows are all the same height. It’s a known limitation of Listbox.
If you make all rows the same taller height you can do custom drawing in CellTextPaint.

Optionally, there are third party list/grid controls that support variable row and cell heights.

so more money for plug-in
it hurts for my projects
i have Valentina for the Reports,,GraffitiSuite and so on plus Xojo Update 699.00 + all Plug-ins .

when you add all this money to recorver the money from the project most of the time you lost money is like working for free.

so I have to choose another plug-in more money for each year to use XOJO or go open source.

XOJO they should finish all their controls before continuing to add new things when customers see how much they have to spend to use XOJO they will go with open source.

so now add one more for finish my projects

any recommendation that is not expensive

DataView for Xojo by piDog Software

  • Independantly setable RowHeights.

$99 in the first Year and $20 for each additional Year of Update Subscriptions. And well worth the Money. :slight_smile:

This small method calculates and sets the optimal width for each column of a listbox:

Parameter: Liste as Listbox

dim Col_Width() as integer
dim row as integer
dim col as integer
dim Max_Width as integer = 300
dim Width_Plus as integer = 15
dim Width as string
dim komma as string
dim p as picture
dim g as graphics
dim w as Integer
p = new picture(1,1)
g =
g.TextFont = Liste.TextFont
g.TextSize = Liste.TextSize
redim Col_Width(Liste.ColumnCount - 1)
for col = 0 to (Liste.ColumnCount - 1)
w = g.StringWidth(Liste.Heading(col))
Col_Width(col) = w
for row = 0 to (Liste.ListCount -1)
for col = 0 to (Liste.ColumnCount - 1)
w = g.StringWidth(Liste.Cell(row,col))
if w > Col_Width (col) then
Col_Width(col) = w
end if
komma = “”
for col = 0 to (Liste.ColumnCount - 1)
if Col_Width(col) < Max_Width then
Width = Width + komma + str(Col_Width(col) + Width_Plus)
Width = Width + komma + str(Max_Width)
end if
komma = “,”
Liste.ColumnWidths = Width

Hi Stefan
this code go to CellPaint or where on the listbox

thanks for help

Do you need to expand cell width or height?


I have the Einhugur license and think it is well worth the money. But which thing did you think would help with this specific instance?

They previously had a StyleGrid control, but deprecated it long ago because it could not port to 64-bit OSX. It is no longer listed in the current controls.

For the case you mention – variable row heights – I strongly second the piDog Dataview recommendation above by Sascha. You get LOTS of features beyond the variable row height.

But if you are looking for a free solution, you may want to check out Mergeable Cell Listbox by Karen Atkocius. I have not used it myself since I use the piDog solution, but it has been mentioned in these forums before where people wanted a free way for the standard listbox to subclass to handle (apparent) variable height (row spanning) or even variable width (column spanning).

Edit: My mistake. I thought the subclass was free, but see it is not. Remember forum posts wrong…

hi the piDog Dataview work on web App or no

Actually, I don’t know, as I have only tried in desktop apps. But the linked web page has a demo version you can download, so if nothing else seems like you could just try and see for yourself.