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.

Reply via email to