Thanks Alex for the suggestion useVirtualLayout=false . I didn’t know that (or 
I have forgotten this). :-)

So I added this to the list and removed the +1 on itemIndex.

Chris, be sure you use the correct tabIndex for the TextInput. I changed this 
from data to itemIndex.
I used data in the old example, because you had numbers in the example. But 
itemIndex is better,
so your data can be A,B,C,….

This should work now.

Updated code:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx" 
minWidth="955" minHeight="600"
                           creationComplete="creationCompleteHandler(event)">
        <fx:Declarations>
                <!-- Platzieren Sie nichtvisuelle Elemente (z. B. Dienste, 
Wertobjekte) hier -->
        </fx:Declarations>

        <fx:Script>
                <![CDATA[
                        import mx.collections.ArrayList;
                        import mx.events.FlexEvent;

                        [Bindable]
                        private var values:ArrayList = new ArrayList();

                        private function 
creationCompleteHandler(event:FlexEvent):void
                        {
                                for (var i:int = 0; i < 100; i++)
                                        values.addItem(String(i));
                        }
                ]]>
        </fx:Script>

        <s:VGroup height="100%">
                <s:Button label="Top of List" tabIndex="1"/>
                <s:List id="editList" dataProvider="{values}" height="100%" 
hasFocusableChildren="true" useVirtualLayout="false">
                        <s:itemRenderer>
                                <fx:Component>
                                        <s:ItemRenderer>
                                                <fx:Script>
                                                        <![CDATA[
                                                                import 
spark.components.List;

                                                                private 
function onFocusIn(event:FocusEvent):void
                                                                {
                                                                        var 
list:List   = this.owner as List;

                                                                        
list.ensureIndexIsVisible(itemIndex);
                                                                }

                                                        ]]>
                                                </fx:Script>
                                                <s:HGroup paddingLeft="4" 
verticalAlign="middle">
                                                        <s:Label                
text="{data}" width="30"/>
                                                        <s:TextInput    
text="{data}" tabEnabled="true" focusIn="{onFocusIn(event)}" 
tabIndex="{itemIndex+2}"/>
                                                </s:HGroup>
                                        </s:ItemRenderer>
                                </fx:Component>
                        </s:itemRenderer>
                </s:List>
                <s:Button label="Bottom of List" tabIndex="{values.length + 
2}"/>
        </s:VGroup>

</s:Application>




> Am 17.09.2015 um 01:43 schrieb Chris Velevitch <chris.velevi...@gmail.com>:
> 
> Marcus's solution does work with my demonstration code, but when I tried to
> apply it to my production code, I'm still seeing the problem. So I need to
> look into why and how my production code (it uses states to switch item
> renderers and some other differences) differs from my demonstration code.
> 
> Alex, I will keep your suggestions in mind in case I can't work it out.
> 
> Is there a ticket open for updating the Spark List with those Spark
> DataGrid code?
> 
> On Thu, Sep 17, 2015 at 12:47 AM, Alex Harui <aha...@adobe.com> wrote:
> 
>> If you look at Spark DataGrid, there is a whole bunch of code added to
>> handle this.  I believe this code was never applied to Spark List.  Can you
>> use a single-column DataGrid instead?  And if not, can you use a List with
>> useVirtualLayout=false?
>> 
>> -Alex
>> 
>> From: Chris Velevitch <chris.velevi...@gmail.com<mailto:
>> chris.velevi...@gmail.com>>
>> Reply-To: "dev@flex.apache.org<mailto:dev@flex.apache.org>" <
>> dev@flex.apache.org<mailto:dev@flex.apache.org>>
>> Date: Tuesday, September 15, 2015 at 11:10 PM
>> To: "dev@flex.apache.org<mailto:dev@flex.apache.org>" <dev@flex.apache.org
>> <mailto:dev@flex.apache.org>>
>> Subject: Lists with focusable children problem
>> 
>> I have a spark List with hasFocusableChildren is true and a custom
>> renderer that has a TextInput field. I set focus to a row and then start
>> tabbing through the list, when it gets to the last visible row, the next
>> tab causes focus to leave the List. How do I get the list to scroll into
>> view the next row? The same thing also happens when shift-tabbing backup
>> the list and the very first row is not currently visible.
>> 
>> Attached is some code that demonstrates the problem.
>> 
>> 
>> Chris
>> --
>> Chris Velevitch
>> Manager - Adobe Developers & Designers, Sydney
>> m: 0415 469 095
>> 
>> Adobe Developers & Designers, Sydney
>> Topic: Lucee
>> Date: Mon, 28th September
>> Details and RSVP on
>> http://www.meetup.com/Adobe-developers-designers-sydney/
>> 
> 
> 
> 
> --
> 
> 
> Chris
> --
> Chris Velevitch
> Manager - Adobe Developers & Designers, Sydney
> m: 0415 469 095
> 
> Adobe Developers & Designers, Sydney
> Topic: Lucee
> Date: Mon, 28th September
> Details and RSVP on http://www.meetup.com/Adobe-developers-designers-sydney/

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to