You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Sumudu Chinthaka <cs...@gmail.com> on 2013/12/17 14:44:50 UTC

Spark Button textAlign

Hi All

I want to crate a custom skin for a Spark button with textAlign to be set
to "left", but i found out there is a restriction set in Button class that
prevent accepting textAlign values

is there any way to override [Exclude(name="textAlign", kind="style")]
setting in Button subclass so that i can set this through css

or is there any alternative way to achieve this

Thanks
Sumudu

RE: Spark Button textAlign

Posted by Maurice Amsellem <ma...@systar.com>.
You're welcome.

-----Message d'origine-----
De : Sumudu Chinthaka [mailto:csumudu@gmail.com] 
Envoyé : mercredi 18 décembre 2013 13:17
À : users@flex.apache.org
Objet : Re: Spark Button textAlign

Thanks Thanks Thanks
It Works :-D


On Wed, Dec 18, 2013 at 5:39 PM, Sumudu Chinthaka <cs...@gmail.com> wrote:

> Thanks a Lot Maurice
> ill try that and keep you posted
>
>
> On Wed, Dec 18, 2013 at 5:22 PM, Maurice Amsellem < 
> maurice.amsellem@systar.com> wrote:
>
>> Ok, so Mobile ButtonSkin implementation is very different from 
>> desktop skin, that's why it's not working and why the previous 
>> advices don't stand, IMO.
>>
>> First of all,  "textAlign" style applies to the text *inside* its 
>> bounding box, not its parent bounding box.
>> - in desktop skin, the label takes all the width of the button, minus 
>> margins (left=10 right=10), so textAlign will have an effect.
>> - but in mobile skin, the label width is set to the actual width of 
>> text, so changing textAlign has not effect.
>>
>> Anyway, if you look/debug into mobile ButtonSkinBase, you will notice 
>> there is a protected variable called "useCenterAlignment" that is to 
>> true by default, and controls how the label is aligned.
>> Setting it to false, will align your label to the left.
>>
>> So you can simply override mobile ButtonSkin (not ButtonSkinBase) and 
>> set useCenterAlignment=false in the constructor.
>>
>> Regards,
>>
>> Maurice
>>
>>
>> -----Message d'origine-----
>> De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
>> Envoyé : mercredi 18 décembre 2013 10:17 À : users@flex.apache.org 
>> Objet : RE: Spark Button textAlign
>>
>> Ah, that was mobile, not desktop :-)
>>
>> I will look at it and get back to you...
>>
>> Maurice
>>
>> -----Message d'origine-----
>> De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18 
>> décembre 2013 09:57 À : users@flex.apache.org Objet : Re: Spark 
>> Button textAlign
>>
>> please find the link to the skin file
>>
>>
>> https://drive.google.com/file/d/0B_2mxcIbB40qeUZsQVJqZGR0aGs/edit?usp
>> =sharing
>>
>>
>>
>>
>> On Wed, Dec 18, 2013 at 12:33 PM, Maurice Amsellem < 
>> maurice.amsellem@systar.com> wrote:
>>
>> > Attachments are stripped by mailing list.
>> > Provide a public link, such as DropBox, or the like
>> >
>> > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 
>> > 18 décembre 2013 00:46 À : users@flex.apache.org Objet : Re: Spark 
>> > Button textAlign
>> >
>> > Really appreciate your advice but still i'm failing to get this 
>> > done
>> >
>> > i have copied ButtonSkin class and created MyButtonSkin class which 
>> > now extends from ButtonSkinBase and remove super.createChildren 
>> > call and include ButtonSkinBase createChildren content inside 
>> > MyButtonSkin createChildren content and set the textAlign property, 
>> > but with no luck
>> >
>> > i am attaching my Skin class here please please tell me what am i 
>> > doing wrong
>> >
>> > Thanks
>> > Sumudu
>> >
>> > On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem < 
>> > maurice.amsellem@systar.com<ma...@systar.com>> wrote:
>> > You can copy the default skin of course, like Evyatar suggests.
>> > That's the preferred solution.
>> >
>> > Regarding your initial approach of setting the textAlign style of 
>> > labelDisplay, it didn't work because it was done too early in 
>> > createChildren.
>> >
>> > If you do it after the components have been created, and their 
>> > properties /styles set, for example by overriding initialized() or 
>> > by adding a handler to creationComplete, then it will work.
>> >
>> >   override public function set initialized(value: Boolean): void {
>> >         super.initialized = value;
>> >        UIComponent( labelDisplay).setStyle("textAlign", "left");
>> >     }
>> >
>> > Maurice
>> >
>> > -----Message d'origine-----
>> > De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com<mailto:
>> > evyatarbh@gmail.com>]
>> > Envoyé : mardi 17 décembre 2013 21:14 À : 
>> > users@flex.apache.org<ma...@flex.apache.org>
>> > Objet : Re: Spark Button textAlign
>> >
>> > When you create a new skin (at least in Flash Builder) you can 
>> > start by creating a copy of the default skin.
>> > Just do that and on the Label MXML tag itself set the textAlign 
>> > property to left.
>> >
>> > Good luck,
>> > Evyatar
>> >
>> >
>> > On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka 
>> > <csumudu@gmail.com <ma...@gmail.com>> wrote:
>> >
>> > > i have created a skin class that extends 
>> > > spark.skins.mobile.ButtonSkin and set textAlign to be left in 
>> > > createChildren method but it does not work
>> > >
>> > > package skins
>> > > {
>> > > import spark.skins.mobile.ButtonSkin;  public class MyButtonSkin 
>> > > extends ButtonSkin { public function
>> > > MyButtonSkin() { super(); }  override protected function 
>> > > createChildren():void { super.createChildren(); 
>> > > labelDisplay.setStyle('textAlign','left');
>> > > }
>> > >  }
>> > > }
>> > >
>> > >
>> > > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem < 
>> > > maurice.amsellem@systar.com<ma...@systar.com>>
>> wrote:
>> > >
>> > > > What do you mean by custom skin?
>> > > > 1) Default skin customized through css styles (eg. textAlign)?
>> > > > 2) Completely new skin class ?
>> > > >
>> > > > Maurice
>> > > >
>> > > > -----Message d'origine-----
>> > > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com<mailto:
>> > csumudu@gmail.com>] Envoyé : mardi 17
>> > > > décembre 2013 14:45 À : users@flex.apache.org<mailto:
>> > users@flex.apache.org> Objet : Spark Button
>> > > > textAlign
>> > > >
>> > > > Hi All
>> > > >
>> > > > I want to crate a custom skin for a Spark button with textAlign 
>> > > > to be set to "left", but i found out there is a restriction set 
>> > > > in Button class
>> > > that
>> > > > prevent accepting textAlign values
>> > > >
>> > > > is there any way to override [Exclude(name="textAlign", 
>> > > > kind="style")] setting in Button subclass so that i can set 
>> > > > this through css
>> > > >
>> > > > or is there any alternative way to achieve this
>> > > >
>> > > > Thanks
>> > > > Sumudu
>> > > >
>> > >
>> >
>> >
>>
>
>

Re: Spark Button textAlign

Posted by Sumudu Chinthaka <cs...@gmail.com>.
Thanks Thanks Thanks
It Works :-D


