cancel
Showing results for 
Search instead for 
Did you mean: 

Focus on UI element

Former Member
0 Kudos

This seems to be a trivial question, but I couldn't find the answer.

How can you programmaticaly give an ui element the focus or at least make sure it's visible (similar to html anchors) ?

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member485701
Active Participant
0 Kudos

Hi Pieter,

You have a Ui Element like inputfield

(a)If you want to focus this inputfield then

IWDInputField input=(IWDInputField)view.get(id of inputfield);

input.requestFocus();

if you want make it visible:-

input.setVisible(WDVisible.NONE);

or

input.setVisible(true);

Regards,

Praveen

Former Member
0 Kudos

requestFocus() is what I need. But I have to implement this in the doModifyView. Does anyone have an elegant solution on how to do this on demand (and not everytime) ?

Former Member
0 Kudos

Hi,

unfortunately you can only access your UI elements only in WDDoModifyView and thus you can set its focus over there. If you need to set its focus only in case of some event then you can set some flag in that event and in WDDoModifyView.. You can first check the flag and based on that you can decide to set its focus.

Regards,

Murtuza

former_member485701
Active Participant
0 Kudos

Hi,

Yes you can do this.

keep a global varibale,

(a) boolean checkRequestFocus=false;

(b)and update it true on your demand and check in wdDomodifyView , if it is true

then call requestFocus on that element.

Regards,

Praveen

Former Member
0 Kudos

Hi Pieter,

To control the visibility, there is a property called visible for each UI element. If u want to do it programmatically,u can use this code in wdDoModifyView method

e.g. i m giving u the code for input field

IWDInputField field = (IWDInputfield)view.getElement("ur element id");

field.setVisible(true/false);

regards

Sumit