cancel
Showing results for 
Search instead for 
Did you mean: 

Current focus

Former Member
0 Kudos

Hi,

I'm using this code to move the focus on a specific IUElement:

IWDAttributeInfo attribute = wdContext.nodeZ_NouInteressat().getNodeInfo().

getAttribute(IPrivateDadesClient.IZ_NouInteressatElement.VKORG__001);

wdThis.wdGetAPI().requestFocus

(wdContext.currentZ_NouInteressatElement(),attribute);

But, How can I know where the focus is?

Thanks,

Ricard.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Oscar (or Ricard ,

There is no built-in way to get current focus.

However, you can track focus yourself up to certain extent.

Any time action is invoked, it occurs on element in focus: onAction in Button/Link2Action, onSelect in DropDown, onEnter in InputField. So if you use separate action handler for every control, or use add parameter to action to return ID of UI control, you may track control that fired action and hence focused. Special handling must be done for controls inside Table.

So it is possible even it's quite complex. Then only question is "What's for?"

VS

Former Member
0 Kudos

Hi everybody,

In my form there are several InputFields and DropDownByKey. My objective is that whenever the user pushes the Intro key, the cursor moves to the following IUElement.

To do that, I created a string[] that contains the name of each control (ordered by the position on the screen). When an Intro is performed, I need to know on which control has done it. After that, I search the control name into the string[] and I put the focus on the following IUElement of the string[].

I think that is a workaround, but I don’t know any other way to implement that behavior under WD.

Thanks,

Ricard.

Former Member
0 Kudos

Hi Oscar,

If you want to go ahead with this work-around of yours, then you can use event parameter mapping.

Can you just give details about this "Intro" thing?

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

"Intro" is the Enter key that causes the fire of onEnter or onSelect event.

Thanks,

Ricard.

Former Member
0 Kudos

Oscar/Ricard

You can try something like this:

In your wdDoModifyView() write a code like this:


if(firstTime){
IWDInputField input = (IWDInputField)view.getElement("Input1");
input.mappingOfOnEnter().addParameter("uiElementID",input.getId());
//do the same for all inputfields.

IWDDropDownByIndex drop = (IWDDropDownByIndex)view.getElement("Drop1");
drop.mappingOfOnSelect().addParameter("uiElementID",drop.getId());
//do the same for all dropdowns.
}

Now assuming that your onEnter and onSelect eventhandler is the same, it should do something like:


public void onActionEnter(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String uiElementID ){
wdComponentAPI.getMessageManager().reportSuccess("Fired from:" + uiElementID);
//do further processing. 
}

Regards,

Satyajit.

Answers (1)

Answers (1)

former_member182372
Active Contributor
0 Kudos

Hi Ricard,

I don`t thik it is possible on WD server side.

Best regards, Maksim Rashchynski.