Jez,
 
Hummm. I was pretty sure you would have tried that. There must be something
else wrong. Does this modification to your example not work for you?
 
===================================================================
 
use Win32::GUI;
 
my $mainWindow = new Win32::GUI::Window (
    -name     => "mainWindow",
    -title    => "Testing",
    -pos      => [0, 0],
    -size     => [300, 300],
);
 
my $lb=$mainWindow->AddListView (
   -name   => "ListView",
   -pos      => [20, 60],
   -size     => [100, 120],
    );
 
$mainWindow->ListView->InsertColumn(
 -index  => 0,
 -text  => "Item",
);
 
$mainWindow->ListView->ColumnWidth(0,90);
 
$mainWindow->ListView->InsertItem(-text => 'One');  
$mainWindow->ListView->InsertItem(-text => 'Two');  
$mainWindow->ListView->InsertItem(-text => 'Three');  
$mainWindow->ListView->InsertItem(-text => 'Four');  
$mainWindow->ListView->Hide;
 
my $show=$mainWindow->AddButton (
   -name   => "Button",
   -pos      => [20, 20],
   -size     => [40, 40],
   -text     => 'Show',
   -onClick => \&Show,
    );
 
my $hide=$mainWindow->AddButton (
   -name   => "Button2",
   -pos      => [60, 20],
   -size     => [40, 40],
   -text     => 'Hide',
   -onClick => sub {$mainWindow->ListView->Hide;},
    );
    
$mainWindow->Show;
 
Win32::GUI::Dialog();
 
sub Show {
  #select the first and last items
  $mainWindow->ListView->Show;
  $mainWindow->ListView->Select(0);
  $mainWindow->ListView->Deselect(1);
  $mainWindow->ListView->Deselect(2);
  $mainWindow->ListView->Select(3);
  return 1;
}


  _____  

From: Jez White [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 02 December, 2004 13:39
To: Glenn W Munroe; 'Win32-GUI'
Subject: Re: [perl-win32-gui-users] Pre selecting items in list Views and
List Boxes


Hi Glenn,
 
Yeah - I tried that - but no joy - if Select is used in the list box it
doesn't work either. Well, it doesn't work when the -multisel option is
used, and only 1 row is selected when it's turned off.
 
Cheers,
 
jez.
 

----- Original Message ----- 
From: Glenn W Munroe <mailto:[EMAIL PROTECTED]>  
To: 'Jez White' <mailto:[EMAIL PROTECTED]>  ; 'Win32-GUI'
<mailto:perl-win32-gui-users@lists.sourceforge.net>  
Sent: Thursday, December 02, 2004 4:33 PM
Subject: RE: [perl-win32-gui-users] Pre selecting items in list Views and
List Boxes

Jez,
 
I hope this isn't a stupid question, but have you tried Select(INDEX) and
Deselect(INDEX)? I don't think they are exact equivalents of SetSel, but
they do what I *think* you want to do.
 
Glenn

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jez
White
Sent: Thursday, 02 December, 2004 13:07
To: Win32-GUI
Subject: [perl-win32-gui-users] Pre selecting items in list Views and List
Boxes


Hi,
 
I'm trying to pre select several items that appear in a list view. These
items have been selected by the user previously, so when the list is reshown
later I want those items to be pre-selected. The example below works with a
list box - but for the life of me, I can't seem to get it working with a
list view? Am I missing something?
 
Cheers,
 
jez.
 
------

Reply via email to