I am trying to use iup.text to create a textbox linked to a text file.
I want to display the text file in this textbox in real time.
local Visu = iup.text{
multiline="yes",
--rastersize="x60",
expand="yes",
readonly="yes",
--font="Times, Bold 12",
SCROLLBAR="YES",
AUTOHIDE="YES",
BGCOLOR="0 43 54",
fgcolor="255 255 255",
--maxsize="x1000",
}
function refresh_txt()
local f2 = io.open("txtfile.txt", "r")
if not f2 then
Visu.value = "Empty File"
else
Visu.value = f2:read("*a")
end
end
The problem is, when the textbox is just actualized by the function refresh_txt()` the cursor is put at the beginning of the showed text and not at the end of the text as I want.
So the text is constantly being refreshed and I can't scroll down because when I did it, the cursor goes to the first character of the first line.
I want an automatic vertical expand of the textbox when refreshed.
I think that the problem can be solved by some argument of iup.text, but I didn't found it.
To scroll down after changing the text use VisuQSPI.scrollto = "99999999:1".
Is there an easy way to remove the line breaks within each cell?
Each cell on column E, has extra line that I am having to manually remove, any easy to remove all.
Easiest method:
Bring up the Find and Replace box (Ctrl+h on Windows)
Tick the box Search with regular expressions
In the Find input field, type \n
Leave the Replace with field empty
Click Replace all
(If there are still spaces left, click Replace all again)
How about following sample? This sample supposes that the line break is \r\n and \n.
FLow :
Retrieve the information of line break.
If the line break is \r\n, when the number of \r\n is more than 2, it is modified to char(10).
Sample :
=IF(REGEXMATCH(E1, "\r\n"),REGEXREPLACE(E1, "(\r\n){2,}", char(10)),REGEXREPLACE(E1, "(\n){2,}", char(10)))
Result :
If you want to remove all of the line break, you can use =CLEAN(A1). In this case, the result of the result sheet becomes sample1sample2sample3sample4sample5.
If this was not helpful for you, I'm sorry.
Here is my preferred method to remove leading and trailing line breaks. Note that this will not remove any line breaks in the "middle" of your cells.
Right click on Column E > Insert 1 Right
In column F in the first row that has an extra space: Type the formula =TRIM( select the E cell directly to the right, and enter a closing ). For example, in F2 the formula should look like =TRIM(E2).
This cell should display the correct value. Select this cell and drag the little blue box in the bottom right corner to the bottom of your sheet. This will copy the formula to all other cells, updating the row E references.
When all the data in row F looks as expected, click on the very top of the row to select it and click copy.
Right click on the top of row F again and select Paste Special > Paste Values Only.
Now that Column F has the data you need, you can right click on the top of Row E > Delete column.
Here is the formula I use:
=TRIM(SUBSTITUTE(E2,CHAR(10)," "))
The value CHAR(10) will identify new lines and replace it with a " ".
And the TRIM will remove multiple white spaces.
I initiate search after a user enter 3 characters in search bar with following command. It works properly.
if searchController.searchBar.text?.characters.count > 2 { ... }
But, if user delete the search text that entered before and write another one, the table view starts to display previous results until search text reaches 3 characters.
So, how can I clear previous appended search results from memory ?
Is possible to do in textView create multiline as separate object ? What i try to do is one textView, one fextField and one button. Now when i type in textField some text and press Button i would like add this text to line (for example line number 1)
1 My text
After this system want add other line for example some log to line number 2
1 My text
2 Computer text
And now i want type some text : hey my next text and after click button i want see this text like continue in my line number 1
1 my text hey my next text
2 Computer text
And the last if i click button for empty textField i would like start type in next line number 3
I don't have any idea how can i reach this goal ? Ca anyone give me some hint ?
I have a interesting problem. I have a :text field in my model with displays a large chunk of data, usually about three paragraphs.
When I enter the text in on the new view it might look like....
aaaaaaaaaaaaaaaaaaaaaaaaa.
bbbbbbbbbbbbbbbbbbbbbbbbbbbb.
ccccccccccccccccccccc.
Imagining that each a,b, or c is an individual paragraph.
With a space between the a, b, and c lines....(e.g. the line break that occurs when you press enter)
But when I display the very same data on the view, the line breaks are not recognized. The view seems to concatenate all the text into one big blurb and it displays like.....
aaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccc.
But the line breaks are being recorded because going to edit shows the data in the format with the line breaks.
I thought about adding < p >'s into the text area and parsing the html on the view but that really isn't a good option since I dont want to require my users to insert html tags.
Is there something I'm missing to get the text area to display in the same fashion as it was entered?
Try simpleformat:
<%= simple_format(my_text_from_database) %>