On Wed, Dec 18, 2013 at 5:39 PM, Sumudu Chinthaka <cs...@gmail.com> wrote:

> Thanks a Lot Maurice
> ill try that and keep you posted
>
>
> On Wed, Dec 18, 2013 at 5:22 PM, Maurice Amsellem <
> maurice.amsellem@systar.com> wrote:
>
>> Ok, so Mobile ButtonSkin implementation is very different from desktop
>> skin, that's why it's not working and why the previous advices don't stand,
>> IMO.
>>
>> First of all,  "textAlign" style applies to the text *inside* its
>> bounding box, not its parent bounding box.
>> - in desktop skin, the label takes all the width of the button, minus
>> margins (left=10 right=10), so textAlign will have an effect.
>> - but in mobile skin, the label width is set to the actual width of text,
>> so changing textAlign has not effect.
>>
>> Anyway, if you look/debug into mobile ButtonSkinBase, you will notice
>> there is a protected variable called "useCenterAlignment" that is to true
>> by default, and controls how the label is aligned.
>> Setting it to false, will align your label to the left.
>>
>> So you can simply override mobile ButtonSkin (not ButtonSkinBase) and set
>> useCenterAlignment=false in the constructor.
>>
>> Regards,
>>
>> Maurice
>>
>>
>> -----Message d'origine-----
>> De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
>> Envoyé : mercredi 18 décembre 2013 10:17
>> À : users@flex.apache.org
>> Objet : RE: Spark Button textAlign
>>
>> Ah, that was mobile, not desktop :-)
>>
>> I will look at it and get back to you...
>>
>> Maurice
>>
>> -----Message d'origine-----
>> De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18
>> décembre 2013 09:57 À : users@flex.apache.org Objet : Re: Spark Button
>> textAlign
>>
>> please find the link to the skin file
>>
>>
>> https://drive.google.com/file/d/0B_2mxcIbB40qeUZsQVJqZGR0aGs/edit?usp=sharing
>>
>>
>>
>>
>> On Wed, Dec 18, 2013 at 12:33 PM, Maurice Amsellem <
>> maurice.amsellem@systar.com> wrote:
>>
>> > Attachments are stripped by mailing list.
>> > Provide a public link, such as DropBox, or the like
>> >
>> > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18
>> > décembre 2013 00:46 À : users@flex.apache.org Objet : Re: Spark Button
>> > textAlign
>> >
>> > Really appreciate your advice but still i'm failing to get this done
>> >
>> > i have copied ButtonSkin class and created MyButtonSkin class which
>> > now extends from ButtonSkinBase and remove super.createChildren call
>> > and include ButtonSkinBase createChildren content inside MyButtonSkin
>> > createChildren content and set the textAlign property, but with no
>> > luck
>> >
>> > i am attaching my Skin class here please please tell me what am i
>> > doing wrong
>> >
>> > Thanks
>> > Sumudu
>> >
>> > On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <
>> > maurice.amsellem@systar.com<ma...@systar.com>> wrote:
>> > You can copy the default skin of course, like Evyatar suggests.
>> > That's the preferred solution.
>> >
>> > Regarding your initial approach of setting the textAlign style of
>> > labelDisplay, it didn't work because it was done too early in
>> > createChildren.
>> >
>> > If you do it after the components have been created, and their
>> > properties /styles set, for example by overriding initialized() or by
>> > adding a handler to creationComplete, then it will work.
>> >
>> >   override public function set initialized(value: Boolean): void {
>> >         super.initialized = value;
>> >        UIComponent( labelDisplay).setStyle("textAlign", "left");
>> >     }
>> >
>> > Maurice
>> >
>> > -----Message d'origine-----
>> > De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com<mailto:
>> > evyatarbh@gmail.com>]
>> > Envoyé : mardi 17 décembre 2013 21:14
>> > À : users@flex.apache.org<ma...@flex.apache.org>
>> > Objet : Re: Spark Button textAlign
>> >
>> > When you create a new skin (at least in Flash Builder) you can start
>> > by creating a copy of the default skin.
>> > Just do that and on the Label MXML tag itself set the textAlign
>> > property to left.
>> >
>> > Good luck,
>> > Evyatar
>> >
>> >
>> > On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <csumudu@gmail.com
>> > <ma...@gmail.com>> wrote:
>> >
>> > > i have created a skin class that extends
>> > > spark.skins.mobile.ButtonSkin and set textAlign to be left in
>> > > createChildren method but it does not work
>> > >
>> > > package skins
>> > > {
>> > > import spark.skins.mobile.ButtonSkin;  public class MyButtonSkin
>> > > extends ButtonSkin { public function
>> > > MyButtonSkin() { super(); }  override protected function
>> > > createChildren():void { super.createChildren();
>> > > labelDisplay.setStyle('textAlign','left');
>> > > }
>> > >  }
>> > > }
>> > >
>> > >
>> > > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
>> > > maurice.amsellem@systar.com<ma...@systar.com>>
>> wrote:
>> > >
>> > > > What do you mean by custom skin?
>> > > > 1) Default skin customized through css styles (eg. textAlign)?
>> > > > 2) Completely new skin class ?
>> > > >
>> > > > Maurice
>> > > >
>> > > > -----Message d'origine-----
>> > > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com<mailto:
>> > csumudu@gmail.com>] Envoyé : mardi 17
>> > > > décembre 2013 14:45 À : users@flex.apache.org<mailto:
>> > users@flex.apache.org> Objet : Spark Button
>> > > > textAlign
>> > > >
>> > > > Hi All
>> > > >
>> > > > I want to crate a custom skin for a Spark button with textAlign to
>> > > > be set to "left", but i found out there is a restriction set in
>> > > > Button class
>> > > that
>> > > > prevent accepting textAlign values
>> > > >
>> > > > is there any way to override [Exclude(name="textAlign",
>> > > > kind="style")] setting in Button subclass so that i can set this
>> > > > through css
>> > > >
>> > > > or is there any alternative way to achieve this
>> > > >
>> > > > Thanks
>> > > > Sumudu
>> > > >
>> > >
>> >
>> >
>>
>
>

Re: Spark Button textAlign

Posted by Sumudu Chinthaka <cs...@gmail.com>.
Thanks a Lot Maurice
ill try that and keep you posted


On Wed, Dec 18, 2013 at 5:22 PM, Maurice Amsellem <
maurice.amsellem@systar.com> wrote:

> Ok, so Mobile ButtonSkin implementation is very different from desktop
> skin, that's why it's not working and why the previous advices don't stand,
> IMO.
>
> First of all,  "textAlign" style applies to the text *inside* its bounding
> box, not its parent bounding box.
> - in desktop skin, the label takes all the width of the button, minus
> margins (left=10 right=10), so textAlign will have an effect.
> - but in mobile skin, the label width is set to the actual width of text,
> so changing textAlign has not effect.
>
> Anyway, if you look/debug into mobile ButtonSkinBase, you will notice
> there is a protected variable called "useCenterAlignment" that is to true
> by default, and controls how the label is aligned.
> Setting it to false, will align your label to the left.
>
> So you can simply override mobile ButtonSkin (not ButtonSkinBase) and set
> useCenterAlignment=false in the constructor.
>
> Regards,
>
> Maurice
>
>
> -----Message d'origine-----
> De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
> Envoyé : mercredi 18 décembre 2013 10:17
> À : users@flex.apache.org
> Objet : RE: Spark Button textAlign
>
> Ah, that was mobile, not desktop :-)
>
> I will look at it and get back to you...
>
> Maurice
>
> -----Message d'origine-----
> De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18
> décembre 2013 09:57 À : users@flex.apache.org Objet : Re: Spark Button
> textAlign
>
> please find the link to the skin file
>
>
> https://drive.google.com/file/d/0B_2mxcIbB40qeUZsQVJqZGR0aGs/edit?usp=sharing
>
>
>
>
> On Wed, Dec 18, 2013 at 12:33 PM, Maurice Amsellem <
> maurice.amsellem@systar.com> wrote:
>
> > Attachments are stripped by mailing list.
> > Provide a public link, such as DropBox, or the like
> >
> > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18
> > décembre 2013 00:46 À : users@flex.apache.org Objet : Re: Spark Button
> > textAlign
> >
> > Really appreciate your advice but still i'm failing to get this done
> >
> > i have copied ButtonSkin class and created MyButtonSkin class which
> > now extends from ButtonSkinBase and remove super.createChildren call
> > and include ButtonSkinBase createChildren content inside MyButtonSkin
> > createChildren content and set the textAlign property, but with no
> > luck
> >
> > i am attaching my Skin class here please please tell me what am i
> > doing wrong
> >
> > Thanks
> > Sumudu
> >
> > On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <
> > maurice.amsellem@systar.com<ma...@systar.com>> wrote:
> > You can copy the default skin of course, like Evyatar suggests.
> > That's the preferred solution.
> >
> > Regarding your initial approach of setting the textAlign style of
> > labelDisplay, it didn't work because it was done too early in
> > createChildren.
> >
> > If you do it after the components have been created, and their
> > properties /styles set, for example by overriding initialized() or by
> > adding a handler to creationComplete, then it will work.
> >
> >   override public function set initialized(value: Boolean): void {
> >         super.initialized = value;
> >        UIComponent( labelDisplay).setStyle("textAlign", "left");
> >     }
> >
> > Maurice
> >
> > -----Message d'origine-----
> > De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com<mailto:
> > evyatarbh@gmail.com>]
> > Envoyé : mardi 17 décembre 2013 21:14
> > À : users@flex.apache.org<ma...@flex.apache.org>
> > Objet : Re: Spark Button textAlign
> >
> > When you create a new skin (at least in Flash Builder) you can start
> > by creating a copy of the default skin.
> > Just do that and on the Label MXML tag itself set the textAlign
> > property to left.
> >
> > Good luck,
> > Evyatar
> >
> >
> > On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <csumudu@gmail.com
> > <ma...@gmail.com>> wrote:
> >
> > > i have created a skin class that extends
> > > spark.skins.mobile.ButtonSkin and set textAlign to be left in
> > > createChildren method but it does not work
> > >
> > > package skins
> > > {
> > > import spark.skins.mobile.ButtonSkin;  public class MyButtonSkin
> > > extends ButtonSkin { public function
> > > MyButtonSkin() { super(); }  override protected function
> > > createChildren():void { super.createChildren();
> > > labelDisplay.setStyle('textAlign','left');
> > > }
> > >  }
> > > }
> > >
> > >
> > > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
> > > maurice.amsellem@systar.com<ma...@systar.com>>
> wrote:
> > >
> > > > What do you mean by custom skin?
> > > > 1) Default skin customized through css styles (eg. textAlign)?
> > > > 2) Completely new skin class ?
> > > >
> > > > Maurice
> > > >
> > > > -----Message d'origine-----
> > > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com<mailto:
> > csumudu@gmail.com>] Envoyé : mardi 17
> > > > décembre 2013 14:45 À : users@flex.apache.org<mailto:
> > users@flex.apache.org> Objet : Spark Button
> > > > textAlign
> > > >
> > > > Hi All
> > > >
> > > > I want to crate a custom skin for a Spark button with textAlign to
> > > > be set to "left", but i found out there is a restriction set in
> > > > Button class
> > > that
> > > > prevent accepting textAlign values
> > > >
> > > > is there any way to override [Exclude(name="textAlign",
> > > > kind="style")] setting in Button subclass so that i can set this
> > > > through css
> > > >
> > > > or is there any alternative way to achieve this
> > > >
> > > > Thanks
> > > > Sumudu
> > > >
> > >
> >
> >
>

RE: Spark Button textAlign

Posted by Maurice Amsellem <ma...@systar.com>.
Ok, so Mobile ButtonSkin implementation is very different from desktop skin, that's why it's not working and why the previous advices don't stand, IMO.

First of all,  "textAlign" style applies to the text *inside* its bounding box, not its parent bounding box.
- in desktop skin, the label takes all the width of the button, minus margins (left=10 right=10), so textAlign will have an effect.
- but in mobile skin, the label width is set to the actual width of text, so changing textAlign has not effect.

Anyway, if you look/debug into mobile ButtonSkinBase, you will notice there is a protected variable called "useCenterAlignment" that is to true by default, and controls how the label is aligned.
Setting it to false, will align your label to the left.

So you can simply override mobile ButtonSkin (not ButtonSkinBase) and set useCenterAlignment=false in the constructor.

Regards,

Maurice 


-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Envoyé : mercredi 18 décembre 2013 10:17
À : users@flex.apache.org
Objet : RE: Spark Button textAlign

Ah, that was mobile, not desktop :-)

I will look at it and get back to you...

Maurice 

-----Message d'origine-----
De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18 décembre 2013 09:57 À : users@flex.apache.org Objet : Re: Spark Button textAlign

please find the link to the skin file

https://drive.google.com/file/d/0B_2mxcIbB40qeUZsQVJqZGR0aGs/edit?usp=sharing




On Wed, Dec 18, 2013 at 12:33 PM, Maurice Amsellem < maurice.amsellem@systar.com> wrote:

> Attachments are stripped by mailing list.
> Provide a public link, such as DropBox, or the like
>
> De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18 
> décembre 2013 00:46 À : users@flex.apache.org Objet : Re: Spark Button 
> textAlign
>
> Really appreciate your advice but still i'm failing to get this done
>
> i have copied ButtonSkin class and created MyButtonSkin class which 
> now extends from ButtonSkinBase and remove super.createChildren call 
> and include ButtonSkinBase createChildren content inside MyButtonSkin 
> createChildren content and set the textAlign property, but with no 
> luck
>
> i am attaching my Skin class here please please tell me what am i 
> doing wrong
>
> Thanks
> Sumudu
>
> On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem < 
> maurice.amsellem@systar.com<ma...@systar.com>> wrote:
> You can copy the default skin of course, like Evyatar suggests.  
> That's the preferred solution.
>
> Regarding your initial approach of setting the textAlign style of 
> labelDisplay, it didn't work because it was done too early in 
> createChildren.
>
> If you do it after the components have been created, and their 
> properties /styles set, for example by overriding initialized() or by 
> adding a handler to creationComplete, then it will work.
>
>   override public function set initialized(value: Boolean): void {
>         super.initialized = value;
>        UIComponent( labelDisplay).setStyle("textAlign", "left");
>     }
>
> Maurice
>
> -----Message d'origine-----
> De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com<mailto:
> evyatarbh@gmail.com>]
> Envoyé : mardi 17 décembre 2013 21:14
> À : users@flex.apache.org<ma...@flex.apache.org>
> Objet : Re: Spark Button textAlign
>
> When you create a new skin (at least in Flash Builder) you can start 
> by creating a copy of the default skin.
> Just do that and on the Label MXML tag itself set the textAlign 
> property to left.
>
> Good luck,
> Evyatar
>
>
> On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <csumudu@gmail.com 
> <ma...@gmail.com>> wrote:
>
> > i have created a skin class that extends 
> > spark.skins.mobile.ButtonSkin and set textAlign to be left in 
> > createChildren method but it does not work
> >
> > package skins
> > {
> > import spark.skins.mobile.ButtonSkin;  public class MyButtonSkin 
> > extends ButtonSkin { public function
> > MyButtonSkin() { super(); }  override protected function 
> > createChildren():void { super.createChildren(); 
> > labelDisplay.setStyle('textAlign','left');
> > }
> >  }
> > }
> >
> >
> > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem < 
> > maurice.amsellem@systar.com<ma...@systar.com>> wrote:
> >
> > > What do you mean by custom skin?
> > > 1) Default skin customized through css styles (eg. textAlign)?
> > > 2) Completely new skin class ?
> > >
> > > Maurice
> > >
> > > -----Message d'origine-----
> > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com<mailto:
> csumudu@gmail.com>] Envoyé : mardi 17
> > > décembre 2013 14:45 À : users@flex.apache.org<mailto:
> users@flex.apache.org> Objet : Spark Button
> > > textAlign
> > >
> > > Hi All
> > >
> > > I want to crate a custom skin for a Spark button with textAlign to 
> > > be set to "left", but i found out there is a restriction set in 
> > > Button class
> > that
> > > prevent accepting textAlign values
> > >
> > > is there any way to override [Exclude(name="textAlign", 
> > > kind="style")] setting in Button subclass so that i can set this 
> > > through css
> > >
> > > or is there any alternative way to achieve this
> > >
> > > Thanks
> > > Sumudu
> > >
> >
>
>

RE: Spark Button textAlign

Posted by Maurice Amsellem <ma...@systar.com>.
Ah, that was mobile, not desktop :-)

I will look at it and get back to you...

Maurice 

-----Message d'origine-----
De : Sumudu Chinthaka [mailto:csumudu@gmail.com] 
Envoyé : mercredi 18 décembre 2013 09:57
À : users@flex.apache.org
Objet : Re: Spark Button textAlign

please find the link to the skin file

https://drive.google.com/file/d/0B_2mxcIbB40qeUZsQVJqZGR0aGs/edit?usp=sharing




On Wed, Dec 18, 2013 at 12:33 PM, Maurice Amsellem < maurice.amsellem@systar.com> wrote:

> Attachments are stripped by mailing list.
> Provide a public link, such as DropBox, or the like
>
> De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mercredi 18 
> décembre 2013 00:46 À : users@flex.apache.org Objet : Re: Spark Button 
> textAlign
>
> Really appreciate your advice but still i'm failing to get this done
>
> i have copied ButtonSkin class and created MyButtonSkin class which 
> now extends from ButtonSkinBase and remove super.createChildren call 
> and include ButtonSkinBase createChildren content inside MyButtonSkin 
> createChildren content and set the textAlign property, but with no 
> luck
>
> i am attaching my Skin class here please please tell me what am i 
> doing wrong
>
> Thanks
> Sumudu
>
> On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem < 
> maurice.amsellem@systar.com<ma...@systar.com>> wrote:
> You can copy the default skin of course, like Evyatar suggests.  
> That's the preferred solution.
>
> Regarding your initial approach of setting the textAlign style of 
> labelDisplay, it didn't work because it was done too early in 
> createChildren.
>
> If you do it after the components have been created, and their 
> properties /styles set, for example by overriding initialized() or by 
> adding a handler to creationComplete, then it will work.
>
>   override public function set initialized(value: Boolean): void {
>         super.initialized = value;
>        UIComponent( labelDisplay).setStyle("textAlign", "left");
>     }
>
> Maurice
>
> -----Message d'origine-----
> De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com<mailto:
> evyatarbh@gmail.com>]
> Envoyé : mardi 17 décembre 2013 21:14
> À : users@flex.apache.org<ma...@flex.apache.org>
> Objet : Re: Spark Button textAlign
>
> When you create a new skin (at least in Flash Builder) you can start 
> by creating a copy of the default skin.
> Just do that and on the Label MXML tag itself set the textAlign 
> property to left.
>
> Good luck,
> Evyatar
>
>
> On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <csumudu@gmail.com 
> <ma...@gmail.com>> wrote:
>
> > i have created a skin class that extends 
> > spark.skins.mobile.ButtonSkin and set textAlign to be left in 
> > createChildren method but it does not work
> >
> > package skins
> > {
> > import spark.skins.mobile.ButtonSkin;  public class MyButtonSkin 
> > extends ButtonSkin { public function
> > MyButtonSkin() { super(); }  override protected function 
> > createChildren():void { super.createChildren(); 
> > labelDisplay.setStyle('textAlign','left');
> > }
> >  }
> > }
> >
> >
> > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem < 
> > maurice.amsellem@systar.com<ma...@systar.com>> wrote:
> >
> > > What do you mean by custom skin?
> > > 1) Default skin customized through css styles (eg. textAlign)?
> > > 2) Completely new skin class ?
> > >
> > > Maurice
> > >
> > > -----Message d'origine-----
> > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com<mailto:
> csumudu@gmail.com>] Envoyé : mardi 17
> > > décembre 2013 14:45 À : users@flex.apache.org<mailto:
> users@flex.apache.org> Objet : Spark Button
> > > textAlign
> > >
> > > Hi All
> > >
> > > I want to crate a custom skin for a Spark button with textAlign to 
> > > be set to "left", but i found out there is a restriction set in 
> > > Button class
> > that
> > > prevent accepting textAlign values
> > >
> > > is there any way to override [Exclude(name="textAlign", 
> > > kind="style")] setting in Button subclass so that i can set this 
> > > through css
> > >
> > > or is there any alternative way to achieve this
> > >
> > > Thanks
> > > Sumudu
> > >
> >
>
>

Re: Spark Button textAlign

Posted by Sumudu Chinthaka <cs...@gmail.com>.
please find the link to the skin file

https://drive.google.com/file/d/0B_2mxcIbB40qeUZsQVJqZGR0aGs/edit?usp=sharing




On Wed, Dec 18, 2013 at 12:33 PM, Maurice Amsellem <
maurice.amsellem@systar.com> wrote:

