简体   繁体   中英

how to make longer sentences to wrap in flex builder RadioButton

We are having answer options to a questions is set as label to the RadioButton. When answer is more than one line's length it is being truncated and followed with ... which in hovering shows the complete answer as tooltip.

We want to wrap the answer in multiple lines instead of truncating. How can we do it?

The code is:

...
a1.label = answers[_index].atext;
a1.id = answers[_index].cans+ "_" + answers[_index].id;
...

<s:VGroup id="Answers" left="145" bottom="193" width="725" height="372"
chromeColor="#F7F9FB" gap="20" horizontalCenter="8" verticalCenter="46" click="enablenext();">

  <s:RadioButton id="a1" x="568" y="346" width="500" height="60" click="enablenext();"
  fontFamily="Arial" fontSize="16"/>                        
  <s:RadioButton id="a2" x="1068" y="346" width="500" height="60" click="enablenext();"
  fontFamily="Arial" fontSize="16"/>                                
  <s:RadioButton id="a3" x="437" y="305" width="500" height="60" click="enablenext();"
  fontFamily="Arial" fontSize="16"/>
  <s:RadioButton id="a4" width="500" height="60" fontFamily="Arial" fontSize="16"/>
</s:VGroup> 

The display sample is: 在此处输入图片说明

=================================================================

UPDATE 1:

Used the control shared in the link to implement MultilineRadioButton .

But the problem now is line length is two less how to increase to around 500 pixels?

Current screenshot:

在此处输入图片说明

======================================================================

Update 2

I created a custom skin using RadioButton class

Applied the skin in styles section to RadioButton

First I deleted maxDisplayedLines under Label. Not working. Then I set its value to 3. Still not working....

In skin for label added lineBreak first to explicit then toFit.... to no result still getting tooltip for longer sentences.

Update 3

I created a new project with only RadioButton and Button to add text to radioButton. It was working fine.... so it goes worse...

Finally solved the issue.

It seems the skin has to applied in mxml containing application even if the control is going to be used in mxml with Group in it.

Solved this issue with the help of my co-workers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM