Application Development 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: 

FM related to text editor

Former Member
0 Kudos

hi all

i want the code for various function modules related to text editor ie i want code for them .

class name <b>cl_gui_textedit</b>

FM

1) <b>SET_LOCAL_CONTEXTMENU_MODE </b>set visibility of local context menu of TextEdit control

2)<b>SET_NAME </b>Sets the Name

3)<b>SET_TEXTELEMENTS </b>send textelements for the symbols to control

4) <b>COMMENT_LINES </b>comment a range of lines

also FM related to drag drop in editor

<b>IF_CACHED_PROP~SET_PROP</b> Set a Property

<b>IF_DRAGDROP~ONDRAG </b>Call Drag Source

<b>IF_DRAGDROP~ONDROP </b>Call Drop Target

<b>IF_DRAGDROP~ONDROPCOMPLETE </b>Call Drag Source Once Drop Completed Successfully

<b>

any help on these will be highly appreciated</b>

regards

ravish

2 REPLIES 2

Former Member
0 Kudos

Hi Ravish,

By the way.....Why do you need these??

*set visibility of local context menu entries of TextEdit control

METHOD SET_LOCAL_CONTEXTMENU_MODE .

IF ( ( visible = TRUE )

OR ( visible = FALSE ) ) .

CALL METHOD SET_PROPERTY

EXPORTING

PROPERTY = 'LocalContextMenuVisible'

VALUE = visible

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

RAISE ERROR_CNTL_CALL_METHOD.

ENDIF.

  • echo current property of control in attribute (public, read-only) of

  • class. Thus calls to get method and eventually necessary flushes can

  • be avoided and performance is improved.

M_local_contextmenu_MODE = visible.

ELSE.

RAISE INVALID_PARAMETER.

ENDIF.

ENDMETHOD. " SET_LOCAL_CONTEXTMENU_MODE

METHOD SET_TEXTELEMENTS .

  • DATA: TAB TYPE TEXTPOOL OCCURS 100 WITH HEADER LINE,

DATA: TAB TYPE standard table of TEXTPOOL initial size 20,

wa_tab like line of tab,

WA_SYMBOLS_TEXT_TABLE TYPE TEXT_SYMBOLS.

  • fill textelements into special table tab

READ TEXTPOOL 'sapltextedit_textelements'

INTO TAB LANGUAGE SY-LANGU.

IF SY-SUBRC NE 0.

  • if language sy-langu is not available try english

READ TEXTPOOL 'sapltextedit_textelements'

INTO TAB LANGUAGE 'EN'.

  • if the english language also is not available use german

IF SY-SUBRC NE 0.

READ TEXTPOOL 'sapltextedit_textelements'

INTO TAB LANGUAGE 'DE'.

ENDIF.

ENDIF.

  • for every tooltip call method of control to send

  • ID and text to control

LOOP AT TAB into wa_tab.

MOVE-CORRESPONDING wa_TAB TO WA_SYMBOLS_TEXT_TABLE.

CALL METHOD CALL_METHOD

EXPORTING

METHOD = 'SetTextSymbol'

P_COUNT = 2

P1 = WA_SYMBOLS_TEXT_TABLE-key

P2 = WA_SYMBOLS_TEXT_TABLE-entry

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

RAISE ERROR_CNTL_CALL_METHOD.

ENDIF.

ENDLOOP.

ENDMETHOD. " set_textelements

METHOD COMMENT_LINES .

  • Invalid line numbers are handled by the control itself:

  • <= 0 : interpreted as go to first line

  • > last line: interpreted as go to last line

if M_HIGHLIGHT_COMMENTS_MODE eq true.

if ( ENABLE_EDITING_PROTECTED_TEXT ne false ).

call method SET_ENABLE_EDITING_PROTECTED

exporting

mode = true.

endif.

CALL METHOD CALL_METHOD

EXPORTING

METHOD = 'CommentLines'

P_COUNT = 2

P1 = FROM_LINE

P2 = TO_LINE

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

RAISE ERROR_CNTL_CALL_METHOD.

ENDIF.

if ( M_ENABLE_EDITING_PROTECTED ne false ).

  • per default the following call disables editing of protected text

call method SET_ENABLE_EDITING_PROTECTED.

endif.

endif.

ENDMETHOD.