on 09-13-2014 5:38 AM
Hi Experts,
I have a requirement in WDA table, when user click on Enter button from key board, cursor should move to the next row in table and without clicking on that columns user should type the message,
Right now user is able to type the message only after clicking on that cell.
Please guide me
Hi,
Explanation in Details;
I have 1 node in my context,
I use this node in table on layout
In table I put input fields and bind them to the context.
On input field marked in the above image, onenter event associated "MOVECUSROR"
Coding for MOVECURSOR as below
data: LO_NODE type ref to IF_WD_CONTEXT_NODE,
LO_ELEMENT type ref to IF_WD_CONTEXT_ELEMENT,
LO_RUNTIMEAPI type ref to IF_WD_VIEW_CONTROLLER,
lv_index type I.
LO_NODE = WD_CONTEXT->GET_CHILD_NODE( 'DIA' ).
lv_index = lo_node->GET_LEAD_SELECTION_INDEX( ) ." Assuming lead selection is not set to next row on enter action in the input field.
lv_index = lv_index + 1. "if the lead selection is set next row after on enter event just remove lv_index
lo_node->move_next( ).
LO_ELEMENT = LO_NODE->GET_ELEMENT( lv_index ).
LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ).
LO_RUNTIMEAPI->REQUEST_FOCUS( ATTRIBUTE = 'ICDDESC' CONTEXT_ELEMENT = LO_ELEMENT ).
Field in my context is 'ICDDESC' on which I am pressing enter.
Please guide.
-Regards
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am referring as
LO_NODE = WD_CONTEXT->GET_CHILD_NODE( 'DIAGNOSE' ).
lv_index = lo_node->GET_LEAD_SELECTION_INDEX( ) ." Assuming lead selection is not set to next row on enter action in the input field.
lv_index = lv_index + 1. "if the lead selection is set next row after on enter event just remove lv_index
lo_node->move_next( ).
LO_ELEMENT = LO_NODE->GET_ELEMENT( lv_index ).
LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ).
LO_RUNTIMEAPI->REQUEST_FOCUS( ATTRIBUTE = 'ICDDESC' CONTEXT_ELEMENT =LO_ELEMENT ).
Hi Rohit,
Please check with following code.
LO_NODE = WD_CONTEXT->GET_CHILD_NODE( 'DIAGNOSE' ).
lv_index = lo_node->GET_LEAD_SELECTION_INDEX( ) .
lv_index = lv_index + 1.
LO_NODE->SET_LEAD_SELECTION( lv_index ).
LO_ELEMENT = LO_NODE->GET_ELEMENT( ).
LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ). LO_RUNTIMEAPI->REQUEST_FOCUS( ATTRIBUTE = 'ICDDESC' CONTEXT_ELEMENT =LO_ELEMENT ).
Thank You,
Harsha
Thanks Harsha,
LO_NODE->SET_LEAD_SELECTION( lv_index ). this is giving me error , so I use
lo_node->set_lead_Selection_index( index = lv_index ).
And working fine.
Thanks for the kind help.
I am closing this.
-Regards
Rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rohit,
While setting cursor, you no need to set lead index of table. Also no need to get node reference explicitly, as you can just get it from context element of current cell.
Please refer the below code snippet
DATA view_ctrl TYPE REF TO if_wd_view_controller.
DATA lo_element TYPE REF TO if_wd_context_element.
DATA lo_node TYPE REF TO if_wd_context_node.
DATA lv_index TYPE i.
"get current context element
lo_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
"get node from context element
lo_node = lo_element->get_node( ).
"get current line
lv_index = lo_element->get_index( ).
lv_index = lv_index + 1.
"Get next context element
FREE lo_element.
lo_element = lo_node->get_element( index = lv_index ).
IF lo_element IS BOUND.
view_ctrl = wd_this->wd_get_api( ).
view_ctrl->request_focus(
EXPORTING
context_element = lo_element " Context Element
attribute = 'ICDDESC' " Context Attribute
).
ENDIF.
Hope this simplifies your work.
Regards,
Rama
Hi Rohit,
I have tried your code, it doesn't show any error and the same time nothing happened.
DATA: lo_node TYPE REF TO if_wd_context_node,
lo_element TYPE REF TO if_wd_context_element,
lo_runtimeapi TYPE REF TO if_wd_view_controller,
lv_index TYPE i.
lo_node = wd_context->get_child_node( name = 'TABLE').
lv_index = lo_node->get_lead_selection_index( ) .
lv_index = lv_index + 1.
lo_node->set_lead_selection_index( index = lv_index ).
lo_element = lo_node->get_element( ).
lo_runtimeapi = wd_this->wd_get_api( ).
lo_runtimeapi->request_focus( attribute = 'P_ID' context_element = lo_element ).
here my node name is 'table' and its corresponding attribute is P_ID. I don't know where I am doing the mistake. If you found, say me the same.
thanks in advance.
regards,
kishore
Hi Rohit,
Please check the following code.
data: LO_NODE type ref to IF_WD_CONTEXT_NODE,
LO_ELEMENT type ref to IF_WD_CONTEXT_ELEMENT,
LO_RUNTIMEAPI type ref to IF_WD_VIEW_CONTROLLER,
lv_index type I.
LO_NODE = WD_CONTEXT->GET_CHILD_NODE( 'TAB_DATA' ).
lv_index = lo_node->GET_LEAD_SELECTION_INDEX( ) ." Assuming lead selection is not set to next row on enter action in the input field.
lv_index = lv_index+1. "if the lead selection is set next row after on enter event just remove lv_index
LO_ELEMENT = LO_NODE ->GET_ELEMENT( lv_index ).
LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ).
LO_RUNTIMEAPI->REQUEST_FOCUS( ATTRIBUTE = 'CITYFROM' CONTEXT_ELEMENT = LO_ELEMENT ).
Method REQUEST_FOCUS_ON_VIEW_ELEM of if_wd_view, can also be used to place cursor on particular input field.
Regards,
Harsha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi harsha,
I checked with you code,
It is changing the LEAD SELECTION only, but not placing cursor on the editable column to edit the value.
I need to click, then I can change the value, please check attached screen shot for reference
Check my cursor is in the same line where I entered "Hello", but it should be on line of lead selection
Below is the UI elements of my table, in attributes I am using "DIAG_ICDDESC"
Code is as follows
LO_ELEMENT = LO_NODE->GET_ELEMENT( lv_index ).
LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ).
LO_RUNTIMEAPI->REQUEST_FOCUS( ATTRIBUTE = 'DIAG_ICDDESC' CONTEXT_ELEMENT = LO_ELEMENT ).
Please guide me if I am wrong.
-Regards
Rohit
Hi Rohit,
Can you try with the following code.
I guess the code is not pointing to the new element(next row), try passing the correct element
LO_ELEMENT = LO_NODE->GET_ELEMENT( lv_index + 1 ).
LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ).
LO_RUNTIMEAPI
->REQUEST_FOCUS( ATTRIBUTE = 'DIAG_ICDDESC' CONTEXT_ELEMENT = LO_ELEMENT ).
Thank You,
Harsha
Hi Harsha,
I have already incremented the lv_index values before passing to LO_ELEMENT.
lv_index = lv_index + 1.
LO_ELEMENT = LO_NODE->GET_ELEMENT( lv_index ).
LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ).
LO_RUNTIMEAPI->REQUEST_FOCUS( ATTRIBUTE = 'DIAG_ICDDESC' CONTEXT_ELEMENT = LO_ELEMENT ).
But it is not placing the cursor to correct cell.
Please guide If I am wrong.
-Regards
Rohit
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.