‎2009 Mar 03 7:19 AM
hi experts,
i would like to add a text area on a screen using screen painter. is this possible?
thanks,
vitz
‎2009 Mar 03 7:26 AM
HI,
Yes, you can add using TEXT AREA control. Insert a custom control area in the screen and create a object of the text editor.
Check this code for PBO and PAI.
TEDITOR is the custom contorl area name on screen:-
MODULE PBO OUTPUT.
IF EDITOR IS INITIAL.
* set status
SET pf-status '1111'.
* create control container
CREATE OBJECT TextEdit_Custom_Container
EXPORTING
CONTAINER_NAME = 'TEDITOR'
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.
mycontainer = 'TEDITOR'.
* create calls constructor, which initializes, creats and links
* TextEdit Control
create object editor
exporting
parent = TextEdit_Custom_Container
WORDWRAP_MODE =
* cl_gui_textedit=>wordwrap_off
cl_gui_textedit=>wordwrap_at_fixed_position
* cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
* to handle different containers
container_linked = 1.
refresh mytable.
ENDIF.
ENDMODULE. " PBO OUTPUT
MODULE pai INPUT.
case ok_code.
WHEN 'SAVE'.
* retrieve table from control
clear: txt.
call method editor->get_text_as_r3table
importing table = mytable.
loop at mytable into wa.
concatenate txt wa into txt
separated by '|'.
endloop.
shift txt left.
length = strlen( txt ).
ztext-CLUSTR = length.
ztext-text = txt.
modify ztext.
clear: ztext.
refresh: mytable.
call method editor->set_text_as_r3table
exporting table = mytable.
Message s000(zwa).
when 'DISP'.
select single * from
ztext
where fund = ztext-fund.
SPLIT ztext-text AT '|' INTO TABLE mytable.
call method editor->set_text_as_r3table
exporting table = mytable.
endcase.
clear: ok_code.
ENDMODULE. " pai INPUT
Also you can refer:-
Hope this helps you.
Regards,
Tarun
‎2009 Mar 03 7:26 AM
HI,
Yes, you can add using TEXT AREA control. Insert a custom control area in the screen and create a object of the text editor.
Check this code for PBO and PAI.
TEDITOR is the custom contorl area name on screen:-
MODULE PBO OUTPUT.
IF EDITOR IS INITIAL.
* set status
SET pf-status '1111'.
* create control container
CREATE OBJECT TextEdit_Custom_Container
EXPORTING
CONTAINER_NAME = 'TEDITOR'
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.
mycontainer = 'TEDITOR'.
* create calls constructor, which initializes, creats and links
* TextEdit Control
create object editor
exporting
parent = TextEdit_Custom_Container
WORDWRAP_MODE =
* cl_gui_textedit=>wordwrap_off
cl_gui_textedit=>wordwrap_at_fixed_position
* cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER
WORDWRAP_POSITION = line_length
wordwrap_to_linebreak_mode = cl_gui_textedit=>true.
* to handle different containers
container_linked = 1.
refresh mytable.
ENDIF.
ENDMODULE. " PBO OUTPUT
MODULE pai INPUT.
case ok_code.
WHEN 'SAVE'.
* retrieve table from control
clear: txt.
call method editor->get_text_as_r3table
importing table = mytable.
loop at mytable into wa.
concatenate txt wa into txt
separated by '|'.
endloop.
shift txt left.
length = strlen( txt ).
ztext-CLUSTR = length.
ztext-text = txt.
modify ztext.
clear: ztext.
refresh: mytable.
call method editor->set_text_as_r3table
exporting table = mytable.
Message s000(zwa).
when 'DISP'.
select single * from
ztext
where fund = ztext-fund.
SPLIT ztext-text AT '|' INTO TABLE mytable.
call method editor->set_text_as_r3table
exporting table = mytable.
endcase.
clear: ok_code.
ENDMODULE. " pai INPUT
Also you can refer:-
Hope this helps you.
Regards,
Tarun