2007 Sep 12 11:46 AM
hi all
can anybody please tell me how to use method
display_context_menu of class cl_gui_textedit in text editor.
regards
ravish
2007 Sep 12 11:50 AM
hi
you cannot use that method, as that method is protected.
Regards,
Prasant
Hi Ravish,
You cannot use that protected methods even if you inherit the class.
you cannot implement this method.
tell me your requirement, based on that we can see a suitable method.
Regards,
Prasant
2007 Sep 12 11:50 AM
hi
you cannot use that method, as that method is protected.
Regards,
Prasant
2007 Sep 12 11:55 AM
Hi Prasant
is there anyway i can use this method in text editor.
beacuse there are lot more methods associated to the class cl_gui_textedit
which are protected or private
so please give me the solution for this
2007 Sep 12 11:59 AM
Hi Ravish,
You cannot use that protected methods even if you inherit the class.
you cannot implement this method.
tell me your requirement, based on that we can see a suitable method.
Regards,
Prasant
2007 Sep 12 12:16 PM
Hi Ravish,
Check the below code.
*Flow Logic
PROCESS BEFORE OUTPUT.
MODULE GET_TEXT.
MODULE fill_text_editor.
PROCESS AFTER INPUT.
MODULE get_text_editor.
*Main Program.
DATA: g_editor TYPE REF TO cl_gui_textedit,
g_editor_container TYPE REF TO cl_gui_custom_container.
DATA: begin of it_get_comments occurs 0,
comments(255),
end of it_get_comments.
&----
*& Module GET_TEXT OUTPUT
&----
text
----
MODULE get_text OUTPUT.
perform fill_text_editor.
ENDMODULE. " GET_TEXT OUTPUT
&----
*& Module FILL_TEXT_EDITOR OUTPUT
&----
text
----
MODULE fill_text_editor OUTPUT.
IF g_editor IS INITIAL.
create control container
CREATE OBJECT g_editor_container
EXPORTING
container_name = 'TEXTCNTL_2000'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
TextEdit Control
CREATE OBJECT g_editor
EXPORTING
wordwrap_mode = 2
max_number_chars = 600
wordwrap_position = 120
parent = g_editor_container.
ENDIF.
IF psyst-ioper = 'DIS'.
CALL METHOD g_editor->set_readonly_mode
EXPORTING
readonly_mode = 0
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
ENDIF.
ENDMODULE. " FILL_TEXT_EDITOR OUTPUT
&----
*& Module GET_TEXT_EDITOR INPUT
&----
text
----
MODULE get_text_editor INPUT.
CLEAR it_get_comments.
REFRESH it_get_comments.
CALL METHOD g_editor->set_wordwrap_behavior
EXPORTING
wordwrap_mode = -1
wordwrap_position = 80
WORDWRAP_TO_LINEBREAK_MODE = BOOL_INITIAL
EXCEPTIONS
error_cntl_call_method = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV
ENDIF.
CALL METHOD g_editor->get_text_as_r3table
IMPORTING
table = it_get_comments[]
EXCEPTIONS
error_dp = 1
error_cntl_call_method = 2
error_dp_create = 3
potential_data_loss = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDMODULE. " GET_TEXT_EDITOR INPUT
&----
*& Form FILL_TEXT_EDITOR
&----
text
----
--> p1 text
<-- p2 text
----
FORM fill_text_editor.
IF g_editor IS INITIAL.
create control container
CREATE OBJECT g_editor_container
EXPORTING
container_name = 'TEXTCNTL_2000'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
TextEdit Control
CREATE OBJECT g_editor
EXPORTING
parent = g_editor_container.
ENDIF.
IF psyst-ioper = 'DIS'.
CALL METHOD g_editor->set_readonly_mode
EXPORTING
readonly_mode = 0
EXCEPTIONS
error_cntl_call_method = 1
invalid_parameter = 2
OTHERS = 3.
ENDIF.
CLEAR it_get_comments.
REFRESH it_get_comments.
Note Please fill your internal table here.
CALL METHOD g_editor->set_text_as_r3table
EXPORTING
table = it_get_comments[]
EXCEPTIONS
error_dp = 1
error_dp_create = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " FILL_TEXT_EDITOR
2007 Sep 12 1:42 PM
hi prasant
i want to display context menu in text editor. for that i m using this method.
there is also another method SET_CONTEXTMENU_VIA_SAPGUI which is also protected.
can u please suggest me some wayout to this.
regards
ravish
2007 Sep 17 5:53 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |