cancel
Showing results for 
Search instead for 
Did you mean: 

How to set Focus?

Former Member
0 Kudos

Hi Guys,

My requirement like : I have Button for finding input provided text from the table, after clicking that button it reaches to the corresponding text of the table but it doesn't set the Focus of that Text, kindly let me know How to Set Focus of that text?.... if you have any idea......

Thanks,

Ravin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

in this code 'IP_FIRSTNAME' is the ID ( id is the first field in properties of ui elements) of the ui element to which iam setting the focus. in my case an input field.

i have wriiten this code in modify view.

regards

chythanya

Former Member
0 Kudos

Actually, i want to set focus on the result of my provided input. I want to highlight that particular field which i founded in table.

Former Member
0 Kudos

hi ravin......

if you want ot highlight it then pass the value '2' to its cell design property.

---regards,

alex b justin

Former Member
0 Kudos

Hi,

The process is:

I enter a string in the input feild and click of search it searchs for the particular string in the table.

if any entry is found that particular row attribute is Highlighted .

because of the accessibility reason I need to set focus on the particular entry which I have Highlighted in the table.

Regards,

Ajay

Former Member
0 Kudos

hi ajay.......

what you can do is......

consider your table is having two columns..... have another attribute in the node of type string... bound it to the celldesign of the table column.....

so now when you read the table for the entry... if you find it, fill the string attribute with value 2. now it will get highlghted.

---regards,

alex b justin

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Guys,

Problem is solved and it's working fine. Thanks for all your contribution.

Ravin

Former Member
0 Kudos

Hi

u said after clicking the button, it reaches the corresponding text in ur table. get the id of that particular cell editor and set the focus on it.

regrads

chythanya

Former Member
0 Kudos

hi ravin.....

use the method request_focus_view_elem in the interface if_wd_view.

---regards,

alex b justin

Former Member
0 Kudos

Hi

to the set the focus to a particular field, u can try the following code:

data: lr_elem type ref to if_wd_view_element.

lr_elem = view->get_element( 'IP_FIRSTNAME' ).

if lr_elem is bound.

view->request_focus_on_view_elem( lr_elem ).

endif.

Hope this helps

chythanya

Former Member
0 Kudos

Hi Chaitanya,

What do u mean by 'IP_FIRSTNAME' in your below code? Is it attribute or what? Kindly highlight it in more detail...

Ravin

Former Member
0 Kudos

hi ravin....

this works:



data:
  
    lr_element type ref to if_wd_view_element.
    
    CALL METHOD VIEW->GET_ELEMENT
      EXPORTING
        ID      = 'INPUT2'      * id of the element in layout
      RECEIVING
        ELEMENT = lr_element
        .
    
    CALL METHOD VIEW->REQUEST_FOCUS_ON_VIEW_ELEM
      EXPORTING
        VIEW_ELEMENT    = lr_element
*        CONTEXT_ELEMENT =
        .
    

---regards,

alex b justin

Former Member
0 Kudos

here view means , it belongs to interface or class

Former Member
0 Kudos

here view represents what?