Number of lines in Mobile TextArea

How can I calculate the number of lines in a Flex Mobile TextArea?

Hi Friend,
Try the below code, might be this would be helpful to you.
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView"
        >
    <fx:Script>
        <![CDATA[
            import spark.events.TextOperationEvent;
            [Bindable]
            protected static var lineCount:uint = 0;
            protected function richEdTxt_changeHandler(evt:TextOperationEvent):void {
                lineCount = richEdTxt.mx_internal::textContainerManager.numLines;
        ]]>
    </fx:Script>
    <s:Panel id="pnl"
             title="Total Lines: {lineCount}"
             horizontalCenter="0" verticalCenter="0">
        <s:RichEditableText id="richEdTxt"
                            widthInChars="20" heightInLines="10"
                            change="richEdTxt_changeHandler(event);" />
    </s:Panel>
</s:View>
Regards,
Bharat Patel

Similar Messages

  • TextArea - Is it possible to get the number of lines?

    I was wondering if there's any way to know how many lines of text a textarea has. And also, if it'd be possible to listen for number of lines changes. I'm trying to develop a component which displays just one line at first, and then starts to grow as necessary, as the number of written lines increase.
    Let me know if it's not clear enough.
    Thanks in advance.

    Hi,
    May be what i am going to propose you is not the answer for your quesion. :P, but i have the same requirement and I achieved it in the following way. :)
    I wrapped by TextArea with a StackPane, and before adding the text area into the StackPane i added a Label, whose wrapText is set to true, and binded the prefWidth and text property with TextArea , as below.
    this.label =new Label();
    this.label.setWrapText(true);
    this.label.prefWidthProperty().bind(this.textArea.widthProperty());
    this.label.textProperty().bind(this.textArea.textProperty());That's it !!! It worked for me ;)
    Below is the complete code of this new customised control ;)
    ScrollFreeTextArea textArea= new ScrollFreeTextArea();And the complete class :
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.geometry.Insets;
    import javafx.geometry.Pos;
    import javafx.scene.GroupBuilder;
    import javafx.scene.control.Label;
    import javafx.scene.control.TextArea;
    import javafx.scene.layout.StackPane;
    import javafx.scene.layout.StackPaneBuilder;
    public class ScrollFreeTextArea extends StackPane{
         private Label label;
         private StackPane lblContainer ;
         private TextArea textArea;
         private Character NEW_LINE_CHAR = new Character((char)10);
         private final double NEW_LINE_HEIGHT = 18D;
         private final double TOP_PADDING = 3D;
         private final double BOTTOM_PADDING = 6D;
         public ScrollFreeTextArea(){
              super();
              configure();
         public ScrollFreeTextArea(String text){
              super();
              configure();
              textArea.setText(text);
         private void configure(){
              setAlignment(Pos.TOP_LEFT);
              this.textArea =new TextArea();
              this.textArea.setWrapText(true);
              this.textArea.getStyleClass().add("scroll-free-text-area");
              this.label =new Label();
              this.label.setWrapText(true);
              this.label.prefWidthProperty().bind(this.textArea.widthProperty());
              this.label.textProperty().bind(this.textArea.textProperty());
              this.lblContainer = StackPaneBuilder.create()
                                                        .alignment(Pos.TOP_LEFT)
                                                        .padding(new Insets(4,7,7,7))
                                                        .children(label)
                                                        .build();
              // Binding the container width to the TextArea width.
              lblContainer.maxWidthProperty().bind(textArea.widthProperty());
              textArea.textProperty().addListener(new ChangeListener<String>() {
                   @Override
                   public void changed(ObservableValue<? extends String> paramObservableValue,     String paramT1, String value) {
                        layoutForNewLine(textArea.getText());
              label.heightProperty().addListener(new ChangeListener<Number>() {
                   @Override
                   public void changed(ObservableValue<? extends Number> paramObservableValue,     Number paramT1, Number paramT2) {
                        layoutForNewLine(textArea.getText());
              getChildren().addAll(GroupBuilder.create().children(lblContainer).build(),textArea);
         private void layoutForNewLine(String text){
              if(text!=null && text.length()>0 &&
                             ((Character)text.charAt(text.length()-1)).equals(NEW_LINE_CHAR)){
                   textArea.setPrefHeight(label.getHeight() + NEW_LINE_HEIGHT + TOP_PADDING + BOTTOM_PADDING);
                   textArea.setMinHeight(label.getHeight() + NEW_LINE_HEIGHT + TOP_PADDING + BOTTOM_PADDING);
              }else{
                   textArea.setPrefHeight(label.getHeight() + TOP_PADDING + BOTTOM_PADDING);
                   textArea.setMinHeight(label.getHeight() + TOP_PADDING + BOTTOM_PADDING);
    }I hope you got the basic trick that I am doing here. I hope this can help you.
    Happy Coding :)
    Regards,
    Sai Pradeep Dandem.

  • I just changed my number on line but my previous number is still showing on my phone and is active.  What do I need to do?

    I just changed my number on line but my previous number is still showing on my phone and is active.  What do I need to do?
    Thanks.

        Alanf356,
    You've reached the right place for help! Once the mobile number is changed, you must activate the new number on your phone. Depending on the model phone you have, you may have to simply reboot your device. If a 3G phone, you may dial *228 (send) and select option number one to activate.
    Once completed dial #832 (send) to place a test call and ensure that new number is activated. Let us know if this helps.
    EfrainM_VZW
    Follow us on Twitter @VZWSupport

  • Why Siri cannot call out (Fixed Line or Mobile No.) in Malaysia?

    Just bought a iPhone 4S 64GB with local mobile service provider (Digi) with 24 months contract (on 28 Dec 2011), but same problem happen in Malaysia, which Siri cannot call out to Fixed Line or Mobile No. (Siri will reply that: Sorry, I can't call Home's home number.)
    Really hope that Apple can provide a solution to solve it ASAP.

    According to this forum: http://forum.lowyat.net/topic/2175165/all, it seems that Siri is expecting a 7-8 digit phone numbers excluding the country code and area code, so adding an extra "0" digit or two at the back of the phone number may be able to fix your problem. The phone number should still connect correctly. Try that, it works for me in Indonesia where some phone numbers are still 6 digits.
    Hindra

  • Restriction on number of line items in an automatically generated document

    Hi all,
    As per my info, an accounting document must have a minimum of 2 line items to complete the document. At the same time an accounting document can have a maximum of 999 line items.
    My observation:-
    When I am posting depreciation using t-code AFAB, system is posting depreciation document (document type AF). While checking, I found that the system has posted around 16 document for a period.
    On further checking, I observed that the each document contains a max 100 line items.
    I am using SAP 4.7
    My Query:-
    a> Is there any way / place wherein we can restrict the maximum number of line items possible for a given docuemnt type or for all document types in the client?
    b> In case it is not possible to restrict the number of line items per document, what could be possible reason for the system behaviour wherein it is posting about 100 line items per document & thereafter starts a new document.
    Thanking you in advance
    Santosh K Agarwal

    Hi,
    I have been reading CIN. There I came across with a statement i.e. "There is restriction on no of line items to be in an Excise Invoice".
    where you read this i dont know
    but yes for outgoing excise invoice we can put limitation in sap cin
    as per incoming excise invoice i think no  limitation
    in path SPRO-tax on goods movemnet-India-basic setting-maintain excise registration here you can maintain this
    and yes this for india only for other country they may have different
    Regards
    Kailas ugale

  • ALV_GRID How to get number of lines after filted applyed?

    Hi, all!
    The task is to display title in alv_grid like
    "N records selected (X records on the screen)".
    It means, N records in dataset and X records displayed after  filter applyed by user.
    But i can't get number of lines after filter applyed from the alv_grid.
    Can anybody help me?
    Thanks & regards,
    Konstantin

    Hi,
    If it goes through PBO/PAI cycle after user sets the filter then in your PBO call method get_filtered_entries of CL_GUI_ALV_GRID and then do a describe statement on the table.
    Number of entries in your grid table - number of entries in this filtered entries table will give you the displayed entries after the filter is set.
    If it does not go through PBO/PAI cycle then register for after_user_command and I think the fcode for filter is '&FILTER' and code for the above logic in your handler method..
    Hope this helps..
    Sri

  • Number of line items in each Invoice

    Hi Gurus,
    I have one requirement
    i need to display one column in the Report i.e. "Line items per eachinvoice" which should give the number of line items per that Invoice
    when iam using tcode 'FB03' at ECC - Document Display it is giving
    for Doc 1111 - 2 line items
    for Doc 2222 - 12 line items
    so in the report that column should display
    2 for Doc 1111
    12 for Doc 2222
    please guide me how to do this
    Thank you

    create a formula with constant 1
    and set the exception aggregation as Total, and set the reference char as Line Item.
    Make sure you have Invocie in the report.
    - Danny

  • How to restict number of lines  from my report output

    Hi,
    I deveoped a noraml alv report where 26 fields displayed in the report output .But when nuber of lines exdeed 65,000 then we are unable to donload it to spread sheet .so we want to reduce the number of lines based on customer .How to do this in layout is there any facility to restict the number of lines ??
    Please help me

    Hi I am not sure but you can try like devide table entries in multiple internal tables.
    Create saperate ALV Report and give customized button(Next and Back) to each report will have interlink to this reports.

  • How to find number of lines in the text content?

    Hello All,
    I have a multi line text item. I want to know the number of lines in a text item? How can I do that?
    Note that every lines end with the shift+enter.
    Example,
    This is a
    sample.
    After line This is a there is (Shift + Enter).
    Thanks for any help.

    Whenever the user inputs Shift-Enter, Photoshop inserts an [EOT] (End Of Text) control character (\x03 or \u0003) in the string.
    Also, in order to split the text according to multiple separators in only one call, it is necessary to use a regular expression instead of a string.
    Try replacing:
    var theArray = theText.split("\r");
    with:
    var theArray = theText.split(/[\u0003\r]/);
    BTW, you can improve performance by explicitely requesting the textKey property of the current layer object.
    Try using:
       ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("textKey") );
       ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    instead of:
       ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    HTH...

  • How to count number of lines in a file?

    I am using a BufferedReader to read my file, but I like to know how to count the number of lines in a file is there a way to do that in Buffered Reader or do I have to use FileInputLineStream?

    Well, if you know how to read one line with a Buffered reader, and you know how to keep reading lines until you run out, then all you have to to is initialize a counter to zero before you start reading, add 1 to it each time you read a line, and then examine its value when you're done.
    Try that, and post again if you get stuck.
    Just be careful how you construct your loop. "Off by one" errors are a common way to get bitten. It could happen if you count what you think is the last line, but you've actually already counted all the lines and you end up counting one extra for "there are no more lines".

  • How can I find out the number of lines in a text file?

    How can I find out the number of lines in a text file?

    java.io.BufferedReader in = new java.io.BufferedReader( new java.io.FileReader( "YourFile.txt" ) );
    int lineCount = 0;
    while( in.readLine() != null )
    lineCount ++;
    System.out.println( "Line Count = " + lineCount );

  • How do you find the number of lines in a file?

    I need to count how many lines there are in a file, I am using a BufferedReader to read in the data, but how can I find the number of lines?
    Thanks

    That depends. How do you define a line? Is it a specific number of
    characters, a String that's terminated by a newline character or some
    combination thereof?

  • How do I increase the number of lines presented in a drop down list?

    When I am entering a single character/number for each of a random selection of three letters in a password verification, I get a drop down list from A to S only, the first 20. Accessing letter T to number 9 means scrolling down. How can I increase the number of lines in a drop down box to 36?

    Hi canddski,
    If you are taking about an interface on a website, this is up to the ui designer. But there is a reflow that depends on screensize for the Firefox UI.
    You can use asp to control the list:
    [http://forums.asp.net/t/1970301.aspx?How+can+i+display+selected+no+of+records+from+datatable+using+dropdown+list+without+database+]
    but also try asking on stackoverflow.com

  • How to get the number of lines of a FileReader

    I need to calculate the number of lines of a FileReader object. How can I do that ?

    I wrote the following some while ago. It assumes that a line is terminated by '\n' but it should be easy to adapt.
    import java.io.*;
    public class LineCounter
        public static int countLines(File file, String encoding) throws IOException
            int lineCount = 0;
            Reader reader = new InputStreamReader(new FileInputStream(file), encoding);
            char[] buffer = new char[4096];
            for (int charsRead = 0; (charsRead = reader.read(buffer)) >= 0;)
                for (int charIndex = 0; charIndex < charsRead ; charIndex++)
                    if (buffer[charIndex] == '\n')
                        lineCount++;
            reader.close();
            return lineCount;
        public static void main(String[] args)
            try
                File file = new File("/home/sabre/work/dev/maps/EUROPE.RIV");
                long startTime = System.currentTimeMillis();
                int lineCount = countLines(file, "UTF-8");
                double time =  (System.currentTimeMillis() - startTime) / 1000.0;
                System.out.println("File size = " + file.length() + " contains " + lineCount + " lines taking " + time);
            catch (Exception e)
                e.printStackTrace();
    }

  • How to get the number of lines of a file?

    Folks:
    Is there a way to get the number of lines of a text file? I don't know if there is an existing method to do that.
    Thanks a lot.

    HI
    I found some solution
    other than increment loop and all
    here is the code it might helpful to u
    //returns the number of lines in a file
    //author : Ravindra S
    //Symphony software Hyderabad
    try
    RandomAccessFile randFile = new RandomAccessFile(csvFile,"r");
    long lastRec=randFile.length();
    randFile.close();
    FileReader fileRead = new FileReader(csvFile);
    LineNumberReader lineRead = new LineNumberReader(fileRead);
    lineRead.skip(lastRec);
    countRec=lineRead.getLineNumber()-1;
    fileRead.close();
    lineRead.close();
    catch(IOException e)

Maybe you are looking for

  • Questions on FND Diagnostics in 11.5.10 Base version

    Hi, We have 2 instances. One is 11.5.10 base version and the other is 11.5.10 CU3. Doing, Diagnostics > Show Log on Screen > Statement (1) , is fine in CU3. However, when I do that in 11.5.10 BASE I am not getting the debug messages like, oadbtransac

  • How do i get the syncing icon to stop

    how do i get the syncing icon to stop?

  • Has Anyone Tried to Alter OpenSPARC Regression Scripts???

    Hi, I'm working on a project dealing with coverage and vulnerability with OpenSPARC for my Robust System Design Class. There are a few questions I had about running regressions: 1. Out of all of the regressions for the 1 Core model and 1Thread Model,

  • 80 gb click wheel is kafluie

    my brand new 80 gb ipod click wheel is very different from my 60 gb ipod video. forward button does not change song to next song. it does nothing. to forward to next son I must hit select button. when i am in shuffle songs playing a song and want to

  • Synch Between Tables in Two different Databases

    Synch between Two Tables in two different Databases. I have two identical tables, table T1 in Database D1 and table T1 in Database D2. User can insert/update/delete/select from both of these tables in respective databases. Being said that how can kee