AH! The light dawns! The problem is not in the Listbox, it's in my
expectations of it. :-)
I had thought that a multi-column listbox would show multiple sub-items
*per selectable item*, sort of the way a ListView works.
Say I was doing library books, and the user's search returns four
possibilities. I want them to choose from one of the four, but I want
to show them multiple bits of information about each. Say, title, card
number, and shelf location:
+---------------------------------------------+-+
| Green Eggs and Ham JF SEU Children's |^|
| A Brief History of.. 897.112 2nd Floor |#|
| Kim F KIPL Attic |#|
| Your Book Title Here 501.2 Vault |v|
+---------------------------------------------+-+
I'd like the user to click on any one of those, have the whole line be
highlighted, and have an event trigger so I could fetch the requested
information.
Is this possible? Should I be (ab)using a ListView for this?
Eric J. Roode
-----Original Message-----
From: Robert May [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 06, 2006 3:38 PM
To: Roode, Eric
Cc: [email protected]
Subject: Re: [win32-gui] [perl-win32-gui-users] Listbox multi-column
Roode, Eric wrote:
> I am trying to figure out how to work with a multiple-column listbox.
> The doco clearly shows how to create the Listbox as multi-colum:
>
> -multicolumn => 0/1 (default 0)
>
> but it says nothing about how to add/insert multicolumn items.
No different to adding non-multicolumn items.
Regards,
Rob.
#!perl -w
use strict;
use warnings;
use Win32::GUI();
my $mw = Win32::GUI::Window->new(
-title => "Multi-column ListBox",
-size => [400,300],
);
$mw->AddListbox(
-name => "LB",
-width => $mw->ScaleWidth(),
-height => $mw->ScaleHeight(),
-vscroll => 1,
-multicolumn => 1,
);
$mw->LB->Add($_) for 1..100;
$mw->Show();
Win32::GUI::Dialog();
exit(0);
__END__