When I try set the text with rbEscolha_1.setText("This is a test");
I receive the error:
no method super.setText in «Function#0| $janelas$2Elzx_10_39_setText»
I'm new in Laszlo but I think which checkbox don't have setText function
because it descends from View
and setText is function of Text which, by it's time, descends from View too.
This solution break the line but is not good because I need to define
the length of text line before
set the texts.
<class name="myradiobutton" extends="radiobutton">
<method name="init">
super.init();
this._title.setMultiline(true);
this._title.setWidth(this.width);
this._title.setHeight(this._title.__LZtextclip.textHeight + 6);
</method>
<method name="setText" args="_t">
//super.setText(_t); - ERROR ABOVE
this._title.setHeight(this._title.__LZtextclip.textHeight + 6);
</method>
</class>
<radiogroup id="groupTarefa" defaultselection="-1" selectiontype="single">
<method name="rg_init" event="oninit">
rbEscolha_1.setText(""); // without this the text is not showed
rbEscolha_2.setText("");
</method>
<myradiobutton id="rbEscolha_1" width="450"
text="${this.parent.parent.Opcao_1}">
<method name="refresh_1" event="oninit">
this.setAttribute('text',
'123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
</method>
</myradiobutton>
<myradiobutton id="rbEscolha_2" width="450"
text="${this.parent.parent.Opcao_2}">
<method name="refresh_2" event="oninit">
this.setAttribute('text',
'123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
</method>
</myradiobutton>
</radiogroup>
Thanks
Alfeu
ChrisK escreveu:
> You should be able to override the setText() method in the radio
> button. setText() should be called when the attribute "Text_1" in
> your example updates.
>
> You probably want to create a new radio button class to generalize the
> behavior.
>
> I haven't tested this code out, but you probably want something like
> this:
>
> <class name="myradiobutton" extends="radiobutton">
> <method name="init">
> super.init();
> this._title.setMultiline(true);
> this._title.setWidth(this.width);
> this._title.setHeight(this._title.__LZtextclip.textHeight
> + 6);
> </method>
> <method name="setText" args="_t">
> super.setText(_t);
>
> this._title.setHeight(this._title.__LZtextclip.textHeight +
> 6);
> </method>
> </class>
>
> I hope that helps. __LZtextclip is the Flash TextField object that
> underlies the <text> Laszlo object. If you look at the source code
> for Laszlo, I'm sure this will all make more sense. There is, of
> course, the risk that someone will change the name of the private var
> __LZtextclip, but I think this is an OK workaround to solve your
> problem for now.
>
> -chrisk
>
> On Feb 26, 2006, at 11:22 AM, Alfeu Marcatto wrote:
>
>> Thank you Chrisk for your solution but I cannot adapt it to my needs.
>>
>> I have a modaldialog with 4 radiobuttons and this modaldialog will be
>> showed several times with different texts.
>>
>> I pass the text to the radiobutton using an attribute like this:
>>
>> <modaldialog>
>> <attribute name="Text_1" value="" type="string"/>
>> <radiogroup >
>> <radiobutton text="${parent.parent.Text_1}"/>
>>
>> Your solution uses the oninit method and at this moment the Text_1
>> don't have any text yet.
>>
>> Some solution for this?
>>
>> Thanks
>>
>> Alfeu
>>
>> ChrisK escreveu:
>>> Try this:
>>>
>>> <radiobutton text="This is some really really really really
>>> really really long text and some more and somre more" width="100">
>>> <method name="init">
>>> super.init();
>>> this._title.setMultiline(true);
>>> this._title.setWidth(this.width);
>>>
>>> this._title.setHeight(this._title.__LZtextclip.textHeight + 6);
>>> </method>
>>> </radiobutton>
>>>
>>> -chrisk
>>>
>>> On Feb 26, 2006, at 7:05 AM, Alfeu Marcatto wrote:
>>>
>>>> Is it possible multiline text in radiobutton?
>>>>
>>>> The multiline attribute is not supported and
>>>> the <BR/> or <p> inside the text do not break the line.
>>>>
>>>> Thanks
>>>>
>>>> Alfeu
>>>>
>>>> _______________________________________________
>>>> Laszlo-user mailing list
>>>> [email protected]
>>>> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>>
>>>
>>>
>>> --No virus found in this incoming message.
>>> Checked by AVG Free Edition.
>>> Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date:
>>> 24/2/2006
>>>
>>>
>>
>
>
>
> --No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.375 / Virus Database: 268.1.0/269 - Release Date: 24/2/2006
>
>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user