> Attachments are stripped by mailing list.
> Provide a public link, such as DropBox, or the like
>
> De : Sumudu Chinthaka [mailto:csumudu@gmail.com]
> Envoyé : mercredi 18 décembre 2013 00:46
> À : users@flex.apache.org
> Objet : Re: Spark Button textAlign
>
> Really appreciate your advice but still i'm failing to get this done
>
> i have copied ButtonSkin class and created MyButtonSkin class which now
> extends from ButtonSkinBase and remove super.createChildren call and
> include ButtonSkinBase createChildren content inside MyButtonSkin
> createChildren content
> and set the textAlign property, but with no luck
>
> i am attaching my Skin class here please please tell me what am i doing
> wrong
>
> Thanks
> Sumudu
>
> On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <
> maurice.amsellem@systar.com<ma...@systar.com>> wrote:
> You can copy the default skin of course, like Evyatar suggests.  That's
> the preferred solution.
>
> Regarding your initial approach of setting the textAlign style of
> labelDisplay, it didn't work because it was done too early in
> createChildren.
>
> If you do it after the components have been created, and their properties
> /styles set,
> for example by overriding initialized() or by adding a handler to
> creationComplete, then it will work.
>
>   override public function set initialized(value: Boolean): void {
>         super.initialized = value;
>        UIComponent( labelDisplay).setStyle("textAlign", "left");
>     }
>
> Maurice
>
> -----Message d'origine-----
> De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com<mailto:
> evyatarbh@gmail.com>]
> Envoyé : mardi 17 décembre 2013 21:14
> À : users@flex.apache.org<ma...@flex.apache.org>
> Objet : Re: Spark Button textAlign
>
> When you create a new skin (at least in Flash Builder) you can start by
> creating a copy of the default skin.
> Just do that and on the Label MXML tag itself set the textAlign property
> to left.
>
> Good luck,
> Evyatar
>
>
> On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <csumudu@gmail.com
> <ma...@gmail.com>> wrote:
>
> > i have created a skin class that extends spark.skins.mobile.ButtonSkin
> > and set textAlign to be left in createChildren method but it does not
> > work
> >
> > package skins
> > {
> > import spark.skins.mobile.ButtonSkin;
> >  public class MyButtonSkin extends ButtonSkin { public function
> > MyButtonSkin() { super(); }  override protected function
> > createChildren():void { super.createChildren();
> > labelDisplay.setStyle('textAlign','left');
> > }
> >  }
> > }
> >
> >
> > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
> > maurice.amsellem@systar.com<ma...@systar.com>> wrote:
> >
> > > What do you mean by custom skin?
> > > 1) Default skin customized through css styles (eg. textAlign)?
> > > 2) Completely new skin class ?
> > >
> > > Maurice
> > >
> > > -----Message d'origine-----
> > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com<mailto:
> csumudu@gmail.com>] Envoyé : mardi 17
> > > décembre 2013 14:45 À : users@flex.apache.org<mailto:
> users@flex.apache.org> Objet : Spark Button
> > > textAlign
> > >
> > > Hi All
> > >
> > > I want to crate a custom skin for a Spark button with textAlign to
> > > be set to "left", but i found out there is a restriction set in
> > > Button class
> > that
> > > prevent accepting textAlign values
> > >
> > > is there any way to override [Exclude(name="textAlign",
> > > kind="style")] setting in Button subclass so that i can set this
> > > through css
> > >
> > > or is there any alternative way to achieve this
> > >
> > > Thanks
> > > Sumudu
> > >
> >
>
>

RE: Spark Button textAlign

Posted by Maurice Amsellem <ma...@systar.com>.
Attachments are stripped by mailing list.
Provide a public link, such as DropBox, or the like

De : Sumudu Chinthaka [mailto:csumudu@gmail.com]
Envoyé : mercredi 18 décembre 2013 00:46
À : users@flex.apache.org
Objet : Re: Spark Button textAlign

Really appreciate your advice but still i'm failing to get this done

i have copied ButtonSkin class and created MyButtonSkin class which now extends from ButtonSkinBase and remove super.createChildren call and include ButtonSkinBase createChildren content inside MyButtonSkin createChildren content
and set the textAlign property, but with no luck

i am attaching my Skin class here please please tell me what am i doing wrong

Thanks
Sumudu

On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <ma...@systar.com>> wrote:
You can copy the default skin of course, like Evyatar suggests.  That's the preferred solution.

Regarding your initial approach of setting the textAlign style of labelDisplay, it didn't work because it was done too early in createChildren.

If you do it after the components have been created, and their properties /styles set,
for example by overriding initialized() or by adding a handler to creationComplete, then it will work.

  override public function set initialized(value: Boolean): void {
        super.initialized = value;
       UIComponent( labelDisplay).setStyle("textAlign", "left");
    }

Maurice

-----Message d'origine-----
De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com<ma...@gmail.com>]
Envoyé : mardi 17 décembre 2013 21:14
À : users@flex.apache.org<ma...@flex.apache.org>
Objet : Re: Spark Button textAlign

When you create a new skin (at least in Flash Builder) you can start by creating a copy of the default skin.
Just do that and on the Label MXML tag itself set the textAlign property to left.

Good luck,
Evyatar


On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <cs...@gmail.com>> wrote:

> i have created a skin class that extends spark.skins.mobile.ButtonSkin
> and set textAlign to be left in createChildren method but it does not
> work
>
> package skins
> {
> import spark.skins.mobile.ButtonSkin;
>  public class MyButtonSkin extends ButtonSkin { public function
> MyButtonSkin() { super(); }  override protected function
> createChildren():void { super.createChildren();
> labelDisplay.setStyle('textAlign','left');
> }
>  }
> }
>
>
> On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
> maurice.amsellem@systar.com<ma...@systar.com>> wrote:
>
> > What do you mean by custom skin?
> > 1) Default skin customized through css styles (eg. textAlign)?
> > 2) Completely new skin class ?
> >
> > Maurice
> >
> > -----Message d'origine-----
> > De : Sumudu Chinthaka [mailto:csumudu@gmail.com<ma...@gmail.com>] Envoyé : mardi 17
> > décembre 2013 14:45 À : users@flex.apache.org<ma...@flex.apache.org> Objet : Spark Button
> > textAlign
> >
> > Hi All
> >
> > I want to crate a custom skin for a Spark button with textAlign to
> > be set to "left", but i found out there is a restriction set in
> > Button class
> that
> > prevent accepting textAlign values
> >
> > is there any way to override [Exclude(name="textAlign",
> > kind="style")] setting in Button subclass so that i can set this
> > through css
> >
> > or is there any alternative way to achieve this
> >
> > Thanks
> > Sumudu
> >
>


Re: Spark Button textAlign

Posted by Sumudu Chinthaka <cs...@gmail.com>.
Hi Devesh

since this is for a Mobile Application i don't want to use MXML skinning and
i would like to create the skin using AS. but when i take ButtonSkin class
there is no label there
it has a labelDisplay which is a StyleableTextField.

what i want to do is to find a way to set textAlign on this labelDisplay,
by default it shows
center align.

Thanks
Sumudu



On Wed, Dec 18, 2013 at 10:21 AM, Devesh Mishra <De...@mastek.com>wrote:

