[EMAIL PROTECTED] wrote:
thanks for the hint.
I tried that, but it doesn't seem to work.

Here's some code:

----------------------------------------------------------
use Win32::GUI;

$main_window = new Win32::GUI::DialogBox(
      -text   => "Test",
      -left   => 100,
      -top    => 50,
      -width  => 300,
      -height => 100,
      -name   => "Win",
);

$main_window->Show();


$listbox = $main_window -> AddListbox(
        -name   => "listbox",
        -multiline      => 1,
-left => 15, -top => 20, -width => 200,
        -height  => 50,
        -multiline => 1,
        -hscroll => 1,
        -vscroll => 1,
        -fullrowselect => 1,
        -singlesel => 1
);

foreach (1 ... 100) {
        $listbox_string = $listbox_string . " $_";
}

foreach (1 ... 10) {
        $listbox -> InsertItem($listbox_string);
}


Win32::GUI::Dialog();


sub Win_Terminate {
   return -1;
}

----------------------------------------------------------

Can you see,  what is going wrong?

A little research was required. You need to set the width of the listview with the SetHorizontalExtent() method. Try this:

#!perl -w
use strict;
use warnings;
use Win32::GUI();

my $main_window = new Win32::GUI::DialogBox(
    -text     => "Listbox scrollbars",
    -pos      => [100,50],
    -size     => [300,150],
);

my $listbox = $main_window -> AddListbox(
    -pos     => [15,20],
    -size    => [200,100],
    -hscroll => 1,
    -vscroll => 1,
);
$listbox->SetHorizontalExtent(1500);

my $listbox_string;
foreach (1 ... 100) {
    $listbox_string .= " $_";
}

foreach (1 ... 10) {
    $listbox->InsertItem("$_: $listbox_string");
}


$main_window->Show();
Win32::GUI::Dialog();
$main_window->Hide();
exit(0);
__END__

Regards,
Rob.

Reply via email to