Re: [flexcoders] Wrapping Text in Alert

2008-12-23 Thread Manish Jethani
On Tue, Dec 23, 2008 at 9:05 AM, Stephen More stephen.m...@gmail.com wrote:
 On Mon, Dec 22, 2008 at 5:39 PM, Manish Jethani
 manish.jeth...@gmail.com wrote:
 Is there an easy way to get text inside of a mx.controls.Alert to wrap ?

 It already wraps.

 mx:Button click=Alert.show('The quick brown fox jumped over the
 wall. The quick brown fox jumped over the wall. ...') /

 Perhaps you want to reduce the width of the box?

 Here is a little background, my flex application is really small
 width 125 x height 300.

 I would like the Alert box to be slightly smaller than the flex application.

import mx.controls.Alert;
import mx.managers.PopUpManager;

private function showAlert() : void
{
var myAlert:Alert = Alert.show('The quick brown fox
 jumped over the wall. The quick brown fox jumped
  over the wall. ...');
myAlert.width = Application.application.width - 20;
PopUpManager.centerPopUp( myAlert );
}

 The text is wrapping in your example, but it does wrap tight enough as
 it is overflowing the edges.
 How can the text wrap such that all text will fall within myAlert.width ?

I just looked at the source, and I'm sorry to say that the algorithm
for calculating the width of the text object is fixed and cannot be
overridden. The width is calculated based on the length of the title
text and the width of the buttons (both factors). Any width you set on
the Alert object has no effect on the width of the text inside it.

Your options are to either chop up the text programmatically into
multiple lines, so it appears to be wrapped, or patch the framework's
AlertForm component to respect the width assigned to it.

-- 
manishjethani.com


Re: [flexcoders] Wrapping Text in Alert

2008-12-23 Thread Stephen More
On Tue, Dec 23, 2008 at 5:54 AM, Manish Jethani
manish.jeth...@gmail.com wrote:
 Is there an easy way to get text inside of a mx.controls.Alert to wrap ?

 It already wraps.

 The text is wrapping in your example, but it does not wrap tight enough as
 it is overflowing the edges.
 How can the text wrap such that all text will fall within myAlert.width ?

 I just looked at the source, and I'm sorry to say that the algorithm
 for calculating the width of the text object is fixed and cannot be
 overridden. The width is calculated based on the length of the title
 text and the width of the buttons (both factors). Any width you set on
 the Alert object has no effect on the width of the text inside it.

 Your options are to either chop up the text programmatically into
 multiple lines, so it appears to be wrapped, or patch the framework's
 AlertForm component to respect the width assigned to it.

I think I will go for option 3 Creating custom pop-up windows with
the PopUpManager:

http://blog.flexexamples.com/2008/03/20/creating-custom-pop-up-windows-with-the-popupmanager-class-redux/


Re: [flexcoders] Wrapping Text in Alert

2008-12-22 Thread Manish Jethani
On Tue, Dec 23, 2008 at 3:54 AM, Stephen More stephen.m...@gmail.com wrote:
 Is there an easy way to get text inside of a mx.controls.Alert to wrap ?

It already wraps.

  mx:Button click=Alert.show('The quick brown fox jumped over the
wall. The quick brown fox jumped over the wall. ...') /

Perhaps you want to reduce the width of the box?

-- 
http://manishjethani.com/


Re: [flexcoders] Wrapping Text in Alert

2008-12-22 Thread Stephen More
On Mon, Dec 22, 2008 at 5:39 PM, Manish Jethani
manish.jeth...@gmail.com wrote:
 Is there an easy way to get text inside of a mx.controls.Alert to wrap ?

 It already wraps.

 mx:Button click=Alert.show('The quick brown fox jumped over the
 wall. The quick brown fox jumped over the wall. ...') /

 Perhaps you want to reduce the width of the box?

Here is a little background, my flex application is really small
width 125 x height 300.

I would like the Alert box to be slightly smaller than the flex application.

import mx.controls.Alert;
import mx.managers.PopUpManager;

private function showAlert() : void
{
var myAlert:Alert = Alert.show('The quick brown fox
jumped over the wall. The quick brown fox jumped
 over the wall. ...');
myAlert.width = Application.application.width - 20;
PopUpManager.centerPopUp( myAlert );
}

The text is wrapping in your example, but it does wrap tight enough as
it is overflowing the edges.
How can the text wrap such that all text will fall within myAlert.width ?

I am attaching a screen shot.

-Steve
attachment: alert.png