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: 

cl_gui_textedit: check if editor has the cursor

0 Kudos
746

Hi!

Short question: I have a text editor defined with cl_gui_textedit embedded in a custom control. How can I check if the editor has the cursor? In my tests if the cursor stands on the editor, the statement

get cursor field...

doesn't return anything.

What other possibilities do I have?

Thanks

Alexander.

4 REPLIES 4

muttepawar-2009
Active Participant
392

Set Cursor on Text Editor CL_GUI_TEXTEDIT

I've created a text editor using CL_GUI_TEXTEDIT on a custom container (CL_GUI_CUSTOM_CONTAINER) and I need to set the active cursor on it.

I've tried with the method SET_FOCUS but it doesn't work.

CALL METHOD o_textedit->set_focus

EXPORTING

control = o_textedit.

Also I've tried with method GO_TO_LINE by passing the first line but it

doesn't work either. It only selects the first line but the cursor isn't

positioned on it, I mean, I need to click on the text editor to start to write.

CALL METHOD o_textedit->go_to_line

EXPORTING

line = 1.

Anyone knows how to do this?

Thanks in advance.

--------------------------------------------------------------

Hi,

try like this.

Data: editor2 TYPE REF TO cl_gui_textedit.

CALL METHOD CL_GUI_CONTROL=>SET_FOCUS

EXPORTING

CONTROL = editor2.

-----------------

Hope this will be usefull--------------------------------

0 Kudos
392

Hi Prashant,

thank you, I eventually solved it with the method get_focused.

0 Kudos
392

Hi Prashant,

thank you, but I don't want to set focus. Rather I would like to find out if the cursor has been set on the editor.

BR

Alexander

0 Kudos
392

Was get_focused a typo for get_focus, did you try to also flush with CALL METHOD cl_gui_cfw=>flush.?