> Hi Sumudu,
>
> I am completely agree with Evyatar what he has said. Even I have done the
> same and it's working fine.
>
> -----Original Message-----
> From: Sumudu Chinthaka [mailto:csumudu@gmail.com]
> Sent: 18 December 2013 06:18
> To: users@flex.apache.org
> Subject: Re: Spark Button textAlign
>
> also i have notice if i set 'color' 'fontSize' it works but textAlign does
> not work
> and in Button Class i can see [Exclude(name="textAlign", kind="style")]
>
> does it have anything to do with my problem
>
>
> On Wed, Dec 18, 2013 at 5:15 AM, Sumudu Chinthaka <cs...@gmail.com>
> wrote:
>
> > Really appreciate your advice but still i'm failing to get this done
> >
> > i have copied ButtonSkin class and created MyButtonSkin class which now
> > extends from ButtonSkinBase and remove super.createChildren call and
> > include ButtonSkinBase createChildren content inside
> > MyButtonSkin createChildren content
> > and set the textAlign property, but with no luck
> >
> > i am attaching my Skin class here please please tell me what am i doing
> > wrong
> >
> > Thanks
> > Sumudu
> >
> >
> > On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <
> > maurice.amsellem@systar.com> wrote:
> >
> >> You can copy the default skin of course, like Evyatar suggests.  That's
> >> the preferred solution.
> >>
> >> Regarding your initial approach of setting the textAlign style of
> >> labelDisplay, it didn't work because it was done too early in
> >> createChildren.
> >>
> >> If you do it after the components have been created, and their
> properties
> >> /styles set,
> >> for example by overriding initialized() or by adding a handler to
> >> creationComplete, then it will work.
> >>
> >>   override public function set initialized(value: Boolean): void {
> >>         super.initialized = value;
> >>        UIComponent( labelDisplay).setStyle("textAlign", "left");
> >>     }
> >>
> >> Maurice
> >>
> >> -----Message d'origine-----
> >> De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com]
> >> Envoyé : mardi 17 décembre 2013 21:14
> >> À : users@flex.apache.org
> >> Objet : Re: Spark Button textAlign
> >>
> >> When you create a new skin (at least in Flash Builder) you can start by
> >> creating a copy of the default skin.
> >> Just do that and on the Label MXML tag itself set the textAlign property
> >> to left.
> >>
> >> Good luck,
> >> Evyatar
> >>
> >>
> >> On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <cs...@gmail.com>
> >> wrote:
> >>
> >> > i have created a skin class that extends spark.skins.mobile.ButtonSkin
> >> > and set textAlign to be left in createChildren method but it does not
> >> > work
> >> >
> >> > package skins
> >> > {
> >> > import spark.skins.mobile.ButtonSkin;
> >> >  public class MyButtonSkin extends ButtonSkin { public function
> >> > MyButtonSkin() { super(); }  override protected function
> >> > createChildren():void { super.createChildren();
> >> > labelDisplay.setStyle('textAlign','left');
> >> > }
> >> >  }
> >> > }
> >> >
> >> >
> >> > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
> >> > maurice.amsellem@systar.com> wrote:
> >> >
> >> > > What do you mean by custom skin?
> >> > > 1) Default skin customized through css styles (eg. textAlign)?
> >> > > 2) Completely new skin class ?
> >> > >
> >> > > Maurice
> >> > >
> >> > > -----Message d'origine-----
> >> > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mardi 17
> >> > > décembre 2013 14:45 À : users@flex.apache.org Objet : Spark Button
> >> > > textAlign
> >> > >
> >> > > Hi All
> >> > >
> >> > > I want to crate a custom skin for a Spark button with textAlign to
> >> > > be set to "left", but i found out there is a restriction set in
> >> > > Button class
> >> > that
> >> > > prevent accepting textAlign values
> >> > >
> >> > > is there any way to override [Exclude(name="textAlign",
> >> > > kind="style")] setting in Button subclass so that i can set this
> >> > > through css
> >> > >
> >> > > or is there any alternative way to achieve this
> >> > >
> >> > > Thanks
> >> > > Sumudu
> >> > >
> >> >
> >>
> >
> >
> MASTEK LTD.
> In the US, we're called MAJESCOMASTEK
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Opinions expressed in this e-mail are those of the individual and not that
> of Mastek Limited, unless specifically indicated to that effect. Mastek
> Limited does not accept any responsibility or liability for it. This e-mail
> and attachments (if any) transmitted with it are confidential and/or
> privileged and solely for the use of the intended person or entity to which
> it is addressed. Any review, re-transmission, dissemination or other use of
> or taking of any action in reliance upon this information by persons or
> entities other than the intended recipient is prohibited. This e-mail and
> its attachments have been scanned for the presence of computer viruses. It
> is the responsibility of the recipient to run the virus check on e-mails
> and attachments before opening them. If you have received this e-mail in
> error, kindly delete this e-mail from desktop and server.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>

RE: Spark Button textAlign

Posted by Devesh Mishra <De...@mastek.com>.
Hi Sumudu,

I am completely agree with Evyatar what he has said. Even I have done the same and it's working fine.

-----Original Message-----
From: Sumudu Chinthaka [mailto:csumudu@gmail.com] 
Sent: 18 December 2013 06:18
To: users@flex.apache.org
Subject: Re: Spark Button textAlign

also i have notice if i set 'color' 'fontSize' it works but textAlign does
not work
and in Button Class i can see [Exclude(name="textAlign", kind="style")]

does it have anything to do with my problem


On Wed, Dec 18, 2013 at 5:15 AM, Sumudu Chinthaka <cs...@gmail.com> wrote:

> Really appreciate your advice but still i'm failing to get this done
>
> i have copied ButtonSkin class and created MyButtonSkin class which now
> extends from ButtonSkinBase and remove super.createChildren call and
> include ButtonSkinBase createChildren content inside
> MyButtonSkin createChildren content
> and set the textAlign property, but with no luck
>
> i am attaching my Skin class here please please tell me what am i doing
> wrong
>
> Thanks
> Sumudu
>
>
> On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <
> maurice.amsellem@systar.com> wrote:
>
>> You can copy the default skin of course, like Evyatar suggests.  That's
>> the preferred solution.
>>
>> Regarding your initial approach of setting the textAlign style of
>> labelDisplay, it didn't work because it was done too early in
>> createChildren.
>>
>> If you do it after the components have been created, and their properties
>> /styles set,
>> for example by overriding initialized() or by adding a handler to
>> creationComplete, then it will work.
>>
>>   override public function set initialized(value: Boolean): void {
>>         super.initialized = value;
>>        UIComponent( labelDisplay).setStyle("textAlign", "left");
>>     }
>>
>> Maurice
>>
>> -----Message d'origine-----
>> De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com]
>> Envoyé : mardi 17 décembre 2013 21:14
>> À : users@flex.apache.org
>> Objet : Re: Spark Button textAlign
>>
>> When you create a new skin (at least in Flash Builder) you can start by
>> creating a copy of the default skin.
>> Just do that and on the Label MXML tag itself set the textAlign property
>> to left.
>>
>> Good luck,
>> Evyatar
>>
>>
>> On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <cs...@gmail.com>
>> wrote:
>>
>> > i have created a skin class that extends spark.skins.mobile.ButtonSkin
>> > and set textAlign to be left in createChildren method but it does not
>> > work
>> >
>> > package skins
>> > {
>> > import spark.skins.mobile.ButtonSkin;
>> >  public class MyButtonSkin extends ButtonSkin { public function
>> > MyButtonSkin() { super(); }  override protected function
>> > createChildren():void { super.createChildren();
>> > labelDisplay.setStyle('textAlign','left');
>> > }
>> >  }
>> > }
>> >
>> >
>> > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
>> > maurice.amsellem@systar.com> wrote:
>> >
>> > > What do you mean by custom skin?
>> > > 1) Default skin customized through css styles (eg. textAlign)?
>> > > 2) Completely new skin class ?
>> > >
>> > > Maurice
>> > >
>> > > -----Message d'origine-----
>> > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mardi 17
>> > > décembre 2013 14:45 À : users@flex.apache.org Objet : Spark Button
>> > > textAlign
>> > >
>> > > Hi All
>> > >
>> > > I want to crate a custom skin for a Spark button with textAlign to
>> > > be set to "left", but i found out there is a restriction set in
>> > > Button class
>> > that
>> > > prevent accepting textAlign values
>> > >
>> > > is there any way to override [Exclude(name="textAlign",
>> > > kind="style")] setting in Button subclass so that i can set this
>> > > through css
>> > >
>> > > or is there any alternative way to achieve this
>> > >
>> > > Thanks
>> > > Sumudu
>> > >
>> >
>>
>
>
MASTEK LTD.
In the US, we're called MAJESCOMASTEK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from desktop and server.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Re: Spark Button textAlign

