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

Try to use CL_GUI_TEXTEDIT

Former Member
0 Likes
2,626

Hi all,

i try to use CL_GUI_TEXTEDIT (thanks to Duraifaj) in

this little report:

REPORT Z065_TEST2.

*

PARAMETERS: P_PERNR LIKE PA0000-PERNR.

*

DATA: DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,

EDITOR TYPE REF TO CL_GUI_TEXTEDIT.

*

DATA: TEXTLINES TYPE TABLE OF TLINE-TDLINE,

WA_TEXT TYPE TLINE-TDLINE.

*

AT SELECTION-SCREEN OUTPUT.

*

DATA: REPID LIKE SY-REPID.

DATA: FILE_NAME LIKE SAPB-SAPFILES,

FILE_TYPE LIKE BDN_CON-MIMETYPE.

*

REPID = SY-REPID.

*

IF DOCKING IS INITIAL.

*

CREATE OBJECT DOCKING

EXPORTING

REPID = REPID

DYNNR = SY-DYNNR

SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_BOTTOM

EXTENSION = '300'

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5.

*

ENDIF .

*

IF EDITOR IS INITIAL.

CREATE OBJECT EDITOR

EXPORTING

PARENT = DOCKING

WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION

WORDWRAP_POSITION = 256

MAX_NUMBER_CHARS = 100000.

*

ENDIF .

*

WA_TEXT = 'First Line'. APPEND WA_TEXT TO TEXTLINES.

WA_TEXT = 'Second Line'. APPEND WA_TEXT TO TEXTLINES.

*

CALL METHOD EDITOR->SET_TEXT_AS_R3TABLE

EXPORTING

TABLE = TEXTLINES

EXCEPTIONS

OTHERS = 1.

*

START-OF-SELECTION.

*

CALL METHOD EDITOR->GET_TEXT_AS_R3TABLE

IMPORTING

TABLE = TEXTLINES

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

ERROR_DP_CREATE = 3

POTENTIAL_DATA_LOSS = 4

OTHERS = 5.

*

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

*

WRITE: / P_PERNR.

*

LOOP AT TEXTLINES INTO WA_TEXT.

WRITE: / WA_TEXT.

ENDLOOP.

*

END-OF-SELECTION.

My problem is, that i will position the editor

on a special point an the screen in an special size.

For example X = 10 10, Y = 20 100.

Is that Possible?

regards, Dieter

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,932

Hi Dieter,

that would be a property of the docking container and not of the textedit control. I don't think that this is possible. But you can check

<a href="http://help.sap.com/saphelp_nw2004s/helpdata/de/d3/2955360b00a115e10000009b38f839/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/de/d3/2955360b00a115e10000009b38f839/frameset.htm</a>

Maybe you could substitute your docking container by a splitter container.

Best regards,

Thomas

Hi all,

i try to use CL_GUI_TEXTEDIT (thanks to Duraifaj) in

this little report:

REPORT Z065_TEST2.

*

PARAMETERS: P_PERNR LIKE PA0000-PERNR.

*

DATA: DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,

EDITOR TYPE REF TO CL_GUI_TEXTEDIT.

*

DATA: TEXTLINES TYPE TABLE OF TLINE-TDLINE,

WA_TEXT TYPE TLINE-TDLINE.

*

AT SELECTION-SCREEN OUTPUT.

*

DATA: REPID LIKE SY-REPID.

DATA: FILE_NAME LIKE SAPB-SAPFILES,

FILE_TYPE LIKE BDN_CON-MIMETYPE.

*

REPID = SY-REPID.

*

IF DOCKING IS INITIAL.

*

CREATE OBJECT DOCKING

EXPORTING

REPID = REPID

DYNNR = SY-DYNNR

SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_BOTTOM

EXTENSION = '300'

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5.

*

ENDIF .

*

IF EDITOR IS INITIAL.

CREATE OBJECT EDITOR

EXPORTING

PARENT = DOCKING

WORDWRAP_MODE = CL_GUI_TEXTEDIT=>WORDWRAP_AT_FIXED_POSITION

WORDWRAP_POSITION = 256

MAX_NUMBER_CHARS = 100000.

*

ENDIF .

*

WA_TEXT = 'First Line'. APPEND WA_TEXT TO TEXTLINES.

WA_TEXT = 'Second Line'. APPEND WA_TEXT TO TEXTLINES.

*

CALL METHOD EDITOR->SET_TEXT_AS_R3TABLE

EXPORTING

TABLE = TEXTLINES

EXCEPTIONS

OTHERS = 1.

*

START-OF-SELECTION.

*

CALL METHOD EDITOR->GET_TEXT_AS_R3TABLE

IMPORTING

TABLE = TEXTLINES

EXCEPTIONS

ERROR_DP = 1

ERROR_CNTL_CALL_METHOD = 2

ERROR_DP_CREATE = 3

POTENTIAL_DATA_LOSS = 4

OTHERS = 5.

*

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

*

WRITE: / P_PERNR.

*

LOOP AT TEXTLINES INTO WA_TEXT.

WRITE: / WA_TEXT.

ENDLOOP.

