The problem is, that the ItemRenderer which is not visible, actually not exists.

This works for tab down. I think you can solve this for tab up (shift + tab).



<?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"/>
                <s:List id="editList" dataProvider="{values}" height="100%" 
hasFocusableChildren="true">
                        <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+1);
                                                                }

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

</s:Application>





> Am 16.09.2015 um 09:18 schrieb Chris Velevitch <chris.velevi...@gmail.com>:
> 
> I had tried that and it still loses focus. It does scroll a couple of rows,
> but still loses focus before getting to the last record in the dataProvider.
> 
> On Wed, Sep 16, 2015 at 5:06 PM, Marcus Fritze <marcus.fri...@googlemail.com
>> wrote:
> 
>> Hi Chris,
>> 
>> in the TextInput I would add a function for the event focusIn. In this
>> function I would use list.ensureIsVisible(<indexNr of the row>).
>> 
>> Greetings
>> 
>> Marcus
>> 
>> Am 16.09.2015 um 08:10 schrieb Chris Velevitch <chris.velevi...@gmail.com
>>> :
>> 
>> 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/
>> <Main.mxml>
>> 
>> 
>> 
> 
> 
> --
> 
> 
> 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