Posted by Sumudu Chinthaka <cs...@gmail.com>.
also i have notice if i set 'color' 'fontSize' it works but textAlign does
not work
and in Button Class i can see [Exclude(name="textAlign", kind="style")]

does it have anything to do with my problem


On Wed, Dec 18, 2013 at 5:15 AM, Sumudu Chinthaka <cs...@gmail.com> wrote:

> Really appreciate your advice but still i'm failing to get this done
>
> i have copied ButtonSkin class and created MyButtonSkin class which now
> extends from ButtonSkinBase and remove super.createChildren call and
> include ButtonSkinBase createChildren content inside
> MyButtonSkin createChildren content
> and set the textAlign property, but with no luck
>
> i am attaching my Skin class here please please tell me what am i doing
> wrong
>
> Thanks
> Sumudu
>
>
> On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <
> maurice.amsellem@systar.com> wrote:
>
>> You can copy the default skin of course, like Evyatar suggests.  That's
>> the preferred solution.
>>
>> Regarding your initial approach of setting the textAlign style of
>> labelDisplay, it didn't work because it was done too early in
>> createChildren.
>>
>> If you do it after the components have been created, and their properties
>> /styles set,
>> for example by overriding initialized() or by adding a handler to
>> creationComplete, then it will work.
>>
>>   override public function set initialized(value: Boolean): void {
>>         super.initialized = value;
>>        UIComponent( labelDisplay).setStyle("textAlign", "left");
>>     }
>>
>> Maurice
>>
>> -----Message d'origine-----
>> De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com]
>> Envoyé : mardi 17 décembre 2013 21:14
>> À : users@flex.apache.org
>> Objet : Re: Spark Button textAlign
>>
>> When you create a new skin (at least in Flash Builder) you can start by
>> creating a copy of the default skin.
>> Just do that and on the Label MXML tag itself set the textAlign property
>> to left.
>>
>> Good luck,
>> Evyatar
>>
>>
>> On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <cs...@gmail.com>
>> wrote:
>>
>> > i have created a skin class that extends spark.skins.mobile.ButtonSkin
>> > and set textAlign to be left in createChildren method but it does not
>> > work
>> >
>> > package skins
>> > {
>> > import spark.skins.mobile.ButtonSkin;
>> >  public class MyButtonSkin extends ButtonSkin { public function
>> > MyButtonSkin() { super(); }  override protected function
>> > createChildren():void { super.createChildren();
>> > labelDisplay.setStyle('textAlign','left');
>> > }
>> >  }
>> > }
>> >
>> >
>> > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
>> > maurice.amsellem@systar.com> wrote:
>> >
>> > > What do you mean by custom skin?
>> > > 1) Default skin customized through css styles (eg. textAlign)?
>> > > 2) Completely new skin class ?
>> > >
>> > > Maurice
>> > >
>> > > -----Message d'origine-----
>> > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mardi 17
>> > > décembre 2013 14:45 À : users@flex.apache.org Objet : Spark Button
>> > > textAlign
>> > >
>> > > Hi All
>> > >
>> > > I want to crate a custom skin for a Spark button with textAlign to
>> > > be set to "left", but i found out there is a restriction set in
>> > > Button class
>> > that
>> > > prevent accepting textAlign values
>> > >
>> > > is there any way to override [Exclude(name="textAlign",
>> > > kind="style")] setting in Button subclass so that i can set this
>> > > through css
>> > >
>> > > or is there any alternative way to achieve this
>> > >
>> > > Thanks
>> > > Sumudu
>> > >
>> >
>>
>
>

Re: Spark Button textAlign

Posted by Sumudu Chinthaka <cs...@gmail.com>.
Really appreciate your advice but still i'm failing to get this done

i have copied ButtonSkin class and created MyButtonSkin class which now
extends from ButtonSkinBase and remove super.createChildren call and
include ButtonSkinBase createChildren content inside
MyButtonSkin createChildren content
and set the textAlign property, but with no luck

i am attaching my Skin class here please please tell me what am i doing
wrong

Thanks
Sumudu


On Wed, Dec 18, 2013 at 4:37 AM, Maurice Amsellem <
maurice.amsellem@systar.com> wrote:

> You can copy the default skin of course, like Evyatar suggests.  That's
> the preferred solution.
>
> Regarding your initial approach of setting the textAlign style of
> labelDisplay, it didn't work because it was done too early in
> createChildren.
>
> If you do it after the components have been created, and their properties
> /styles set,
> for example by overriding initialized() or by adding a handler to
> creationComplete, then it will work.
>
>   override public function set initialized(value: Boolean): void {
>         super.initialized = value;
>        UIComponent( labelDisplay).setStyle("textAlign", "left");
>     }
>
> Maurice
>
> -----Message d'origine-----
> De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com]
> Envoyé : mardi 17 décembre 2013 21:14
> À : users@flex.apache.org
> Objet : Re: Spark Button textAlign
>
> When you create a new skin (at least in Flash Builder) you can start by
> creating a copy of the default skin.
> Just do that and on the Label MXML tag itself set the textAlign property
> to left.
>
> Good luck,
> Evyatar
>
>
> On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <cs...@gmail.com>
> wrote:
>
> > i have created a skin class that extends spark.skins.mobile.ButtonSkin
> > and set textAlign to be left in createChildren method but it does not
> > work
> >
> > package skins
> > {
> > import spark.skins.mobile.ButtonSkin;
> >  public class MyButtonSkin extends ButtonSkin { public function
> > MyButtonSkin() { super(); }  override protected function
> > createChildren():void { super.createChildren();
> > labelDisplay.setStyle('textAlign','left');
> > }
> >  }
> > }
> >
> >
> > On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
> > maurice.amsellem@systar.com> wrote:
> >
> > > What do you mean by custom skin?
> > > 1) Default skin customized through css styles (eg. textAlign)?
> > > 2) Completely new skin class ?
> > >
> > > Maurice
> > >
> > > -----Message d'origine-----
> > > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mardi 17
> > > décembre 2013 14:45 À : users@flex.apache.org Objet : Spark Button
> > > textAlign
> > >
> > > Hi All
> > >
> > > I want to crate a custom skin for a Spark button with textAlign to
> > > be set to "left", but i found out there is a restriction set in
> > > Button class
> > that
> > > prevent accepting textAlign values
> > >
> > > is there any way to override [Exclude(name="textAlign",
> > > kind="style")] setting in Button subclass so that i can set this
> > > through css
> > >
> > > or is there any alternative way to achieve this
> > >
> > > Thanks
> > > Sumudu
> > >
> >
>

