[perl-win32-gui-users] Listview selection

2002-07-03 Thread carollyne courtney

Hi,

How do I automatically scroll down and select the most currently appended 
item in a ListView?


Thanks

-snip-

use Win32::GUI;
use strict;

my $W = new Win32::GUI::Window(
 -left   => 50,
 -top=> 387,
 -width  => 200,
 -height => 200,
 -name   => "test",
 -text   => "listview"
 );

$W->AddListView(
   -name  => "lv",
   -text  => "",
   -left  => 0,
   -top   => 0,
   -width => 180,
   -height=> 170,
   -style => WS_CHILD | WS_VISIBLE | 1,
   -singlesel => 1,
   -fullrowselect => 1,
   -gridlines => 1,
  # -checkboxes => 1,
   -hottrack   => 1,
 );

$W->lv->InsertColumn(
   -index => 0,
   -width => $W->lv->ScaleWidth,
   -text  => "one",
   #-align   => "center"
);

$W->Show();


for my $i ( 0 ..  30 ) {
 insert($i);
}

Win32::GUI::Dialog();

sub insert {
 my $item = $W->lv->InsertItem(
   -item  => $W->lv->Count(),
   -text  => $_[0],
   -select => 1,
 );

 # How do I select the current item?
 # $W->lv->Select($item);

}







_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com





Re: [perl-win32-gui-users] Listview selection

2002-07-03 Thread Mark Di Nicola

carollyne courtney wrote:

Hi,

How do I automatically scroll down and select the most currently 
appended item in a ListView?


Thanks

-snip-

use Win32::GUI;
use strict;

my $W = new Win32::GUI::Window(
 -left   => 50,
 -top=> 387,
 -width  => 200,
 -height => 200,
 -name   => "test",
 -text   => "listview"
 );

$W->AddListView(
   -name  => "lv",
   -text  => "",
   -left  => 0,
   -top   => 0,
   -width => 180,
   -height=> 170,
   -style => WS_CHILD | WS_VISIBLE | 1,
   -singlesel => 1,
   -fullrowselect => 1,
   -gridlines => 1,
  # -checkboxes => 1,
   -hottrack   => 1,
 );

$W->lv->InsertColumn(
   -index => 0,
   -width => $W->lv->ScaleWidth,
   -text  => "one",
   #-align   => "center"
);

$W->Show();


for my $i ( 0 ..  30 ) {
 insert($i);
}

Win32::GUI::Dialog();

sub insert {
 my $item = $W->lv->InsertItem(
   -item  => $W->lv->Count(),
   -text  => $_[0],
   -select => 1,
 );

 # How do I select the current item?
 # $W->lv->Select($item);

}



thats it - $W->lv->Select($i);