from the samples, here's a select all. I suppose you could modify it to select just some...
sub AddAll_Click { for $i (0..$List1->Count-1) { $List2->InsertItem($List1->GetString($i)); } $List2->Select($List2->Count-1); $Edit2->Text($List2->GetString($List2->SelectedItem)); return 1; } > -----Original Message----- > From: Tolpinrud, Henning [mailto:[EMAIL PROTECTED] > Sent: Friday, June 15, 2001 7:32 AM > To: perl-win32-gui-users@lists.sourceforge.net > Subject: [perl-win32-gui-users] ListBox, -multisel and > Select() problems > > > Hi! > > In my program I have a ListBox control, and I'm saving out > selections from this listbox to a datafile. I need to be able > to read a selection back in and have the program select the > correct items in the list. > > I have code working for writing and reading back these lists, > however I have encountered problems with the code for doing > the actual selecting of the items. > > My ListBox allows for multiple selections and has a scrollbar, > and is defined somewhat like this (only the size/pos differs): > > $SystemWindow->AddListBox( > -name => "Systems", > -style => WS_SCROLL | WS_VISIBLE, > -left => 10, > -top => 10, > -height => 200, > -width => 120, > -multisel => 1 > ); > > The code I'm trying to use for reading in and selecting items > looks roughly like this (removing the insignificant portions > like tests etc.): > > [loop statement here] { > if ( $SystemWindow->Systems->FindStringExact( $text ) ) { > $SystemWindow->Systems->SelectString( $text ); > } > } > > I have checked, and double checked, that the strings *do* match > items in the ListBox, and that the position returned by the > FindExactString is correct. However the items *do not* get selected. > I have tried replacing the SelectString call with the more > elaborate... > > $SystemWindow->Systems->Select( > $SystemWindow->Systems->FindStringExact( > $text ) ); > > ... but it still won't work. > > HOWEVER, if I remove the -multisel statement from the ListBox > defintion, items *do* get selected (only one at a time, though, > obviously)! Is this a bug? And is there a known workaround for it? > Surely I cannot be the first person to try selecting multiple > items from within program code! :-) > > -- > Henning Tolpinrud > [EMAIL PROTECTED] > > > > > > > > > > > ********************************************************************** > The following text is in Norwegian: Avsender er anse som personlig > ansvarlig for innholdet og H鏱rens Forsyningskommando fraskriver seg > ethvert ansvar for innholdet i meldingen og eventuelle vedlegg. > > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >