I've finally had time to check this out a little further.

As a reminder, I'm creating nested TabNavigator elements dynamically. I
avoided using a Repeater and attached a CollectionChange event listener to
the ArrayCollection that is the main data provider. The function called by
the listener walks through the structure, creating TabNavigators with VBox
children, and at the bottom level, a custom component (DocDataGrid) that is
a VBox which wraps a DataGrid.

The problem is that a click on a tab in the lowest-level TabNavigator
doesn't display the selected child. Rather, it sends the user several
levels back up the component tree.

I've followed the click through TabBars and NavBars and Buttons till
there's a click event fired where I can't determine what's supposed to hear
the click. The selectedIndex appears correct through each level in the
inheritance, but then the process fails.

I've even added some hack-y invalidateDisplayList() calls in hopes that
they might have an effect.

I'm including the code that creates the elements, along with some screen
shots that I hope will better explain what's going on.

If you have time to look them over, and if you see where I'm going wrong, I
would certainly appreciate any pointers.

Thanks very much in advance.

private function buildUI(e:CollectionEvent):
void{
                clearTabs();
                var vb:VBox;
                var tn:TabNavigator;
                var ddg:DocDataGrid;
                for(var i:int=0;i<acCaseDocuments.length;i++){
                    var arSubtypes:Array = acCaseDocuments[i].subtypes as
Array;
                    vb = new VBox();
                    vb.id='docType' + i;
                    vb.setStyle('horizontalAlign','center');
                    vb.label = acCaseDocuments[i].friendlyName as String;
                    vb.percentWidth=95;
                    vb.percentHeight=95;
                    vb.styleName='contentWhite';
                    tn = new TabNavigator();
                    tn.id='docSubtab' + i;
                    tn.percentWidth=100;
                    tn.percentHeight=100;
                    tn.x=5;
                    tn.y=5;
                    tn.setStyle("backgroundAlpha",0);
                    tn.setStyle('borderThickness',1);
                    tn.setStyle('paddingTop',0);
                    tn.creationPolicy="all";
                    for(var j:int=0;j<arSubtypes.length;j++){
                        ddg = new DocDataGrid();
                        ddg.id= 'docSubtype' + j;
                        ddg.label=arSubtypes[j].friendlyName as String;
                        ddg.gridData.source=arSubtypes[j].documents as
Array;
                        ddg.gridData.refresh();
                        tn.addChild(ddg);
                    }
                    tn.invalidateDisplayList();
                    vb.addChild(tn);
                    docTabs.addChild(vb);
                }
                setFirstTab(e);
            }


On Thu, Oct 24, 2013 at 12:32 PM, Alex Harui <aha...@adobe.com> wrote:

