Re : Re : [flexcoders] Re: Problem extending TabNavigator class

2007-08-27 Thread ben.clinkinbeard
I think your scope is incorrect. Try this:

myButton.move(this.width-40, 0);


--- In flexcoders@yahoogroups.com, Benoit Thiebault <[EMAIL PROTECTED]> wrote:
>
> Yes, the code is the following :
> 
> override protected function updateDisplayList(w:Number, h:Number):void{
> 
> super.updateDisplayList(w,h);
> 
> updateButtonPosition();
> 
> }
> 
> public function updateButtonPosition():void
> {
> myButton.move(parent.width-40, 0);
> }
> 
> 
> 
> 
> - Message d'origine 
> De : ben.clinkinbeard <[EMAIL PROTECTED]>
> À : flexcoders@yahoogroups.com
> Envoyé le : Lundi, 27 Août 2007, 15h29mn 28s
> Objet : Re : [flexcoders] Re: Problem extending TabNavigator class
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
> 
> 
> 
> You should be setting its position every time
updateDisplayList( ) is
> 
> called. Are you doing that?
> 
> 
> 
> Ben
> 
> 
> 
> --- In [EMAIL PROTECTED] ups.com, Benoit Thiebault  wrote:
> 
> >
> 
> > I followed your advice and managed to position my button.
> 
> > 
> 
> > First of all, I extended the tabBar class instead of the
> 
> tabNavigator class. I added (via a rawChildren. addChild( ) method) my
> 
> button to the tabBar and overrid  the updateDisplayList( ) method to
> 
> place the button.
> 
> > The position of the button is relative to its parent (the TabBar).
> 
> The trick is that the TabBar width is null when you call the
> 
> createChildren( ) method, so you can't set the position of the button
> 
> in this method (which is what I did in the first place). But the
> 
> parent width is not null anymore when the updateDisplayList( ) method
> 
> is called.
> 
> > 
> 
> > I just have one problem left : my TabNavigator is placed in a Panel,
> 
> contained in an HDividedBox. The positionning of the button is perfect
> 
> at loading, but when I resize the HDividedBox, the positionning is not
> 
> updated... Is there another method I forgot to override ?
> 
> > 
> 
> > - Message d'origine 
> 
> > De : Benoit Thiebault 
> 
> > À : [EMAIL PROTECTED] ups.com
> 
> > Envoyé le : Vendredi, 24 Août 2007, 17h57mn 54s
> 
> > Objet : [flexcoders] Re: Problem extending TabNavigator class
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> >   
> 
> > 
> 
> > 
> 
> > 
> 
> > Hi Ben, and thank you for your answer :-)
> 
> > 
> 
> > 
> 
> > 
> 
> > You can see what I want to do on this picture
> 
> > 
> 
> > http://picasaweb. google.fr/ benoit.thiebault /AlbumSansTitre/
> 
> photo#5102289531 346166354
> 
> > 
> 
> > 
> 
> > 
> 
> > The button I want to add should not act like it's part of the existing
> 
> > 
> 
> > tabBar.
> 
> > 
> 
> > When the user clicks the button, it hides/shows the content of my
> 
> > 
> 
> > tabNavigator. In fact, it just toggles the height of the component to
> 
> > 
> 
> > make it appear or disappear (in that case, you can only see the
> 
> > 
> 
> > tabBar, not the viewstack underneath).
> 
> > 
> 
> > 
> 
> > 
> 
> > I tried to create just the button (without anything else than the
> 
> > 
> 
> > button: no HBox, no spacer, no tabs), but it didn't display
anything...
> 
> > 
> 
> > 
> 
> > 
> 
> > --- In [EMAIL PROTECTED] ups.com, "ben.clinkinbeard"
> 
> > 
> 
> >  wrote:
> 
> > 
> 
> > >
> 
> > 
> 
> > > Do you need your button to act like its part of the existing
tabBar in
> 
> > 
> 
> > > that it would deselect any active tab and vice versa? If not (and
> 
> > 
> 
> > > maybe even if you do with a workaround) you can avoid creating the
> 
> > 
> 
> > > HBox and Spacer and just create a button. super.createChildre n() is
> 
> > 
> 
> > > also usually the first line of your overridden function unless there
> 
> > 
> 
> > > is a specific reason not to do it that way.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > I would also do your positioning in an overridden
updateDisplayList as
> 
> > 
> 
> > > that is the "proper" place for positioning child components. I guess
> 
> > 
> 
> > > that may fall apart if you really need all the tabs to belong to a
> 
> > 
> 
> > > single tabBar, but I'm not sure. Sorry, these are all kind of just
> 
> > 
> 
> > > guesses as I've not worked with TabBar or Spacer at all. Is it
> 
> > 
> 
> > > possible your button is there but being pushed off of the screen?
> 
> > 
> 
> > > 
> 
> > 
> 
> > > HTH,
> 
> > 
> 
> > > Ben
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > --- In [EMAIL PROTECTED] ups.com, "Benoit Thiebault" 
> 
> wrote:
> 
> > 
> 
> > > >
> 
> > 
> 
> > > > Hi everyone !  [:)]
> 
> > 
> 
> > > > 
> 
> > 
> 
> > > > I need to extend the TabNavigator class in order to display a
> 
> tab bar
> 
> > 
> 
> > > > containing :
> 
> > 
> 
> > > > - tabs on the left (as usual)
> 
> > 
> 
> > > > - a button the user can click on the right
> 
> > 
> 
> > > > Of course, my button should stay on the right of the tab bar
> 
> whatever
> 
> > 
> 
> > > > the size of the TabBarNavigator
> 
> > 
> 
> > > > 
> 
> > 
> 
> > > > I didn't want to start from 

