‎2007 Nov 15 5:16 PM
I am displaying text editor on the screen.
create object gt_textbox "cc_container
exporting
container_name = 'GT_TEXTBOX'.
create object text_editor
exporting
parent = gt_textbox. "cc_container.i want to limit the number of lines in the text editor to 3.
How can i do that.
Thank you.
‎2007 Nov 15 5:27 PM
Hi Karthik,
Use SET_HEIGHT Method to limit the number of lines in editor.
Reward points if it helps,
Satish
‎2007 Nov 15 5:35 PM
Try like this.
data: i_height type i value 3.
call method text_editor->SET_HEIGHT
exporting HEIGHT = i_height. " <Regards,
Naimesh Patel
‎2007 Nov 19 6:12 PM
Even if i use the code...
I notice that user is able to enter more than three lines.
call method text_editor->SET_HEIGHT
exporting HEIGHT = i_height. " Here is my code for the Text Editor.
DATA: GT_TEXTBOX TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: C_CONTROL1 TYPE SCRFNAME VALUE 'GT_TEXTBOX'.
DATA: TEXT_EDITOR TYPE REF TO CL_GUI_TEXTEDIT.
CREATE OBJECT GT_TEXTBOX "cc_container
EXPORTING
CONTAINER_NAME = 'GT_TEXTBOX'.
CREATE OBJECT TEXT_EDITOR
EXPORTING
PARENT = GT_TEXTBOX
WORDWRAP_MODE = 2
MAX_NUMBER_CHARS = 374
WORDWRAP_POSITION = 128. "cc_container.My Objective is to lock the Text editor with 3 lines.
How can i do that
Message was edited by:
Karthik
‎2007 Nov 15 5:36 PM
‎2007 Nov 19 8:06 PM
Hi Karthik,
one way to get ur solution is to give error message when user tries to enter 4th line..
Look at the bold part of code in below example... use OOPS it will help u...
report zrep1 .
data:
dockingleft type ref to cl_gui_docking_container,
text_editor type ref to cl_gui_textedit,
repid type syrepid.
data: textlines type table of tline-tdline,
wa_text type tline-tdline.
data: lines type i.
parameters: p_check.
at selection-screen output.
repid = sy-repid.
create object dockingleft
exporting repid = repid
dynnr = sy-dynnr
side = dockingleft->dock_at_left
extension = 1070.
create object text_editor
exporting
* wordwrap_mode = 2
* max_number_chars = 216
* wordwrap_position = 72
parent = dockingleft.
<b>at selection-screen.
check sy-ucomm = 'ONLI'.
call method text_editor->get_text_as_r3table
importing
table = textlines
exceptions
others = 1.
describe table textlines lines lines.
if lines > 3.
message e001(00) with 'The line limit is two'.
endif.</b>
start-of-selection.
loop at textlines into wa_text.
write:/ wa_text.
endloop.
Hope it will solve ur problem
<b>Reward points if useful..</b>
Thanks & Regards
ilesh 24x7
‎2007 Nov 19 10:05 PM
This is a Module Pool Program and I am afraid we can't use At selection screen.
Apologize if i am not clear in my question earlier.
‎2007 Nov 19 10:17 PM
As suggested earlier, you can check the number of entries in the text table after user action eg. PAI.
call method text_editor->get_text_as_r3table
importing
table = textlines
exceptions
others = 1.
describe table textlines lines lines.
if lines > 4.
message e001(00) with 'The line limit is three'.
endif.Regards,
Naimesh Patel