11-17-2005 10:52 AM
Hi All,
I need to add a text editor in the MODULE POOL code.Can anyone suggest how do i do this particularly through the Layout or Code?
Thanks,
Disha.
11-17-2005 10:58 AM
Hi Disha,
Please check the programs <b>SAPTEXTEDIT*</b>.
It will give you more info.
And also check the sample program.
REPORT ZSIRI_EDIT .
DATA container TYPE REF TO cl_gui_custom_container.
DATA editor TYPE REF TO cl_gui_textedit.
DATA ok_code TYPE sy-ucomm.
call screen 100.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'AAA'.
SET TITLEBAR 'xxx'.
IF container is initial.
CREATE OBJECT container
EXPORTING container_name = 'CONTAINER'.
CREATE OBJECT editor
EXPORTING parent = container
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_POSITION = 10
WORDWRAP_TO_LINEBREAK_MODE =
cl_gui_textedit=>true
MAX_NUMBER_chars = 30.
call method editor->SET_HEIGHT
exporting
height = 3.
call method editor->SET_POSITION
exporting
HEIGHT = 1
LEFT = 1
TOP = 1
WIDTH = 1.
call method editor->SET_AUTOINDENT_MODE
exporting
AUTO_INDENT = 1.
CALL METHOD cl_gui_cfw=>flush.
endif.
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
MODULE user_command_0100 INPUT.
case ok_code.
when 'EXIT'.
leave to screen 0.
endcase.
CALL METHOD cl_gui_cfw=>dispatch.
ENDMODULE. " USER_COMMAND_0100 INPUT
Hope this will help you.
Thanks & Regards,
Siri.
11-17-2005 11:11 AM
HI,
Write code similar to the below one...
Create a custom control with name 'TEXTEDITOR1' in the screen painter.
data: TEXTEDIT_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
Then add the below logic in the PBO of the screen.
create control container
CREATE OBJECT TEXTEDIT_CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'TEXTEDITOR1'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
IF SY-SUBRC NE 0.
add your handling
ENDIF.
create calls constructor, which initializes, creats and links
a TextEdit Control
CREATE OBJECT EDITOR
EXPORTING
PARENT = TEXTEDIT_CUSTOM_CONTAINER
WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION
WORDWRAP_TO_LINEBREAK_MODE = CL_GUI_TEXTEDIT=>TRUE
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = V_PROGRAM "--> program name
TXT2 = SPACE
TXT1 = 'Error in flush'.
ENDIF.
Let me know if you need more details.
Thanks,
Ramakrishna
11-17-2005 11:33 AM
Hi,
Just check this standard program SAPTEXTEDIT_TEST_EVENTS.
Kindly reward points by clicking the star on the left of reply,if it helps.