Page 1 of 1

PostPosted: Sat Mar 03, 2001 2:37 pm
by BobShen
Hi everyone:
I create a multicolumn ListBox control.
How should I set each of column's width? When I want
to get third column's text.How to do that?
If I want to sort ListBox contents. Which column is
the sort of key?

Bob Shen

PostPosted: Sat Mar 03, 2001 4:40 pm
by guy
There are two types of multicolumn list box.

The first type, using LBS_MULTICOLUMN runs down the first column, then down the next, then the next. So when you sort it the order is that the value in the top of the second column is the one after the value at the bottom of the first column, and so on.

So all columns are the key.

The second type of multicolumn list box is the LBS_USETABSTOPS type. That is a single column list box, but with tabs in each row to separate out the sub-columns. You write a value into each row with tabs (\t) between the sub columns. The key for sorting in this type is the whole contents of the real column, including the tab characters.

I can't remember off the top of my head how you set column widths. I suspect that you send a message with a width in device units and all columns are set to that width. There is a simple rough mapping from characters to device units. I'll go and look it up and report back.

You can't set different widths for each column because that requires you to send a message with an array containing the various column widths. PocketC doesn't let you send messages containing an array.