Understood. Thanks again.

On Wed, Jun 10, 2009 at 2:22 PM, Tim Hoff<[email protected]> wrote:
>
>
>
> Yeah, the control is specific for what I needed in GoogleMate (See
> FavoritesNavigation). It works for me, but your changes look fine. I
> suspect that you ran into a problem if the selectedIndex was -1. I
> should have accounted for that.
>
> -TH
>
> --- In [email protected], Richard Rodseth <rrods...@...> wrote:
>>
>> Actually, I was having some trouble using it with a bound
>> selectedIndex (and it didn't look as though GoogleMate was doing
>> that), so I made the following changes. Let me know what you think.
>>
>> Remove override of createNavItem.
>> Add:
>>
>> private var _selectedIndexChanged:Boolean; // Inherited one is private
>>
>> override protected function clickHandler(event:MouseEvent):void
>> {
>> super.clickHandler(event);
>>
>> var index:int = getChildIndex(Button(event.currentTarget));
>>
>> updateSelectionHighlighting(index);
>> }
>>
>> private function updateSelectionHighlighting(index:int):void {
>> // enable all
>> for (var i:int = 0; i < numChildren; i++)
>> {
>> if (getChildAt(i) is LinkButton)
>> {
>> enableLink( getChildAt(i) as LinkButton );
>> }
>> }
>>
>> // disable clicked link
>> enableLink( getChildAt(index) as LinkButton, false );
>> }
>>
>> /**
>> * enableLink
>> */
>> public function enableLink( link:LinkButton, enable:Boolean=true
> ):void
>> {
>> link.enabled = enable;
>> link.buttonMode = enable;
>> link.mouseEnabled = enable;
>> link.focusEnabled = false;
>> link.setStyle("textDecoration", (enable ? "underline" : "none") );
>> }
>>
>> override public function set selectedIndex(value:int):void {
>> _selectedIndexChanged = true;
>> super.selectedIndex = value;
>> }
>>
>> override protected function commitProperties():void
>> {
>> super.commitProperties();
>>
>> if (_selectedIndexChanged) {
>> _selectedIndexChanged = false;
>> this.updateSelectionHighlighting(this.selectedIndex);
>> }
>> }
>>
>>
>>
>> On Wed, Jun 10, 2009 at 1:44 PM, Tim hofftimh...@... wrote:
>> >
>> >
>> > Cool, here's the implementation:
>> >
>> > <controls:GMToggleLinkBar
>> >
>> > id="linkBar"
>> > labelField="label"
>> > tabChildren="false"
>> > focusEnabled="false"
>> > direction="vertical"
>> > selectedIndex="{ model.currentView }"
>> > dataProvider="{ model.navigationItems }"
>> > itemClick="model.navigateToItem( event )"/>
>> >
>> > -TH
>> >
>> > --- In [email protected], Richard Rodseth rrodseth@ wrote:
>> >>
>> >> Thanks, Tim. I'll take a look.
>> >>
>> >> On Wed, Jun 10, 2009 at 12:12 PM, Tim HoffTimHoff@ wrote:
>> >> >
>> >> >
>> >> > Hi Richard,
>> >> >
>> >> > Here's a ToggleLinkBar control that might suit your needs. Just
> set
>> >> > the
>> >> > selectedIndex of the control and you're good to go. I used an
> underline
>> >> > for
>> >> > the non-selected items, but you can take that out if you want.
>> >> >
>> >> > http://www.timothyhoff.com/misc/GMToggleLinkBar.as.html
>> >> >
>> >> > -TH
>> >> >
>> >> > --- In [email protected], Richard Rodseth rrodseth@
> wrote:
>> >> >>
>> >> >> Does anyone have a good solution to the problems alluded to in
> the
>> >> >> comments here:
>> >> >>
>> >> >>
>> >> >>
>> >> >>
> http://blog.flexexamples.com/2008/01/20/setting-the-selected-index-of-a-\
> flex-linkbar-control/
>> >> >>
>> >> >> and in some threads on FlexCoders.
>> >> >>
>> >> >> Namely that the visuals of a LinkBar do not work with a data
> provider
>> >> >> that's not a viewstack.
>> >> >>
>> >> >> Thanks.
>> >> >>
>> >> >
>> >>
>> >
>>
>
> 

Reply via email to