> **
>
>
> Never tried right clicking on the framework files before.  You're right
> that it doesn't work.  But double-clicking should set a breakpoint.  It
> does for me.
>
> From: Tom McNeer <tmcn...@gmail.com>
> Reply-To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
> Date: Thursday, October 24, 2013 7:44 AM
>
> To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
> Subject: Re: [flexcoders] Nested TabNabvigator/Repeater error
>
>
>
> Alex,
>
> Thanks again for your reply. Sorry I was unclear. I wasn't suggesting that
> the framework had code to switch the ViewStack on click.
>
> I was responding to your comment about the concern being the logic that
> responds to the change in the TabNavigator and TabBar. And I simply meant
> that my code does not contain any handlers for any actions on the
> TabNavigators created in my AS code, nor on the underlying TabBars. But
> rather, the click on the visible Tab that _appears_ to be responsible for
> switching the ViewStack is being handled somehow by the framework, since I
> have not overridden it.
>
> I realize that the proper course would be to follow the event into the
> framework files. However, in my initial post, I was hoping that someone
> might have experienced a similar problem and know a simple solution.
>
> I am now trying to follow the event down into the framework. But I'm
> running into what seems like a dumb problem: I am unable to set breakpoints
> in the framework files. I can search for and open class files in the
> correct version of the framework; but a right-click in the left margin does
> not bring up a context menu at all.
>
> The framework is being merged into the code at compile time.
>
> I know this may be a silly question, but can you tell me why Flash Builder
> (4.6) might be acting this way?
>
>
> On Wed, Oct 23, 2013 at 2:40 AM, Alex Harui <aha...@adobe.com> wrote:
>
>> **
>>
>>
>> I'm not sure what you mean by "the framework".  AFAIK, the framework
>> doesn't have any code that automatically switches ViewStack views based on
>> mouse activity.
>>
>> But you could put a breakpoint on the ViewStack code and see why it is
>> changing.
>>
>> -Alex
>>
>> From: Tom McNeer <tmcn...@gmail.com>
>> Reply-To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
>> Date: Tuesday, October 22, 2013 12:30 PM
>> To: "flexcoders@yahoogroups.com" <flexcoders@yahoogroups.com>
>> Subject: Re: [flexcoders] Nested TabNabvigator/Repeater error
>>
>>
>>
>> Hi Alex,
>>
>> Thanks very much for the reply.
>>
>>
>> On Tue, Oct 22, 2013 at 12:56 PM, Alex Harui <aha...@adobe.com> wrote:
>>
>>> In the AS version, I would guess there are relatively few ways to
>>> "switch to a different screen".
>>>
>>
>> Yeah, I would agree. The reason I used the vague "switch to a different
>> screen" is that the resulting action is nothing that is called in the
>> component or even its parent.
>>
>> I'll lay this out as quickly as I can:
>>
>> There's a view we'll call Cases which has a ViewStack that consists of
>> "Case Results" and "Case Details." A search triggered from a parent of the
>> Cases view results in a grid in Case Results being populated. A click on a
>> row in the grid calls the server for data on an individual Case and
>> switches to the Case Details view.
>>
>> That view contains a TabNavigator for various aspects of the Case,
>> including Documents. The nested TabNavigators I'm trying to create are
>> within that Documents view.
>>
>> When I say that a click on any second-level (Document subtype) tab goes
>> "to a different screen," what happens is that everything is switched back
>> to the Case Results view - taking you back to the first element in the
>> Cases ViewStack. There's no action or event defined in any of the child
>> views inside the Case Details TabNavigator that would switch the view that
>> way.
>>
>> That's why I find it confounding.
>>
>>
>>> If you put a breakpoint on code that does that, does it get hit and will
>>> the stack info show you how it got there?
>>>
>>
>> The code would be in the framework. It would just be the handler for a
>> click on the TabBar.
>>
>>
>>> The TabBar children should just be Tabs that dispatch events.  The logic
>>> that responds to the change event should be the main concern.
>>>
>>
>> Thanks. I understand that. But I'm not writing any code to react to the
>> click event. It's just the default action from the framework, which should
>> be to make the box corresponding to the Tab the selectedChild of the
>> TabNaviagator.
>>
>> I have tried walking through my ActionScript, and the oddity I see (which
>> I may not really understand) is that even after all the custom components
>> are added as children to one of the second-level TabNavigators, the
>> TabNavigator and its TabBar show in debugging as having a different number
>> of children.
>>
>>
>>
>> --
>> Thanks,
>>
>> Tom
>>
>> Tom McNeer
>> MediumCool
>> http://www.mediumcool.com
>> 1735 Johnson Road NE
>> Atlanta, GA 30306
>> 404.589.0560
>>
>>
>
>
> --
> Thanks,
>
> Tom
>
> Tom McNeer
> MediumCool
> http://www.mediumcool.com
> 1735 Johnson Road NE
> Atlanta, GA 30306
> 404.589.0560
>
>  
>



-- 
Thanks,

Tom

Tom McNeer
MediumCool
http://www.mediumcool.com
1735 Johnson Road NE
Atlanta, GA 30306
404.589.0560

Reply via email to