Hedemann Henrik wrote:
>         Hi, there!
> I have the problem to make a horizontal scrollbar appear at a
> listbox.

from the MSDN Library documentation:
  "Note that a list box does not update its horizontal extent
  dynamically."

to have the horizontal scrollbar, you need to explicitly tell
the Listbox that your data is larger than its size.

you can try something like that:

    ### find longest string in the listbox
    $longest = "";
    foreach $item (0..$lb->Count) {
        $text = $lb->GetString($item);
        if(length($text) > length($longest)) {
            $longest = $text;
        }
    }

    ### calculate the width
    ($w, $h) = Win32::GUI::GetTextExtentPoint32($longest);

    ### pass the width to the listbox
    $LB_SETHORIZONTALEXTENT = 0x194;
    $lb->SendMessage( $LB_SETORIZONTALEXTENT, $w, 0);

with this hack you can make a horizontal scrollbar appear
on the Listbox. note you need to add -hscroll => 1 to the
Listbox creation for this to work.

don't know why Listbox works this way; ask Micro$oft :-)

cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;



Reply via email to