From: <Pet...@at...> - 2001-06-15 12:57:27
|
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:Hen...@sa...] > Sent: Friday, June 15, 2001 7:32 AM > To: per...@li... > Subject: [perl-win32-gui-users] ListBox, -multisel and=20 > Select() problems >=20 >=20 > Hi! >=20 > In my program I have a ListBox control, and I'm saving out=20 > 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.=20 >=20 > I have code working for writing and reading back these lists,=20 > however I have encountered problems with the code for doing > the actual selecting of the items.=20 >=20 > My ListBox allows for multiple selections and has a scrollbar, > and is defined somewhat like this (only the size/pos differs): >=20 > $SystemWindow->AddListBox( > -name =3D> "Systems", > -style =3D> WS_SCROLL | WS_VISIBLE, > -left =3D> 10, > -top =3D> 10, > -height =3D> 200, > -width =3D> 120, > -multisel =3D> 1 > ); >=20 > The code I'm trying to use for reading in and selecting items > looks roughly like this (removing the insignificant portions > like tests etc.): >=20 > [loop statement here] { > if ( $SystemWindow->Systems->FindStringExact( $text ) ) { > $SystemWindow->Systems->SelectString( $text ); > } > } >=20 > 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=20 > elaborate... >=20 > $SystemWindow->Systems->Select(=20 > $SystemWindow->Systems->FindStringExact( > $text ) ); >=20 > ... but it still won't work. >=20 > 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! :-) >=20 > -- > Henning Tolpinrud > Hen...@sa... >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 > = ********************************************************************** > The following text is in Norwegian: Avsender er anse som personlig > ansvarlig for innholdet og H=E9=8F=B1rens Forsyningskommando = fraskriver seg > ethvert ansvar for innholdet i meldingen og eventuelle vedlegg. >=20 > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >=20 |