Increase text area width by typing text in it

Hi all,
I am using a text area i have set its wordwrap property false and horozontal and vertical policy off..What i want is to increase the width or height of text area depending upon the text i am writing
if  the text is going to increase more than the width of text area the width of text area should adjust itself according to that..
Take a look to the below example
text area text:-
"this is text example"
text area width:-100
now as the word wrap property is off the text will come upto this for width of 100px:-
"this is text"
The moment i press the next character to type..the text area width should increase according to that ..the width should increase side by side
Is there any event for this via which i can get this done
Thanks

I extended TextArea and it works well as a standalone component, but it might not work so well if you use it as an itemRenderer, like in a DataGrid.
I created a Flex Cookbook post on the topic:
http://cookbooks.adobe.com/post_I_want_a_TextArea_that_will_act_like_a_TextInput_t-16596.h tml
If this post answers your question or helps, please mark it as such.
Greg Lafrance
www.ChikaraDev.com
Flex Development and Support Services
------------------------ DynamicWidthTextArea.as -----------------------------
package {
  import flash.events.Event;
  import mx.controls.TextArea;
  public class DynamicWidthTextArea extends TextArea{
    public function DynamicWidthTextArea(){
      super();
      super.horizontalScrollPolicy = "off";
      super.verticalScrollPolicy = "off";
      super.wordWrap = false;
      this.addEventListener(Event.CHANGE, adjustWidthHandler);
    private function adjustWidthHandler(event:Event):void{
      if(width <= textField.textWidth + textField.getLineMetrics(0).width){
        width = textField.textWidth;     
        validateNow();
    override public function set text(val:String):void{
      textField.text = val;
      validateNow();
      width = textField.textWidth;
      validateNow();
    override public function set htmlText(val:String):void{
      textField.htmlText = val;
      validateNow();
      width = textField.textWidth;
      validateNow();
    override public function set width(value:Number):void{
      if(textField == null){
        if(width <= value){
          super.width = value;
      }else{       
        trace("width: " + width);
        trace("super.maxWidth: " + super.maxWidth);
        if (textField.getLineMetrics(0).width<= super.maxWidth){
          trace("textField.textWidth: " + textField.textWidth);
          trace("textField.getLineMetrics(0).width: " + textField.getLineMetrics(0).width);
          if(width <= textField.getLineMetrics(0).width + 10){
            super.width = textField.getLineMetrics(0).width + 10;
        }else{
            super.width = super.maxWidth;         
    override public function get text():String{
        return textField.text;
    override public function get htmlText():String{
        return textField.htmlText;
    override public function set maxWidth(value:Number):void{
      super.maxWidth = value;
--------------------- Test.mxml --------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
  xmlns:comp="*">
  <mx:HBox>
    <mx:Label text="Font size 8: "/>
    <comp:DynamicWidthTextArea width="100" fontSize="8"/>   
  </mx:HBox>
  <mx:HBox>
    <mx:Label text="Font size 10: "/>
    <comp:DynamicWidthTextArea width="100" fontSize="10"/>   
  </mx:HBox>
  <mx:HBox>
    <mx:Label text="Font size 12: "/>
    <comp:DynamicWidthTextArea width="100" fontSize="12"/>   
  </mx:HBox>
  <mx:HBox>
    <mx:Label text="Font size 20: "/>
    <comp:DynamicWidthTextArea width="100" fontSize="20"/>   
  </mx:HBox>
  <mx:HBox>
    <mx:Label text="Font size 40: "/>
    <comp:DynamicWidthTextArea width="100" height="100" fontSize="40"/>   
  </mx:HBox>
  <mx:HBox>
    <mx:Label text="Font size 100: "/>
    <comp:DynamicWidthTextArea width="200" height="120" fontSize="100"/>   
  </mx:HBox>
</mx:Application>

Similar Messages

  • Text Area steals Focus from Text Field when selected with mouse

    I have created a very simple form with 4 spry validation elements here :: http://octopusdesign.net/contactus.html
    When I attempt to select the 'Your Email' text field using the mouse, focus is grabbed by the text area above it.
    It is only possible to get focus on the 'Your Email' text field by using tab.
    My best guess is that this is a bug in the framework.
    In addition to updating my spry libraries to 1.6 from 1.4 I've tried the following things::
    Reordering the elements in the form.
    Creating the elements in a different order.
    Replacing the validation elements with ordinary elements.
    None of these fixed the problem.
    Strangely, if I remove the validation text area there is no problem.
    If anyone can shed some light on this I would really appreciate it.
    Wisdom gratefully received.
    Chris

    Furthermore ::
    I've tried to reconstruct the form from scratch and discovered that if you have a validation text field and a validation text area in any order on the form, selecting the 2nd element with the mouse always results in the first element stealing the focus.

  • Printing text in text area in so10(standard text)

    Dear all,
    I need to print a text in text area.i mean i need a box in which i can fill text in standard text (tcode-so10).Using box command we will be doing in script.
    But is there any possibility that i can solve the issue in so10 itself as i am generating offer letter in pb60 it takes my standard text there itself.So is there any solution for this issue?
    This issue is very urgent.
    Thank you,
    bhavani.

    Hi
    KEEP a BREAK-POINT and debug the internal table lines how it is coming
    some overlap must be happening ..check.
    Also check the code where you are getting this text into internal table.
    1) One way to debug smartform is to debug the Function Module of that smartforms.
    If you want to debug particular smartform node that the solution would be,
    insert a "Program Line" just above the node you want to debug and this program line write a normal abap breakpoint.
    So whenever you call the smartforms, it will stop at this breakpoint and you can debug onwards.
    2) SFTRACE can be used for debugging SMARTFORMS.
    Read More here.
    http://help.sap.com/saphelp_erp2004/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
    Reward points for useful Answers
    Regards
    Anji

  • Hi there. I having a problem with InDesign PDF interactive export. I would keep my text area style and not text area default style when I export the PDF. How could I do?

    Could you help me?

    Thanks for the answer Sumit Singh,
    sorry but my problem keeps.
    I create a simple text area and then trasform it in interactive text area, set it, apply my paragraph/character style and at the end export it in PDF (interactive).
    I open the file with Adobe Acrobat, but when I customize it, words inside text area have stylized with default paragraph/character style.
    How could I keep my style on export interactive text area?
    Thanks a lot.

  • How to get a adf text area width using javascript

    hi
    i have to catch different input text width(i.e 30px,500px.etc) dynamically using javascript(adf:clientListner)
    Thanks and regard
    B.Maheswara Reddy

    Hi,
    its af:clientListener, not adf:clientListener.
    af:clientListener passes an event to the JavaScript method
    function getWidthOfComp(event){
    alert(event.getSource().getWidth());
    }

  • How to save the text from text area back to a text file?

    Hi all,
    Now I am doing a small panel which containts a JTextArea, this TextArea will read the content from a text file, then display the content of the text file on the TextArea itself.
    My idea is, allow the user to modify the content in the textarea (I set it Editable=true;), then save it. After the user press the save button, the content in the text file will be updated accordng to the user;s modification on TextArea.
    I had done the displaying part by using JavaI/O (BufferReader), now any expert here know how to update the TextArea content back to the text file itself? PLease teach me, THANKS !!!

    NOw I had manage to clear out the error, but now the problem is when I click on the 'save' button, this function clear out the entire text file for me !!!
    The code are as below:
           if(e.getSource()== vButtons[0])
              try{
               String str;
               String Ky = tArea.getText();
               BufferedWriter buffWrite=null;
               BufferedWriter in1 = new BufferedWriter(new FileWriter("Keyword.txt"));
                        buffWrite.write(Ky);
                    buffWrite.flush();
                        buffWrite.close();
                    in1.close();
              catch (IOException ex) {
              ex.printStackTrace();
            if(e.getSource()== vButtons[1])
                  new panel();
                  dispose();
             if(e.getSource()== vButtons[2])
                System.exit(0);           
        }     Please tell me how to save the TextArea to the text file, THANKS !!!

  • Increasing the size of designated text area in a photo book

    I am using IPhoto version 9.5.1 on a MacBook Pro (10.9.2). I am trying to increase the designated text area so that I can increase the font size. This will allow for the final product to be more legible. Currently, I am featuring a student per page. The designated text areas are 4 separate sections on these pages.  I would like to include on each page the following.
    Aviator
    Person's Name
    Algebra I
    Homecoming Dance
    When I increase the font size in those 4 designated areas, the red caution triangle with exclamation point states, 'This text doesn't fit the designated text area!' 
    I have two questions.
    1. How do I increase the text area so the larger text will fit and print properly?
    2. Is there an overall command that I can input these increases to the text area so that the 36 papes have the same changes in the designated text areas? Otherwise, I will have to make those changes for each individual pages that are featuring a student.
    Comptroller

    You can "adjust" a photo frame or text box size on a page with the following key combinations:
    Command + Option +⬆arrow:  increase frame height.
    Command + Option +⬇arrow:  decrease frame height.
    Command + Option + ➜ arrow:  increase frame width.
    Command + Option + ⬅ arrow:  decrease frame width.
    To adjust its position on the page use these key combinations:
    Command + Control + ➜ arrow:  move frame to right.
    Command + Control + ⬅  arrow:  move frame to left.
    Command + Control + ⬆ arrow:  rotate frame counter clockwise.
    Command + Control + ⬇ arrow:  rotate frame clockwise.
    You can conver the standard frame (on the left) to this one (on the right)
    Always be sure to create a PDF file of the book for proofing before ordering a book. This Apple document describes how to create the PDF file: iPhoto, Aperture: Previewing an order in iPhoto or Aperture. Keep the PDF file to compare it with the printed copy when it arrives.
    If you have Pages you can easily create custom book pages as images and add them to a 1 photo per page layout by following this tutorial: iP11 - Creating a Custom Page, with the Theme's Background for an iPhoto Book
    OT

  • Typing Text in Titles is r..e..a..l..l..y s..l..o..w

    I have an 8 core 22GB Mac Pro.  I am using proxy video.  I have audio waveforms turned off.  I have a lot of titles to update, but I cannot update the text in a reasonable amount of time because there is a 1.5 second delay per character when I try to type text into any title.  I believe this has always been like this, but it hasn't bothered so much because I normally only have 1 or 2 titles per project anyway.  Now I am editing some projects that are very title intensive so it is almost impossible to do this.
    -Nathan

    Try these steps:
    1) create a gap at the end of your project and place the title effect over the gap (it's okay if the title length "hangs off the end") - a Gap is literally nothing. A gap won't contribute to FCPX trying to render the text in the canvas.
    2) use the Text Tab > Text area to edit your text (forgoing the onscreen "convenience") [however, I think you'll find that most "easy" titles will respond quite well on the canvas]
    3) move the title to its final position
    One last thing: turn off background rendering if you need to. (That includes background transcoding which can go on for quite awhile and affect FCPX performance quite a bit. To turn off background Transcoding if needed, click the dial to the left of the playhead position indicator under the canvas, or type Command-9 and click on the X to stop completely or || to pause.) Background rendering can also be turned off from the Preferences > Playback dialog.

  • Need to compare html text area values by using java script

    I have one html text area in my JSP file. when i click on that text area, a pop-up will come, in that pop-up i have list of items. So after selecting a item from that pop-up list, need to click okay. so that text area will update with the selected value.
    In this case, i need to compare the first text area value and updated text area value. How can i do that in Java Script.

    I suggest you look for a Javascript forum to ask questions about Javascript. This is a Java forum.

  • How to middle text in a text area?

    Can someone tell me how to middle the text (vertically) on a JTextArea? It always starts at the top.
    Thanks to all in advance
    sridhar

    Um, assuming by "middle the text" you mean scroll the text area to the vertical center of the text area:
    1) Enclose your text area in a JScrollPane.
    2) Get the vertical scroll bar of the scroll pane using:
    JScrollBar scrollbar = scrollpane.getVerticalScrollBar();3) Find the middle of the scroll bar using:
    scrollbar.setValue(scrollbar.getMaximum() / 2);

  • Hindi language in text area

    Hey Experts,
    I have a module where I have to display translation for
    Arabic,Spanish,Hindi in text area where user
    inputs text in English Language. This translation is done by
    the Google Translation API.
    I have succeeded in getting translation for Arabic and
    Spanish which is displayed fine in the Text Area.
    But for Hindi, its displaying boxes.
    How do I go about for this issue?
    The next thing what I did is
    I applied Hindi font style to text box when Hindi language is
    selected but still no success :(

    Hi there Linda
    I'm not sure where you are looking to say that your "project
    global settings" are English.
    Have you looked here? Click File > Record/Create > New
    Project
    When you reach the recording dialog (with the teal colored
    frame and the check boxes), click the Advanced button.
    See image linked below:
    Click here to see the
    image
    Cheers... Rick

  • Hyperlinks are rendering as outlined text in browsers

    I had this problem before with Firefox, and it resolved itself after a clean install, but now it is happening in Chrome.
    Hyperlinks that should appear as solid text are appearing as outlined text. It is a very strange bug, has anyone else had this issue?

    After experimenting, I have come up with a work around: the
    static texts have to be inside a movieclip then they appear. If
    they are just on the main timeline then the missing text syndrome
    appears.
    Thank you for the feedback
    Attila

  • Plot area width changes as the precision changes !?

    need help to understand following thing:
    If I increase the precision of a graph manually, the plot area size decreases and vice versa.
    Otherwise there is an example posted demonstrating prcision change by property node which does not change plot area size.
    I've attached an example to demonstrate both.
    What I want is to change the precision manually with the default graph tools without decrease or increase plot area width.
    Is this possible in LV 6.02 ?
    Attachments:
    MyScaleProblem.vi ‏60 KB

    Hi.
    Resizing of the graph is the default behavior. The Graph resizes in LabVIEW 7 in both cases. I woud suggest building a text indicator with a transparent background and reading the properties of the graph to display the correct values to the side. This should give the desired response.
    -Erik

  • In download to excel from bsp hw to increase excel column width to wrap txt

    in download to excel from bsp how to increase excel column width to wrap text
    in each column.
    My client does not want to manually click each cell aftet downloading to excel to see full text in each column

    Hi,
    You can achieve this by formatting your output using HTML table tag.
    Try the following code.
      DATA: lv_output  TYPE string.
      concatenate
      '<table border="1">'
      '<tr style="font-weight: bold; text-align:center; "><td>Name</td><td width="150">Description</td></tr>' cl_abap_char_utilities=>cr_lf
      '<tr><td>First Name</td><td>Some Description goes here..... ....... ...... </td></tr>' cl_abap_char_utilities=>cr_lf
      '<tr><td>2nd Name</td><td>XYZ.......</td></tr>' cl_abap_char_utilities=>cr_lf
      '</table>'
      into lv_output.
      response->set_cdata( data = lv_output ).
    Regards
    Geogy
    PS. Reward the useful answers.

  • Disabling a Text Input created through the TEXT TOOL?

    Hi There,
    I have created a text input area. I havent used the flash
    text components. I used the TEXT TOOL. In the properties I set it
    to "input" type so that i could input data. All the features works
    fine except one. I have to disable the text area when user clicks a
    button. I dint get any help from the flash help.
    The main objective is that the text input area shouldnt take
    input from the user when the button is ON, once the button is off,
    the cursor should be at the point where the user left and he can
    type thru.
    Is this possible? I have achieved this functionality using
    the textarea component of Flash, but not using the input text area
    created using the TEXT TOOL.
    Can anyone help me.

    use the type property of textfields to change your textfield
    to "dynamic "when you want to disable input and assign it to
    "input" when you want to enable input.

Maybe you are looking for

  • Migrating EJB 3 from 10g to 11g

    Hello, We have an application that includes an EJB project. We try to get instance of a session ejb (NativeBeanHandler) : InitialContext context = new InitialContext(); NativeBeanHandler nativeBeanHandler = (NativeBeanHandler)context.lookup("NativeBe

  • What are the different libraires in Mac compared to Windows (Urgent)

    I am taking a beginning C++ class at my college. I started out the semester coding on a Windows pc. Microsoft Visual Studios is a very nice compiler and GUI programing tool. I was lead to believe that I can take that Mac and plug in Windows C++ code

  • Advice on Dolby speech compression settings seeked

    I'm outputting talking head clips to DVD (mixed at -12dB and EQ'd in FCP with average level at - 6 and peaks approaching 0). I've used standard dolby settings and the sound is significantly lower in volume than an average TV show which might be a pro

  • Row level security in discoverer desktop

    currently, I have designed a business area on one of my star schema, and I created several other business area in order to allow different level of users to view the pre-defined reports on discoverer desktop. and I want different users to view differ

  • Changing Connect Profile Opt-in Setting from False to True

    Users on Connect who cannot accept Invitation IDs to our Preview programs want to update their accounts to indicate that Opt-in equals true. Despite instructions showing a radio button control for this setting, I cannot find the setting itself within