You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by tranquiliste <ni...@gmail.com> on 2020/10/01 08:49:55 UTC

MX:Label automatic truncation with tooltip

Hello,

With Flash there were a feature when you added a maxWidth to a Label where
it automatically truncated the text to the maxwidtht putting "..." at the
end and generating a toolTip to display the full text (see doc [1]) .

Is there a bead in Apache Royale to reproduce this behaviour?

Thanks
Nicolas

[1]https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Label.html



-----
Nicolas
--
Sent from: http://apache-royale-users.20374.n8.nabble.com/

Re: MX:Label automatic truncation with tooltip

Posted by Alina Kazi <al...@apache.org>.
Perfect

On Thu, 1 Oct 2020, 5:55 pm Nicolas Aguttes, <ni...@gmail.com>
wrote:

> Hello Alina,
>
> Thanks.  I looked at the code it seems that the DATA_CHANGE is for the set
> data, when using set text, this is "textChange"
>
> Nicolas
>
> Le jeu. 1 oct. 2020 à 14:06, Alina Kazi <al...@apache.org> a écrit :
>
>> Hi,
>>
>> That is DATA_CHANGE in mx.events.FlexEvent.
>>
>> Alina Kazi
>>
>> On Thu, 1 Oct 2020, 4:58 pm tranquiliste, <ni...@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> Thanks Alina,
>>> I think it will be easier for me to just define a new class that extends
>>> mx:Label and listen to an event which indicates that the text has changed
>>> and then execute a simple function to redefine the text.
>>> just as followed
>>>         public function changeStr():void {
>>>             if (maxWidth) {
>>>                 if (this.measuredWidth > maxWidth) {
>>>                     this.toolTip = this.text;
>>>                     var len:int = text.length-1;
>>>                     for(var index:int = len; index > 0; index--)
>>>                     {
>>>                         this.text = this.text.substring(0,index)+"...";
>>>                         if (this.measuredWidth < maxWidth) {
>>>                             break;
>>>                         }
>>>                     }
>>>                 }
>>>             }
>>>         }
>>> I just need to find the proper event to listen
>>>
>>> Nicolas
>>>
>>>
>>>
>>>
>>> -----
>>> Nicolas
>>> --
>>> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>>>
>>

Re: MX:Label automatic truncation with tooltip

Posted by Nicolas Aguttes <ni...@gmail.com>.
Hello Alina,

Thanks.  I looked at the code it seems that the DATA_CHANGE is for the set
data, when using set text, this is "textChange"

Nicolas

Le jeu. 1 oct. 2020 à 14:06, Alina Kazi <al...@apache.org> a écrit :

> Hi,
>
> That is DATA_CHANGE in mx.events.FlexEvent.
>
> Alina Kazi
>
> On Thu, 1 Oct 2020, 4:58 pm tranquiliste, <ni...@gmail.com>
> wrote:
>
>> Hello,
>>
>> Thanks Alina,
>> I think it will be easier for me to just define a new class that extends
>> mx:Label and listen to an event which indicates that the text has changed
>> and then execute a simple function to redefine the text.
>> just as followed
>>         public function changeStr():void {
>>             if (maxWidth) {
>>                 if (this.measuredWidth > maxWidth) {
>>                     this.toolTip = this.text;
>>                     var len:int = text.length-1;
>>                     for(var index:int = len; index > 0; index--)
>>                     {
>>                         this.text = this.text.substring(0,index)+"...";
>>                         if (this.measuredWidth < maxWidth) {
>>                             break;
>>                         }
>>                     }
>>                 }
>>             }
>>         }
>> I just need to find the proper event to listen
>>
>> Nicolas
>>
>>
>>
>>
>> -----
>> Nicolas
>> --
>> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>>
>

Re: MX:Label automatic truncation with tooltip

Posted by Alina Kazi <al...@apache.org>.
Hi,

That is DATA_CHANGE in mx.events.FlexEvent.

Alina Kazi

On Thu, 1 Oct 2020, 4:58 pm tranquiliste, <ni...@gmail.com> wrote:

> Hello,
>
> Thanks Alina,
> I think it will be easier for me to just define a new class that extends
> mx:Label and listen to an event which indicates that the text has changed
> and then execute a simple function to redefine the text.
> just as followed
>         public function changeStr():void {
>             if (maxWidth) {
>                 if (this.measuredWidth > maxWidth) {
>                     this.toolTip = this.text;
>                     var len:int = text.length-1;
>                     for(var index:int = len; index > 0; index--)
>                     {
>                         this.text = this.text.substring(0,index)+"...";
>                         if (this.measuredWidth < maxWidth) {
>                             break;
>                         }
>                     }
>                 }
>             }
>         }
> I just need to find the proper event to listen
>
> Nicolas
>
>
>
>
> -----
> Nicolas
> --
> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>

Re: MX:Label automatic truncation with tooltip

Posted by tranquiliste <ni...@gmail.com>.
Hello,

Thanks Alina, 
I think it will be easier for me to just define a new class that extends
mx:Label and listen to an event which indicates that the text has changed
and then execute a simple function to redefine the text.
just as followed
        public function changeStr():void {
            if (maxWidth) {
                if (this.measuredWidth > maxWidth) {
                    this.toolTip = this.text;
                    var len:int = text.length-1;
                    for(var index:int = len; index > 0; index--)
                    {
                        this.text = this.text.substring(0,index)+"...";
                        if (this.measuredWidth < maxWidth) {
                            break;
                        }
                    }
                }
            }
        }
I just need to find the proper event to listen

Nicolas




-----
Nicolas
--
Sent from: http://apache-royale-users.20374.n8.nabble.com/

