is there a way to change the length of the text that is shown in <af:outputformatted>? There is a limit to the length shown while I use outputformatted as I want to display all of the text that I have entered.
Related
I'm trying to edit code (C++/C#/Java) in a RichTextBox of a winfrom application.
Since there are different new line breakers in different platform, I'm using these code to encode the rich text:
value = value
.Replace("\r\n", "\\par ")
.Replace("\r", "\\par ")
.Replace("\n", "\\par ");
All the 3 types of newline breakers are displayed fine. But then I noticed that, since \r\n(2 chars in file content) has been encoded as \par (1 char in RichTextBox.Text), the index of a certain text differs. Thus RichTextBox.Select(index, length) will select text in the wrong position, if the position was calculated from the raw file content. For each more line, the difference of index increases 1.
I'm thinking if there is anything like "\\return\\par", which is counted as 2 chars but displayed as 1 newline breaker; and in RichTextBox.Text(it will be saved as the file content), it is decoded back as "\r\n".
And if not, is there any other way to align index of file content and RichTextBox.Text? Thanks.
BTW I have a dirty way to walk around: RichTextBox.Select(index - lineNo, length). But it's really ugly.
I need to wrap text nicely. E.g. "WWWW WWWW" takes more space than "1111 1111".
I have a design to make a for loop and add words one by one and see if text is too long to fit the row.
How to count properly the text.textWidth() without drawing text to the screen 1st?
System.Wait() seems to be required to make textwidth value refresh, is there any workaround for this? I don't want to add sleep into for loop, it would take ages.
len(text.text) to count the text, use len(str(text.text)) if combinated number and text
checkout full documentation here
I'm wondering about way to edit multiple selections but with different texts
For example:
arr=['hi','i','am','your','array','can','change','me','quickly','please']
arr=['test1','text','foo','test','fast','yes','test2','test3','text2','text3']
I have array of ten elements and I want to change them all with different texts.
Ordinary way to select one then change it. If you use multiple selections all of them are replaced with the same new text.
The question there: any way to change them faster?
I think there may be a way to change it like Emmet in HTML when you enter Emmet code PhpStorm convert it and take you inside red box in each element to write inside it one by one.
i have found the solution to make it easily to edit the array
just using the find ctrl+f and then use f3 to get next value to edit
in the search we can enter the regular expression that will find any matched values
(?<=')\w+(?=')|(?<=,)\w+(?=,)|(?<=\[)\w+(?=,)|(?<=,)\w+(?=])
(?<=')\w+(?=') : any text inside single quotes symbol ' can be changed double "
(?<=,)\w+(?=,): any word between commas for numbers and variables in the array
(?<=\[)\w+(?=,): the first element of the array if it as number or variable
(?<=,)\w+(?=]) : the last element in the array if it as number or variable
| : or operator
So I have 25 lines of text with 40 characters per line held in an array of strings, and within that there are control codes which denote a colour which the following chars should be, for example one line may be:
[RED] Hello [BLUE] World
Where Hello must be in red, and World must be in blue. Currently I've gotten to the point where I can read the first code, i.e [RED] (actual control codes are hexadecimal) and using the following line I can highlight it:
TTF_RenderUTF8_Shaded(d->font, array_pointers[i], colors.foreground, colors.background);
Where d->font is the font, array_pointers[i] is that line of text, and the colors are the back/foreground to be set (default black background for all so not a worry. This line will render the entire string red and ignore the second control code.
My question is: is there something I can use/a way which can render specific parts of a string different colors? As far as i know RenderUTF8_Shaded only takes a whole string as an argument.
Im creating a simple program that will compare user input to a predetermined string (for memorization help). So far, after the user pushes space a code will run to break the user input text into individual characters (in an array) to test it against the original.
When the user pushes space and one of the letters is wrong, I want that letter to turn a different color. Is there any way to store htmlText in an array, or can anyone think of a way to make that letter turn the color?
Is there any way to write the program at all? Am I able to keep the text in a string and compare it (the spaces and punctuation need to be ignored)?
You can change color without htmlText.
Use setTextFormat.
example:
var format:TextFormat = textField.getTextFormat(wrongLetterBeginIndex, wrongLetterEndIndex);
format.color = 0xFF0000;
textField.setTextFormat(format, wrongLetterBeginIndex, wrongLetterEndIndex);