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

custom control

Former Member
0 Likes
480

hi all,

i need to create a text field in which there could be enter multiple line and all the line should be visible.(on a screen )

so tell me how to go about the same

what is the name of class to be used

and what would be the coding for this

please help me with that also

points ll be surely awared

anuj

3 REPLIES 3
Read only

Former Member
0 Likes
420

hi,

Try to use FormattedTextView for displaying text with multiple lines. It also supports formatting options like bold, italic as well as more fancy stuff like bullet lists, etc. It's basically xhtml

regards,

Omkar.

Read only

0 Likes
420

hi Omkaram,

thanks for early reply

byt will this work in my case even

i have to also store the data in the data base table also

plz help me with some coding

also explain me about

FormattedTextView

thanks

anuj

Read only

AlexGiguere
Contributor
0 Likes
420

Hi Anuj, first put a custom container on your screen, here the CC has been name MY_TEXT, fell free to explore the attributes and methods of these class.

after in the PBO you have to do,

IF g_editor IS INITIAL.

  • create control container

CREATE OBJECT g_editor_container

EXPORTING

container_name = 'MY_TEXT'

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.

  • g_mycontainer = 'MY_TEXT'.

  • create calls constructor, which initializes, creats and links

  • TextEdit Control

CREATE OBJECT g_editor

EXPORTING

parent = g_editor_container

wordwrap_mode =

  • cl_gui_textedit=>wordwrap_off

cl_gui_textedit=>wordwrap_at_fixed_position

  • cl_gui_textedit=>WORDWRAP_AT_WINDOWBORDER

wordwrap_position = 256

wordwrap_to_linebreak_mode = cl_gui_textedit=>true.

CALL METHOD g_editor->set_toolbar_mode

EXPORTING

toolbar_mode = cl_gui_textedit=>false.

CALL METHOD g_editor->set_statusbar_mode

EXPORTING

statusbar_mode = cl_gui_textedit=>false

EXCEPTIONS

error_cntl_call_method = 1

invalid_parameter = 2

OTHERS = 3.

CALL METHOD g_editor->set_readonly_mode

EXPORTING

readonly_mode = cl_gui_textedit=>true.

ENDIF.

CALL METHOD g_editor->set_text_as_r3table

EXPORTING

table = gt_text

EXCEPTIONS

OTHERS = 0.

IF gt_text IS NOT INITIAL.

CALL METHOD g_editor->highlight_lines

EXPORTING

from_line = 1

highlight_mode = cl_gui_textedit=>true

to_line = 2

EXCEPTIONS

OTHERS = 0.

ENDIF.

In the PAI, you have to put something in the GT_TEXT table then it will be display on the screen.

You will have to declare this variables also:

DATA:

g_editor TYPE REF TO cl_gui_textedit,

  • reference to custom container: necessary to bind TextEdit Control

g_editor_container TYPE REF TO cl_gui_custom_container,

gt_text TYPE STANDARD TABLE OF char80s.

Regards