Re: MX:Label automatic truncation with tooltip

Posted by Alina Kazi <al...@apache.org>.
As an example you can see, How UIComponent has used ToolTipBead in set
toolTip Method and that ToolTipBead is extending another ToolTipBead  (in
HTML project) of Royale SDK. Additional functionality can be added in that
new bead that you create and differences can be overridde.

Alina Kazi

On Thu, 1 Oct 2020, 4:18 pm Alina Kazi, <al...@apache.org> wrote:

> Hi Nicolas,
> We can use beads with mx controls too
> ClassAliasBead is used in mxRoyale Examples in the SDK.
> TruncateText in jewel has used IStyledUIBase class. See if you create
> something similar for the mx control as well and use it.
>
> You need to see the SDK code further and see the possibility of it.
> Carlos can comment better on it.
>
> Alina Kazi
>
> On Thu, 1 Oct 2020, 4:10 pm Nicolas Aguttes, <ni...@gmail.com>
> wrote:
>
>> Hello Carlos,
>>
>> yes I saw that, but unfortunately we are mx here...
>>
>> Nicolas
>>
>> Le jeu. 1 oct. 2020 à 12:00, Carlos Rovira <ca...@apache.org> a
>> écrit :
>>
>>> In Jewel there's a bead "TruncateText"
>>>
>>> El jue., 1 oct. 2020 a las 10:50, tranquiliste (<
>>> nicolas.aguttes@gmail.com>) escribió:
>>>
>>>> Hello,
>>>>
>>>> With Flash there were a feature when you added a maxWidth to a Label
>>>> where
>>>> it automatically truncated the text to the maxwidtht putting "..." at
>>>> the
>>>> end and generating a toolTip to display the full text (see doc [1]) .
>>>>
>>>> Is there a bead in Apache Royale to reproduce this behaviour?
>>>>
>>>> Thanks
>>>> Nicolas
>>>>
>>>> [1]
>>>> https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Label.html
>>>>
>>>>
>>>>
>>>> -----
>>>> Nicolas
>>>> --
>>>> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>>>>
>>>
>>>
>>> --
>>> Carlos Rovira
>>> http://about.me/carlosrovira
>>>
>>>

Re: MX:Label automatic truncation with tooltip

Posted by Alina Kazi <al...@apache.org>.
Hi Nicolas,
We can use beads with mx controls too
ClassAliasBead is used in mxRoyale Examples in the SDK.
TruncateText in jewel has used IStyledUIBase class. See if you create
something similar for the mx control as well and use it.

You need to see the SDK code further and see the possibility of it.
Carlos can comment better on it.

Alina Kazi

On Thu, 1 Oct 2020, 4:10 pm Nicolas Aguttes, <ni...@gmail.com>
wrote:

> Hello Carlos,
>
> yes I saw that, but unfortunately we are mx here...
>
> Nicolas
>
> Le jeu. 1 oct. 2020 à 12:00, Carlos Rovira <ca...@apache.org> a
> écrit :
>
>> In Jewel there's a bead "TruncateText"
>>
>> El jue., 1 oct. 2020 a las 10:50, tranquiliste (<
>> nicolas.aguttes@gmail.com>) escribió:
>>
>>> Hello,
>>>
>>> With Flash there were a feature when you added a maxWidth to a Label
>>> where
>>> it automatically truncated the text to the maxwidtht putting "..." at the
>>> end and generating a toolTip to display the full text (see doc [1]) .
>>>
>>> Is there a bead in Apache Royale to reproduce this behaviour?
>>>
>>> Thanks
>>> Nicolas
>>>
>>> [1]
>>> https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Label.html
>>>
>>>
>>>
>>> -----
>>> Nicolas
>>> --
>>> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>>>
>>
>>
>> --
>> Carlos Rovira
>> http://about.me/carlosrovira
>>
>>

Re: MX:Label automatic truncation with tooltip

Posted by Nicolas Aguttes <ni...@gmail.com>.
Hello Carlos,

yes I saw that, but unfortunately we are mx here...

Nicolas

Le jeu. 1 oct. 2020 à 12:00, Carlos Rovira <ca...@apache.org> a
écrit :

> In Jewel there's a bead "TruncateText"
>
> El jue., 1 oct. 2020 a las 10:50, tranquiliste (<ni...@gmail.com>)
> escribió:
>
>> Hello,
>>
>> With Flash there were a feature when you added a maxWidth to a Label where
>> it automatically truncated the text to the maxwidtht putting "..." at the
>> end and generating a toolTip to display the full text (see doc [1]) .
>>
>> Is there a bead in Apache Royale to reproduce this behaviour?
>>
>> Thanks
>> Nicolas
>>
>> [1]
>> https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Label.html
>>
>>
>>
>> -----
>> Nicolas
>> --
>> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>>
>
>
> --
> Carlos Rovira
> http://about.me/carlosrovira
>
>

Re: MX:Label automatic truncation with tooltip

Posted by Carlos Rovira <ca...@apache.org>.
In Jewel there's a bead "TruncateText"

El jue., 1 oct. 2020 a las 10:50, tranquiliste (<ni...@gmail.com>)
escribió:

> Hello,
>
> With Flash there were a feature when you added a maxWidth to a Label where
> it automatically truncated the text to the maxwidtht putting "..." at the
> end and generating a toolTip to display the full text (see doc [1]) .
>
> Is there a bead in Apache Royale to reproduce this behaviour?
>
> Thanks
> Nicolas
>
> [1]
> https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Label.html
>
>
>
> -----
> Nicolas
> --
> Sent from: http://apache-royale-users.20374.n8.nabble.com/
>


-- 
Carlos Rovira
http://about.me/carlosrovira