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

CL_GUI_TEXTEDIT Problems with Indent

Former Member
0 Likes
1,120

Hello

I'm working with the CL_GUI_TEXTEDIT control for displaying/changing text.

The text is set via the method

set_text_as_r3table

.

After setting the text I would like to format it by indenting individual lines.

To indent the lines I use the method indent_lines in the way:

CALL METHOD edit->indent_lines
        EXPORTING
          from_line                     = 1
          to_line                       = 1.

Now the issue is as follows.

I start the application and create the control. Then I set the text in the control

via

SET_TEXT_AS_R3TABLE

and do the indenting.

The result is

(

Ite m 1

AC E 5.4 & TAO 1. 4

AN D

Item 2

SA P

....

After the next PAI, PBO cycle (i.e. refilling the control again with

SET_TEXT_AS_R3TABLE

and

redoing the indenting the result is:

(

Item 1 (indented twice)

ACE 5.4 & TAO 1.4 (indented 3time)

AND (indented one time)

Item 2 (indented twice)

....

(unfortunetaly the indenting is lost in this tool as well, I tried to make it clear by the comments in brackets, sorry)

And this is what I would have expected also after the start at the first display.

So I've no clue what happens at the first time. I tried to fix the issue to add

CL_GUI_CFW=>flush

calls, to position the cursor with

set_selection_pos_in_line

or with

edit->auto_redraw

. No change.

Any ideas to solve the issue are welcome.

Many thanks and regards

Hans-Ludwig

6 REPLIES 6
Read only

Former Member
0 Likes
968

Hi Hans-Ludwig ,

I tried with the standard program which SAP is providing for the scenario what you described, it is working fine. Please check this Program.<b>SAPTEXTEDIT_TEST_EVENTS</b>

Also Check the Help Here. <a href="here .http://help.sap.com/saphelp_erp2005/helpdata/en/eb/549e36cf0ecb7de10000009b38f889/frameset.htm">here .http://help.sap.com/saphelp_erp2005/helpdata/en/eb/549e36cf0ecb7de10000009b38f889/frameset.htm</a>

Hope This Info Helps YOU.

<i>Reward Points If It Helps YOU.</i>

Regards,

Raghav

Read only

0 Likes
968

Hi,

thanks for your quick reply.

Unfortunetaly the example does not help me, since the control is already displayed. I had also a look into the

SAPTEXTEDIT_TEST_2 program. Of course here the indenting works also.

My issue is that I need to load the coding from DB and do the indenting and get it displayed at the first time indented, and this 'at first time indented' I do not get working. But it must be possible to do somehow, since the ABAP editor does the same, doesn't it?

Read only

Former Member
0 Likes
968

Hi,

I think it does not work for the first time around as the control has not been sent to frontend yet.

Try using the following method after SET_TEXT_AS_R3TABLE

and before edit->indent_lines call,

CALL METHOD cl_gui_cfw=>flush.

Hope this helps..

Sri

Read only

Former Member
0 Likes
968

Hi, thank you again.

I tryed that one also already. It does not solve the issue.

I results in even more spaces :

with flush

(

I t e m 1

AC E 5 . 4 & T A O 1 . 4

AND

Item 2

SAP R/3 ENTERPRISE 47X200 - SAP R/3 Enterprise Server

)

without flush

(

Ite m 1

AC E 5.4 & TA O 1. 4

AND

Read only

0 Likes
968

Hi,

It just occured to me. Are you calling method set_readonly_mode before indent_lines to disable the editor?

If that is the case then try calling,

set_readonly_mode after indent_lines if possible

or

first call,

set_readonly_mode with readonly_mode = false

and then call,

indent_lines

and then again,

set_readonly_mode with readonly_mode = true.

Hope this helps..

Sri

Read only

0 Likes
968

That is exactly what I'm already doing. Also an additional set_readonly_mode with readonly_mode = false and set_readonly_mode with readonly_mode = true does not do a change.