cancel
Showing results for 
Search instead for 
Did you mean: 

How to get cursor in input field?

ira_smailer
Explorer
0 Kudos

Hi experts,

I have an input field, this is the only input field on my view ( a popup). How can I place the cursor in this input field so that the user can just start entering values? Otherwise the user has to first click on the field to make it active. The InputField UI element has no attribute relating to cursor, so is there some different way??

Thanks and regards,

Ira

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Try to use REQUEST_FOCUS() method of IF_WD_VIEW_CONTROLLER .

Pass the input field reference to the method.

Thanks,

aditya.

Former Member
0 Kudos

Aditya Karanth is right.

using the following example coding:


  DATA:
     lo_Node      type ref to If_Wd_Context_Node,
     lo_Elem      type ref to If_Wd_Context_Element,
     lo_ctrl    TYPE REF TO IF_WD_VIEW_CONTROLLER .

  lo_ctrl = wd_this->wd_get_api( ).
  lo_Node = wd_Context->get_Child_Node( Name = 'NODE' ).
  lo_Elem = lo_Node->get_element( ).

* set cursor
  CALL METHOD lo_ctrl->REQUEST_FOCUS
    EXPORTING
      CONTEXT_ELEMENT = lo_Elem
      ATTRIBUTE       = 'I_MATNR'
      .
"here, I_MATNR is my  context attribute bound to input field named "Material Number"

However, this method needs your context node's cardinality as '1..1'. In fact, your input attributes are jsut '1..1'..

Answers (1)

Answers (1)

ira_smailer
Explorer
0 Kudos

Thank you for your hints. I am now able to place the cursor in my input field. Especially once I realized I need to use a context node instead of just a context attribute