possible to set the listbox's one row height?

first row | x | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
second row |x | xxx |

what my idea is merger (one and two into one row,and the third act as second row)

too complicate…

yes, but not built in.

URL ?

not url. some data is too long in one cell. and need to append the row height…
this case is a little complicate

you can store the long data in the cell help tag. it will appear in a yellow bubble.

See http://www.katkosoft.com/ Mergeable Cell Listbox

just wonder why listbox could not allow us to change one row’s height… if can this,everything could be down…
I am considering write my own listbox in canvas…

Hi Chai,

as fas as I understand, the URL you get above (courtesy of Michel) use a standard Listbox.

What people have to understand is how things goes with Xojo (and probably others).

a. There is a set of available things (native) that allows you to achieve obvious tasks.
b. There is a multitude of things you can do with Xojo that are not obvious at all, that have no description in the Language Reference and that do not need a third party add-on.
c. There are a set of things you need to buy an add-on to achieve.

And I do not talk about things that exists and you do not understand (at first, usually because the name is not obvious: Listbox.Invalidate for example), skip, anything (Murphy’s Law) and are pesting because this function does not exists. *
What about how to add a Column to a Listbox ? Listbox.ColumnCount = Listbox.ColumnCount + 1 !

Now, to do things that are in the b category, you have to think (ask here) by yourself. As an example, you can insert a column where you want in a Listbox, but the LR does not tells you a single word on that.

I can write a book on this subject !

  • Think: in AppleScript, there are no Left(), Right() nor Mid() functions. But you can code them easilly.

[quote=333418:@Chai Ren]just wonder why listbox could not allow us to change one row’s height… if can this,everything could be down…
I am considering write my own listbox in canvas…[/quote]

Emile’s explanation is worth faving and remembering from time to time. People have been using Xojo for all kinds of things for two decades so while things may be more or less obvious/simple, they’re mostly doable.

For your specific problem your asking for a fundamental change to how the listbox works. Behind the scenes the listbox not only doesn’t have individual rows with their own properties but it doesn’t even “scroll” in the way you think. It’s just replacing the contents in the fixed-height locations (by default) when you scroll. This is also the reason you can’t have pixel-level scrolling.

Now, it would be valid to complain about it but since this is the way it is, it would be more productive (for you getting results) to consider how this problem has been solved in the past, to wit in no particular order:

1.-To use the listbox as is and try to find a different UI solution (Jean-Yves suggestion, for example)
2.-To use a variant of the listbox that fakes multiple-heights by allowing rows to be visually merged (Michel’s suggestion of using @Karen Atkocius’s listbox)
3.-To use one of the multiple non-listbox based grids that exist out there are external plug-ins (for example, @Björn Eiríksson’s datagrid) or @jim mckay’s DataView
4.-To use a different way to present your data: I’ve used an HTML-based table when I needed a lot of display flexibility but little interaction and automation. A scrolling canvas like @jim mckay’s is also incredibly flexible.
4.-Code this yourself by taking over the cell paint events and repainting the contents of the cell yourself (this would allow you to resize the text dynamically, re-wrap it in the available height or display it in a way that makes it clear it’s truncated, like “longchunk…ofdata”). Like this example from @Marco Hof : https://forum.xojo.com/27312-word-wrap-in-a-listbox-cell/0#p225796 (you can see Emile’s “listbox.invalidate” there, in the context I understand he was including it).

Learning a new programming language can be simultaneously exhilarating and frustrating. You know where you want to go and you’re sure you have a good idea on how to get there, but complications and unknown options keep cropping up. This is normal and happens for all. The reward is worth it, though, if you hold on there.

Thanks kindly above menthions… but my requirment is more compilicate than just wrap the line. including Hitting on the cells text and detect somethings.
and I decide to write a grid by myself base on “Canvas” to control all of these…

To create a simple grid just with my cols and vols and height and text with something is more fun …

a code example exists to get the click on row,column, so you can get the clicked Row and the clicked Cell thus get the text in the cell (or in the whole Row)…

thanks…but I need to change the rowheight indeed ,and merge cells or rows is compilcate.
I decide to draw the grid myself. as I only need 2 types (text,dropdown)

OK.

You might want to look at a third party control already based on a canvas: DataView as it may already do everything you need plus a bunch of stuff you have not thought about. And the source code can be licensed too, if you want to use it as a base and extend more on your own. It all depends on what you consider your time worth…

sorry,dataview control coun’t resolve my problems …

I have a specify requiments

suppose I have a cell

cell contain is " X(123.99) >Y(100.22 ) " and I need to change the 123.99 with a caret. just like excel. I have no idea sofar.
I have make my own grid by extends from canvas. but still lots of problems to face it.

[quote=334162:@Chai Ren]sorry,dataview control coun’t resolve my problems …

I have a specify requiments

suppose I have a cell

cell contain is " X(123.99) >Y(100.22 ) " and I need to change the 123.99 with a caret. just like excel. I have no idea sofar.
I have make my own grid by extends from canvas. but still lots of problems to face it.[/quote]

You started this thread asking about variable row heights, and DataView definitely handles variable row heights as well as spanning columns or rows, hence my suggestion.

I’m not sure I understand what you mean by “I need to change the 123.99 with a caret. just like excel” – but my interpretation of that is that you need to be able to edit the cell contents with the caret being the cursor insertion point. DataView cells can be editable as well.

If you want to create your own control from a canvas, go ahead. It’s a great way to learn, if you have the time to start from scratch.

[quote=334165:@Douglas Handy]You started this thread asking about variable row heights, and DataView definitely handles variable row heights as well as spanning columns or rows, hence my suggestion.

I’m not sure I understand what you mean by “I need to change the 123.99 with a caret. just like excel” – but my interpretation of that is that you need to be able to edit the cell contents with the caret being the cursor insertion point. DataView cells can be editable as well.

If you want to create your own control from a canvas, go ahead. It’s a great way to learn, if you have the time to start from scratch.[/quote]

yes, I nearly complete it as a canvas is easy to learn and understand … but still some problems.

thanks all,i complete this by canvas.

draw the grid line.and make a function drawcell to draw anything to anywhere in canvas…