Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Text Editor

SG141
Active Participant
0 Likes
862

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.

7 REPLIES 7
Read only

Former Member
0 Likes
811

Hi Karthik,

Use SET_HEIGHT Method to limit the number of lines in editor.

Reward points if it helps,

Satish

Read only

naimesh_patel
Active Contributor
0 Likes
811

Try like this.

data: i_height type i value 3.

call method text_editor->SET_HEIGHT
exporting HEIGHT = i_height.  " <

Regards,

Naimesh Patel

Read only

SG141
Active Participant
0 Likes
811

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

Read only

Former Member
0 Likes
811

Hi Karthik,

Pls check the following theread. Here some sample codes are there. Hope it will be useful.

it will solve your problem..

<b>Reward points if useful....</b>

Thanks & Regards

ilesh 24x7

Read only

Former Member
0 Likes
811

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

Read only

SG141
Active Participant
0 Likes
811

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.

Read only

0 Likes
811

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