RE: [flexcoders] Flex TextArea Limited by number of lines.

2008-12-04 Thread Keith Reinfeld
My approach is to simply reject any change that would exceed the maxLines
setting. 

The following is presented sans the requisite class structure. 
Create a component that extends TextArea, then:  

var tf:TextField = TextField(this.textField);
var maxLines:uint = 5; // however many lines (getter/setter)
var storedInput:String = ;

private function onChange(event:Event):void
{
if (tf.numLines  maxLines)
{
tf.text = storedInput;
}else{
// Handle editable TextArea bugs
storedInput = tf.text;
 } 
}

Issues: 
There is a bug in the TextArea component (editable=true) where any given
line will fail to wrap so long as the last character in the line is a space
(also, the insertion cursor disappears beyond the right edge of the field.)
But this can be managed. 
Using htmlText just makes a mess (the insertion cursor has a mind of its
own.)  
Regards, 

-Keith 
http://keithreinfeld.home.comcast.net
http://keithreinfeld.home.comcast.net/ 
 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Gordon Smith
Sent: Wednesday, December 03, 2008 7:27 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex TextArea Limited by number of lines.

This hasn't been a common request. What is your use case for allowing a user
to type up to, say, three lines but no more? Most UIs I've seen limit the
number of characters you can type, not the number of lines.
 
I think you have two choices: use the 'textInput' event to limit the amount
of text that goes in, or use the 'change' event to remove excess text that
has already gone in.
 
Which are you trying, and what problems are you running into?
 
Gordon Smith
Adobe Flex SDK Team
 
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of tchredeemed
Sent: Wednesday, December 03, 2008 7:09 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex TextArea Limited by number of lines.
 
Has anyone ever done this? Seen any tutorials on this? It seems that a
good amount of people would want something like this.

I keep running into issues with it, and it is very frustrating!
 
attachment: winmail.dat

RE: [flexcoders] Flex TextArea Limited by number of lines.

2008-12-03 Thread Alex Harui
There was a thread on this in the past month or two

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
tchredeemed
Sent: Wednesday, December 03, 2008 7:09 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex TextArea Limited by number of lines.


Has anyone ever done this? Seen any tutorials on this? It seems that a
good amount of people would want something like this.

I keep running into issues with it, and it is very frustrating!



RE: [flexcoders] Flex TextArea Limited by number of lines.

2008-12-03 Thread Keith Reinfeld
Yup, same poster. 

 

Regards, 

-Keith 
http://keithreinfeld.home.comcast.net
http://keithreinfeld.home.comcast.net/ 
 

  _  

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Wednesday, December 03, 2008 2:34 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Flex TextArea Limited by number of lines.

 

There was a thread on this in the past month or two

 

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of tchredeemed
Sent: Wednesday, December 03, 2008 7:09 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex TextArea Limited by number of lines.

 

Has anyone ever done this? Seen any tutorials on this? It seems that a
good amount of people would want something like this.

I keep running into issues with it, and it is very frustrating!

 



RE: [flexcoders] Flex TextArea Limited by number of lines.

2008-12-03 Thread Gordon Smith
This hasn't been a common request. What is your use case for allowing a user to 
type up to, say, three lines but no more? Most UIs I've seen limit the number 
of characters you can type, not the number of lines.

I think you have two choices: use the 'textInput' event to limit the amount of 
text that goes in, or use the 'change' event to remove excess text that has 
already gone in.

Which are you trying, and what problems are you running into?

Gordon Smith
Adobe Flex SDK Team

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
tchredeemed
Sent: Wednesday, December 03, 2008 7:09 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Flex TextArea Limited by number of lines.


Has anyone ever done this? Seen any tutorials on this? It seems that a
good amount of people would want something like this.

I keep running into issues with it, and it is very frustrating!