Multi-Column Listboxes

Medic
09-05-2001, 08:20 PM
Is there any way to have a multi-columned listbox, not where the same field is "wrapped" around, but where multiple fields are next to each other and perfectly aligned?

In other words:

Item A ItemADescription ItemANumber
Item B ItemBDescription ItemBNumber
Item C ItemCDescription ItemCNumber
Item D ItemDDescription ItemDNumber

I have seen this in many windows based programs but have been unsuccessfull myself at figuring out how to do it.
Thanks!

Thinker
09-05-2001, 08:23 PM
A Listview control will do this right now. Easier than trying to subclass
a listbox.

I think therefore I am... sometimes right. images/icons/wink.gif

Thinker
09-05-2001, 09:45 PM
I need to point out that The Hand reminded me that it is possible to set
tab stops in a listbox using sendmessage API. You wouldn't have as
much control over columns and wouldn't have column headings but it
might be what you were really wanting to begin with.

I think therefore I am... sometimes right. images/icons/wink.gif

Medic
09-05-2001, 10:09 PM
Your response time is amazing! It sounds like the first one is my easiest option. Can you perhaps explain the API call. It sounds like more effort for less outcome.

BillSoo
09-05-2001, 10:16 PM
The standard Windows listbox supports tabstops. The VB listbox control which is based on the windows listbox object does not include that property in the control, but the underlying listbox still has it.

You can use the SENDMESSAGE API function to send a LB_SETTABSTOPS message to the listbox directly, without going through the control interface.

I recommend you take a look at www.allapi.net They have some good guides on API usage including source code. I think that this is one of the examples....



"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum