----- Original Message ----- From: "Robert May" <[EMAIL PROTECTED]>
To: "pcourterelle" <[EMAIL PROTECTED]>
Cc: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Wednesday, July 11, 2007 2:29 PM
Subject: Re: [perl-win32-gui-users] combobox


On 04/07/07, pcourterelle <[EMAIL PROTECTED]> wrote:
Rob, thanks for that...that drove me nuts for a while...what does
SetTopIndex() do if it does ensure the value of the index is visible in the
Listbox? The info says:

SetTopIndex
SetTopIndex(INDEX)
Ensure that a particular item is visible in the Listbox of a Combobox.

Just curious.

It does what it says.  You need to understand that the 'Listbox of a
combobox' is the drop-down window that you to select items in;  It
makes sure that the item referred to by INDEX is within the visible
window - you'll only notice it do anything if you have enough items in
the listbox such that the drop-down needs to scroll to see some items,
AND the dropdown is visible.

Regards
Rob.


Yes I understood the meaning of the description fine and I'm not questioning whether the code works. It just never worked in my implemenation. I took the meaning of the descrpition to mean that when the TopIndex is set to (0) the item at (0) will be visible in the Listbox window. Yes the scrollbar is visible and active and the drop down works with scrollbar.

Sample below.

#! perl -w

use strict;

use Win32::GUI;

my $MainWindow = new Win32::GUI::Window(
-name => "MainWindow",
-size => [300,400],
-pos => [100,200],
);


$MainWindow->AddCombobox(
 -name => "FilterList",
 -autoscroll => 1,
 -dropdown => 1,
 -dropdownlist => 1,
 -size => [200,100],
 -height => 100,
 -pos => [$MainWindow->Width*0.05,$MainWindow->Height*0.055],
 -vscroll => 1,
 );

PopulateCombo();

#------------------------
$MainWindow->Show();
Win32::GUI::Dialog();
#------------------------

sub PopulateCombo{

foreach (qw(Big Bad Bob Bothers Brothers Because Bob Bake Bundt Batter By Batteries)){
  $MainWindow->FilterList->Add($_);
}

$MainWindow->FilterList->SetTopIndex(1);

}

#--- end----


Reply via email to