Kuix project tracker

#7 Multiline text in TextArea

2008-10-13 10:49  |   Major 
Submit by Bo

State: Opened
Priority: Major
Type: Feature request
Milestone: 1.2.0
Release: Kuix 1.0.1
Body:

Implements a new way to split text in TextArea. At present text is split only on words delimited by a space separator.

Comments

ayman 2008-10-13 10:49

Hello Bo,

I hope you consider the ticket (ID#14) while writing the new implementation of the textarea. I was thinking of some logic that would work for both ltr and rtl languages and here what i found:

Keep the same logic of tokenizing, but instead of adding each word a Text element add 1 text element and keep on filling it until it consumes all the allowed width. Then, add a new Text element after it and repeat. This logic will display the rtl correct also.

Please let me know what you think about this.

Ayman

Bo 2008-10-13 10:49

This feature request has been moved to the 1.0.3 milestone.

Bo 2008-10-13 10:49

Yes Ayman, this is I think the best way for reimplement textArea, but for the moment the TextArea word arrange is made by the default flowLayout. The realy best solution would be to not a two part of quite similar code in FlowLayout and TextArea ...

jbspxz 2008-10-13 10:49

what i do?

memphis 2008-10-13 10:49

    private void splitWords(String fullText, int style)
    {
        String str = fullText+" ";
        String word="";
        int len = str.length()-1;
        for (int i = 0; i <= len; i++) {
            char ch = str.charAt(i);
            if(i!=len)
                word = word + ch;
            if ((ch >= 48 && ch <= 57) || (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122))
                continue;
            if (word.length() != 0 || i==len) {
                Text textWidget = new Text();
                textWidget.setText(word);
                if (style != Font.STYLE_PLAIN) {
                    textWidget.setDefaultFontStyle(style);
                }
                add(textWidget);
                word = "";
            }
        }
    }