RE: Spark Button textAlign

Posted by Maurice Amsellem <ma...@systar.com>.
You can copy the default skin of course, like Evyatar suggests.  That's the preferred solution.

Regarding your initial approach of setting the textAlign style of labelDisplay, it didn't work because it was done too early in createChildren.

If you do it after the components have been created, and their properties /styles set, 
for example by overriding initialized() or by adding a handler to creationComplete, then it will work.

  override public function set initialized(value: Boolean): void {
        super.initialized = value;
       UIComponent( labelDisplay).setStyle("textAlign", "left");
    }

Maurice 

-----Message d'origine-----
De : Evyatar Ben Halevi-Arbib [mailto:evyatarbh@gmail.com] 
Envoyé : mardi 17 décembre 2013 21:14
À : users@flex.apache.org
Objet : Re: Spark Button textAlign

When you create a new skin (at least in Flash Builder) you can start by creating a copy of the default skin.
Just do that and on the Label MXML tag itself set the textAlign property to left.

Good luck,
Evyatar


On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <cs...@gmail.com> wrote:

> i have created a skin class that extends spark.skins.mobile.ButtonSkin 
> and set textAlign to be left in createChildren method but it does not 
> work
>
> package skins
> {
> import spark.skins.mobile.ButtonSkin;
>  public class MyButtonSkin extends ButtonSkin { public function 
> MyButtonSkin() { super(); }  override protected function 
> createChildren():void { super.createChildren();  
> labelDisplay.setStyle('textAlign','left');
> }
>  }
> }
>
>
> On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem < 
> maurice.amsellem@systar.com> wrote:
>
> > What do you mean by custom skin?
> > 1) Default skin customized through css styles (eg. textAlign)?
> > 2) Completely new skin class ?
> >
> > Maurice
> >
> > -----Message d'origine-----
> > De : Sumudu Chinthaka [mailto:csumudu@gmail.com] Envoyé : mardi 17 
> > décembre 2013 14:45 À : users@flex.apache.org Objet : Spark Button 
> > textAlign
> >
> > Hi All
> >
> > I want to crate a custom skin for a Spark button with textAlign to 
> > be set to "left", but i found out there is a restriction set in 
> > Button class
> that
> > prevent accepting textAlign values
> >
> > is there any way to override [Exclude(name="textAlign", 
> > kind="style")] setting in Button subclass so that i can set this 
> > through css
> >
> > or is there any alternative way to achieve this
> >
> > Thanks
> > Sumudu
> >
>

Re: Spark Button textAlign

Posted by Evyatar Ben Halevi-Arbib <ev...@gmail.com>.
When you create a new skin (at least in Flash Builder) you can start by
creating a copy of the default skin.
Just do that and on the Label MXML tag itself set the textAlign property to
left.

Good luck,
Evyatar


On Tue, Dec 17, 2013 at 7:41 PM, Sumudu Chinthaka <cs...@gmail.com> wrote:

> i have created a skin class that extends spark.skins.mobile.ButtonSkin
> and set textAlign to be left in createChildren method but it does not work
>
> package skins
> {
> import spark.skins.mobile.ButtonSkin;
>  public class MyButtonSkin extends ButtonSkin
> {
> public function MyButtonSkin()
> {
> super();
> }
>  override protected function createChildren():void
> {
> super.createChildren();
>  labelDisplay.setStyle('textAlign','left');
> }
>  }
> }
>
>
> On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
> maurice.amsellem@systar.com> wrote:
>
> > What do you mean by custom skin?
> > 1) Default skin customized through css styles (eg. textAlign)?
> > 2) Completely new skin class ?
> >
> > Maurice
> >
> > -----Message d'origine-----
> > De : Sumudu Chinthaka [mailto:csumudu@gmail.com]
> > Envoyé : mardi 17 décembre 2013 14:45
> > À : users@flex.apache.org
> > Objet : Spark Button textAlign
> >
> > Hi All
> >
> > I want to crate a custom skin for a Spark button with textAlign to be set
> > to "left", but i found out there is a restriction set in Button class
> that
> > prevent accepting textAlign values
> >
> > is there any way to override [Exclude(name="textAlign", kind="style")]
> > setting in Button subclass so that i can set this through css
> >
> > or is there any alternative way to achieve this
> >
> > Thanks
> > Sumudu
> >
>

Re: Spark Button textAlign

Posted by Sumudu Chinthaka <cs...@gmail.com>.
i have created a skin class that extends spark.skins.mobile.ButtonSkin
and set textAlign to be left in createChildren method but it does not work

package skins
{
import spark.skins.mobile.ButtonSkin;
 public class MyButtonSkin extends ButtonSkin
{
public function MyButtonSkin()
{
super();
}
 override protected function createChildren():void
{
super.createChildren();
 labelDisplay.setStyle('textAlign','left');
}
 }
}


On Tue, Dec 17, 2013 at 7:31 PM, Maurice Amsellem <
maurice.amsellem@systar.com> wrote:

> What do you mean by custom skin?
> 1) Default skin customized through css styles (eg. textAlign)?
> 2) Completely new skin class ?
>
> Maurice
>
> -----Message d'origine-----
> De : Sumudu Chinthaka [mailto:csumudu@gmail.com]
> Envoyé : mardi 17 décembre 2013 14:45
> À : users@flex.apache.org
> Objet : Spark Button textAlign
>
> Hi All
>
> I want to crate a custom skin for a Spark button with textAlign to be set
> to "left", but i found out there is a restriction set in Button class that
> prevent accepting textAlign values
>
> is there any way to override [Exclude(name="textAlign", kind="style")]
> setting in Button subclass so that i can set this through css
>
> or is there any alternative way to achieve this
>
> Thanks
> Sumudu
>

RE: Spark Button textAlign

Posted by Maurice Amsellem <ma...@systar.com>.
What do you mean by custom skin?
1) Default skin customized through css styles (eg. textAlign)?
2) Completely new skin class ?

Maurice 

-----Message d'origine-----
De : Sumudu Chinthaka [mailto:csumudu@gmail.com] 
Envoyé : mardi 17 décembre 2013 14:45
À : users@flex.apache.org
Objet : Spark Button textAlign

Hi All

I want to crate a custom skin for a Spark button with textAlign to be set to "left", but i found out there is a restriction set in Button class that prevent accepting textAlign values

is there any way to override [Exclude(name="textAlign", kind="style")] setting in Button subclass so that i can set this through css

or is there any alternative way to achieve this

Thanks
Sumudu