Re : Re : [flexcoders] Re: Problem extending TabNavigator class

2007-08-27 Thread Benoit Thiebault
Yes, the code is the following :

override protected function updateDisplayList(w:Number, h:Number):void{

super.updateDisplayList(w,h);

updateButtonPosition();

}

public function updateButtonPosition():void
{
myButton.move(parent.width-40, 0);
}




- Message d'origine 
De : ben.clinkinbeard <[EMAIL PROTECTED]>
À : flexcoders@yahoogroups.com
Envoyé le : Lundi, 27 Août 2007, 15h29mn 28s
Objet : Re : [flexcoders] Re: Problem extending TabNavigator class









  



You should be setting its position every time updateDisplayList( ) 
is

called. Are you doing that?



Ben



--- In [EMAIL PROTECTED] ups.com, Benoit Thiebault <[EMAIL PROTECTED] > wrote:

>

> I followed your advice and managed to position my button.

> 

> First of all, I extended the tabBar class instead of the

tabNavigator class. I added (via a rawChildren. addChild( ) method) my

button to the tabBar and overrid  the updateDisplayList( ) method to

place the button.

> The position of the button is relative to its parent (the TabBar).

The trick is that the TabBar width is null when you call the

createChildren( ) method, so you can't set the position of the button

in this method (which is what I did in the first place). But the

parent width is not null anymore when the updateDisplayList( ) method

is called.

> 

> I just have one problem left : my TabNavigator is placed in a Panel,

contained in an HDividedBox. The positionning of the button is perfect

at loading, but when I resize the HDividedBox, the positionning is not

updated... Is there another method I forgot to override ?

> 

> - Message d'origine 

> De : Benoit Thiebault <[EMAIL PROTECTED] >

> À : [EMAIL PROTECTED] ups.com

> Envoyé le : Vendredi, 24 Août 2007, 17h57mn 54s

> Objet : [flexcoders] Re: Problem extending TabNavigator class

> 

> 

> 

> 

> 

> 

> 

> 

> 

>   

> 

> 

> 

> Hi Ben, and thank you for your answer :-)

> 

> 

> 

> You can see what I want to do on this picture

> 

> http://picasaweb. google.fr/ benoit.thiebault /AlbumSansTitre/

photo#5102289531 346166354

> 

> 

> 

> The button I want to add should not act like it's part of the existing

> 

> tabBar.

> 

> When the user clicks the button, it hides/shows the content of my

> 

> tabNavigator. In fact, it just toggles the height of the component to

> 

> make it appear or disappear (in that case, you can only see the

> 

> tabBar, not the viewstack underneath).

> 

> 

> 

> I tried to create just the button (without anything else than the

> 

> button: no HBox, no spacer, no tabs), but it didn't display anything...

> 

> 

> 

> --- In [EMAIL PROTECTED] ups.com, "ben.clinkinbeard"

> 

>  wrote:

> 

> >

> 

> > Do you need your button to act like its part of the existing tabBar in

> 

> > that it would deselect any active tab and vice versa? If not (and

> 

> > maybe even if you do with a workaround) you can avoid creating the

> 

> > HBox and Spacer and just create a button. super.createChildre n() is

> 

> > also usually the first line of your overridden function unless there

> 

> > is a specific reason not to do it that way.

> 

> > 

> 

> > I would also do your positioning in an overridden updateDisplayList as

> 

> > that is the "proper" place for positioning child components. I guess

> 

> > that may fall apart if you really need all the tabs to belong to a

> 

> > single tabBar, but I'm not sure. Sorry, these are all kind of just

> 

> > guesses as I've not worked with TabBar or Spacer at all. Is it

> 

> > possible your button is there but being pushed off of the screen?

> 

> > 

> 

> > HTH,

> 

> > Ben

> 

> > 

> 

> > 

> 

> > --- In [EMAIL PROTECTED] ups.com, "Benoit Thiebault" 

wrote:

> 

> > >

> 

> > > Hi everyone !  [:)]

> 

> > > 

> 

> > > I need to extend the TabNavigator class in order to display a

tab bar

> 

> > > containing :

> 

> > > - tabs on the left (as usual)

> 

> > > - a button the user can click on the right

> 

> > > Of course, my button should stay on the right of the tab bar

whatever

> 

> > > the size of the TabBarNavigator

> 

> > > 

> 

> > > I didn't want to start from scratch, so I had a look at FlexLib

> 

> and its

> 

> > > great SuperTabNavigator. However, my tabNavigator is much more

simpler

> 

> > > than the SuperTabNavigator and I just wanted to extend one class :

> 

> > > TabNavigator. I tried this :

> 

> > > 

> 

> > > 

> 

> > > package extensions

> 

> > > {

> 

> > > import mx.containers. TabNavigator;

> 

> > > import mx.controls. TabBar;

> 

> > > import mx.controls. tabBarClasses. Tab;

> 

> > > import mx.core.mx_internal ;

> 

> > > import mx.core.IFlexDispla yObject;

> 

> > > import flash.display. DisplayObject;

> 

> > > import mx.controls. Button;

> 

> > > import mx.containers. HBox;

> 

> > > import mx.containers. Canvas;

> 

> > > import mx.controls. Spacer;

> 

> >