2019 Jan 15 1:38 PM
Hi everybody!
How can I get the character length of a line in a cl_gui_textedit?
Thank you!
2019 Jan 15 2:06 PM
Use CALL METHOD lr_text_edit->get_text_as_r3table
IMPORTING
table = lt_text. " text as R/3 table to get text in internal table.
Then loop into the internal table and use strlen function to find length of each line.
2019 Jan 15 2:26 PM
Hi Monalisa!
Thank you for your answer! Probably I didn't formulate my question clear enough. I don't want to know how many characters have been entered in each line so far (and this is whatt strlen will return), but rather how many characters can be entered in each line, e.g. in the width of the text window. There should be, no doubt, a simple way to find this out.
Best regards
Alexander.
2019 Jan 15 6:11 PM
You can specify wordwrap_position for the text editor as given below: This will wrap text to next line after the specified number of characters
* 255 chars in one line
CREATE OBJECT lr_text_edit
EXPORTING
wordwrap_mode = 2 " 0: OFF; 1: wrap a window border; 2: wrap at fixed pos
wordwrap_position = 254 " pos of wordwrap, only makes sense with wordwrap_mode=2
parent = lr_custom_cont. " Parent Container
2019 Jan 15 5:40 PM
For the same window size, you'll be able to enter 100 "l" but only 50 "W", because of the proportional font, so the answer will be "variable". Could you explain why you need the "line length" please?
2019 Jan 15 8:32 PM