*

END-OF-SELECTION.

My problem is, that i will position the editor

on a special point an the screen in an special size.

For example X = 10 10, Y = 20 100.

Is that Possible?

regards, Dieter

10 REPLIES 10
Read only

Former Member
0 Likes
1,932

call method textedit- >go_to_line

exporting

line = line

exceptions

error_cntl_call_method = 1.

Read only

Former Member
0 Likes
1,932

call method textedit- >set_selection_pos_in_line

exporting

line = line

pos = pos

exceptions

error_cntl_call_method = 1.

Read only

Former Member
0 Likes
1,932

Hi Thomas,

i have tried it, but i don't want to Position in the

editor, i will position the editor.

In my example i have set the editor at DOCK_AT_BOTTOM.

I will <b>position tne editor at line 10 Position 20

with the size of 10 lines with 80 characters</b>.

Is this possible?

Regards, Dieter

Read only

0 Likes
1,932

Hi Dieter

The docking container object has the following public methods:

set_height,

set_left,

set_top,

set_width.

You should be able to use those to adjust the positino of the docking conatiner and consequently your text box (as it is the text boxes parent). The text edit class also has these methods but you shouldn't need to use them if the docking container is set first (I think!). These take Int parameters but I don't know if this will be line and column values or a 'pixel' style.

Also, have you tried adjusting the wordwrap position to 80 rather than 256 in the CREATE OBJECT EDITOR code? I don't suppose it will affect the size but it might mean you won't have to be so specific with the width value.

Hope this helps

Andy

Read only

Former Member
0 Likes
1,933

Hi Dieter,

that would be a property of the docking container and not of the textedit control. I don't think that this is possible. But you can check

<a href="http://help.sap.com/saphelp_nw2004s/helpdata/de/d3/2955360b00a115e10000009b38f839/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/de/d3/2955360b00a115e10000009b38f839/frameset.htm</a>

Maybe you could substitute your docking container by a splitter container.

Best regards,

Thomas

Read only

0 Likes
1,932

Hi, Dieter!

You can use a dialogbox like:

DATA: o_dialogbox TYPE REF TO cl_gui_dialogbox_container,
      editor      TYPE REF TO cl_gui_textedit.
CREATE OBJECT o_dialogbox
            EXPORTING top     = 50
                      left    = 200
                      height  = 150
                      width   = 500
                      caption = 'Caption'.
CREATE OBJECT editor
            EXPORTING parent = o_dialogbox.

If you don't like dialogbox, you can use a custom container. Create a dynpro screen, draw a container in it (give it some name, in my example it's SCREEN_CONT) and then use it like:

DATA: o_custom TYPE REF TO cl_gui_custom_container,
      editor   TYPE REF TO cl_gui_textedit.
CREATE OBJECT o_custom
          EXPORTING container_name = 'SCREEN_CONT'.
CREATE OBJECT editor
            EXPORTING parent = o_custom.

Hope this helps.

Regards,

Igor

Read only

Former Member
0 Likes
1,932

Hi,

i have tried it in this way,

IF DOCKING IS INITIAL.

*

CREATE OBJECT DOCKING

EXPORTING

REPID = REPID

DYNNR = SY-DYNNR

SIDE = CL_GUI_DOCKING_CONTAINER=>DOCK_AT_BOTTOM

EXTENSION = '300'

EXCEPTIONS

CNTL_ERROR = 1

CNTL_SYSTEM_ERROR = 2

CREATE_ERROR = 3

LIFETIME_ERROR = 4

LIFETIME_DYNPRO_DYNPRO_LINK = 5.

*

ENDIF .

*

CALL METHOD DOCKING->SET_HEIGHT

EXPORTING

HEIGHT = 150.

CALL METHOD DOCKING->SET_WIDTH

EXPORTING

WIDTH = 500.

CALL METHOD DOCKING->SET_TOP

EXPORTING

TOP = 50.

CALL METHOD DOCKING->SET_LEFT

EXPORTING

LEFT = 200.

*

EXIT.

but the set.. haven't the right effect. it's only

set on left, buttom ... But not on the position which i whant. I think there is no solution.

thanks for help.

Regards, Dieter

Read only

0 Likes
1,932

Hi Dieter

I've noticed that as well. I think it is because your container is a docking container and having it docked possibly overides some of these settings. There is a method called 'float' which is supposed to switch the container between floating and docked and I suspect this would allow you to re-size and re-position the cotnianer. However, when I try and use it the container disappears completely - I guess I'm getting something wrong!

Do you need the container to be a docking type? If not then you could try using a different one - I've not had much luck with the splitter one as I keep getting a short dump. Failing that you might need to use the cl_gui_custom_container class in which case you will need to create the screens with Screen Painter and set it all up that way.

Kind regards

Andy

Read only

0 Likes
1,932

Hi Dieter

I don't know if you are aware of this but if you go to:

SE80 | Environment | Controls Examples

then you will find a bunch of examples including various containers that make use of screens.

Hope it helps

Andy

Read only

Former Member
0 Likes
1,932

Hi,

no really effect what i want,

thanks

regards, Dieter