Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help: Multi-column listbox

0 views
Skip to first unread message

Mark Henri

unread,
Jan 1, 2002, 3:10:38 AM1/1/02
to
OK, I got it to create--

Set the flag in the resource editor for the listbox control to enable multi
columns. Then...

SendMessage( hListBox, LB_SETCOLUMNWIDTH, (WPARAM)( cxColumn ), 0L );

in my initialize dialog section.

I tried sending a string and it truncated the column. But now my question
is how do you send data to the second column? Tabs didn't work. Neither
did new lines "\n" or returns "\r"? Anyone have any ideas?


** Sender Unknown ** <** Sender Unknown **> wrote in message
<3c2ea...@news.newsgroups.com>...
>Can anybody show me how to create a multi-column listbox in win32?
>
>I don't want to use MFC.
>
>I can create single-column listboxes, but not multi-column.
>
>I try creating one in the resource editor on a dialog box, but the
>dialog box fails to create with it.
>
>
>-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
>http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> Check out our new Unlimited Server. No Download or Time Limits!
>-----== Over 80,000 Newsgroups - 19 Different Servers! ==-----


Jeff Henkels

unread,
Jan 1, 2002, 8:14:07 AM1/1/02
to
Look into using a ListView control (in report mode) instead of a listbox; it
handles multiple columns very easily.

"Mark Henri" <markhenri@xxx_a_t_t_b_i_xxx.com> wrote in message
news:2aeY7.3461$4d5.21156@rwcrnsc54...

Tim Robinson

unread,
Jan 1, 2002, 11:37:13 AM1/1/02
to
Mark Henri <markhenri@xxx_a_t_t_b_i_xxx.com> wrote in message
news:2aeY7.3461$4d5.21156@rwcrnsc54...
> I tried sending a string and it truncated the column. But now my question
> is how do you send data to the second column? Tabs didn't work. Neither
> did new lines "\n" or returns "\r"? Anyone have any ideas?

Multi-column list boxes work like list views in "List" mode. You can't give
each item multiple columns; instead, items are displayed in a new column
once the list is full enough.


Mark Henri

unread,
Jan 1, 2002, 2:05:07 PM1/1/02
to
Already use list controls all the time. I even have a class that makes
initializing them super easy and fast. The spec calls for using a listbox
in multiple column mode.

Jeff Henkels wrote in message ...

Mark Henri

unread,
Jan 1, 2002, 2:14:02 PM1/1/02
to
Wow, I made a loop and loaded in a hundred strings. The list wraps to the
right. How bizzarre. I don't really like this behavior. Also, I've never
seen an application use this feature nor is it mentioned in any of the books
I have.

Also, I want to clarify something. This feature has nothing to do with a
columnar list like the list control gives. It's a wrapping feature and the
data in the additional columns has nothing to do with the columns to the
left or right.

Tim Robinson wrote in message ...

Mark Henri

unread,
Jan 1, 2002, 2:20:42 PM1/1/02
to
You've missed the point of the question totally. This feature has nothing
to do with multiple column associated data like the list control gives. Try
doing one in a dialog box and you'll see what I mean.

1. set the the multiple column checkbox in the resource editor
2. SendMessage( hListBox, LB_SETCOLUMNWIDTH,(WPARAM)( 100 ), 0L );
3. for ( int n=0; n < 100; n++ ) SendMessage( hListBox, LB_ADDSTRING,
0L,(LPARAM)"this is a line" );
4. hold the down arrow and watch the scrolling action in the listbox; it
traverses down then to the right. There's no scroll bar ever.

Jeff Henkels wrote in message ...

Mark Henri

unread,
Jan 1, 2002, 2:24:06 PM1/1/02
to
(The clarification was for others; I know that you get it.)


Jugoslav Dujic

unread,
Jan 3, 2002, 4:52:50 AM1/3/02
to
"Mark Henri" <markhenri@xxx_a_t_t_b_i_xxx.com> wrote in message
news:q1oY7.289$V35.3801@rwcrnsc53...

| (The clarification was for others; I know that you get it.)

Mark, sorry if I didn't get you again; you need something like
Explorer in "Details" view? If so, the closest you can obtain with
a List control is LBS_USETABSTOPS style and LB_SETTABSTOPS
message. This isn't the most beautiful stuff though (for example,
you can get only "left-aligned" tabs, which is rather ugly for numbers).
Of course, you have to replace entire list row each time you want
to change an item. Sometimes I even accompany those with push-like
radios on top to simulate a Header control. (Of course, you have to
do the sorting yourself).

Jugoslav
________________________
www.geocities.com/jdujic

0 new messages