I think you'll have to subclass and set anchorbookmark yourself.

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
rviswanathan
Sent: Thursday, December 04, 2008 7:01 PM
To: [email protected]
Subject: [flexcoders] Multi Select List - Issue


Hi

I am facing an issue with a list that allows multi select. I am using Flex
2.0.

1. On load of the application, I set the first item in the list as selected.
(selectedIndex = 0). At this point, I am able to use "Shift" key to multi
select.
2. I have a button, on click of this button, I change my selected items so
as to select the first 2 items (selectedIndices = 0 & 1). When this happens,
if I try to do a shift+select, it does not work (until I make another
selection either with a click or Ctrl+Click).

Source code below. Is the anchor bookmark getting lost? I see it getting
set only as part of the selectedIndex method. How can I get around this
problem?

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="selectDefault(event);" >
<mx:Script>
<![CDATA[
private function selectDefault(e:Event) : void {
lst.selectedIndex = 0;
}

private function selectFirstTwo(e:Event) : void {
var arr:Array = [0,1];
lst.selectedIndices = arr;
}
]]>
</mx:Script>

<mx:List id="lst" allowMultipleSelection="true" width="100">
<mx:dataProvider>
<mx:String>AK</mx:String>
<mx:String>AL</mx:String>
<mx:String>AR</mx:String>
<mx:String>AB</mx:String>
<mx:String>AC</mx:String>
<mx:String>AD</mx:String>
</mx:dataProvider>
</mx:List>
<mx:Button label="Select First 2 Elements!"
click="selectFirstTwo(event)"/>
</mx:Application>

Thanks
Ram
--
View this message in context: 
http://www.nabble.com/Multi-Select-List---Issue-tp20846980p20846980.html
Sent from the FlexCoders mailing list archive at Nabble.com.

Reply via email to