cancel
Showing results for 
Search instead for 
Did you mean: 

Using Tabindex to control cursor

Former Member
0 Kudos

Hello,

it's possible to set the tabindex of input elements in Web Dynpro?

I want to use the <Tab>-Key to jump from one inputfield to another.

Or: It is possible the set the cursor to a specific inputfield?

Thank a lot,

Juergen

Accepted Solutions (0)

Answers (2)

Answers (2)

BeGanz
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Jürgen,

just for completing Stephan's note about the IWDViewController interface.

The generic IWDViewController-API can easily be accessed in your view controller by using the shortcut-variable

wdControllerAPI (=wdThis.wdGetAPI)

So your code could look like this:

 wdControllerAPI.requestFocus(wdThis.wdGetGoAction());

Greetings, Bertram

Former Member
0 Kudos

Thank you for this addition Bertram, doesn't make sense really to show somebody what he can get but not where he can get it (like i did ;).

Best, Stefan

Former Member
0 Kudos

Hi Jürgen,

please have a look at the IWDViewController API:

  /**
   * Requests to change the keyboard input focus to the UI element whose
   * primary purpose is to raise an event bound to the given action.
   * If there is more than one such UI element, then it is undefined which UI
   * element is chosen. It is also undefined which focus request wins if there
   * are several ones. The request may silently fail, but is guaranteed not to
   * throw an exception.
   * 
   * UI elements (e.g. table) that trigger events (e.g. "onLeadSelect"), but are
   * not primarily used to do so, are probably considered with lower priority
   * or not at all. As a rule of thumb, if disabling the action disables the
   * whole UI element, then that UI element is primarily used to trigger the
   * event bound to that action.
   * 
   * Example: If you have a button whose "onAction" event is bound against the
   * action XYZ and no other UI element event is bound against XYZ, then a
   * <code>wdThis.wdGetAPI().requestFocus(wdThis.wdGetXYZAction())</code> will
   * focus on that button.
   * 
   * Note how this allows to keep controller code independent of the UI, even
   * of IDs used for UI elements. If the button in the example above is later
   * replaced by a <code>LinkToAction</code> or some fancy new icon button that
   * lives inside a tray's header, the code to request focus remains unaffected.
   */
  public void requestFocus(IWDAction action);

  /**
   * Requests to change the keyboard input focus to the UI element whose
   * primary use is to edit a property bound to the given attribute.
   * If there is more than one such UI element, then it is undefined which UI
   * element is chosen. It is also undefined which focus request wins if there
   * are several ones. The request may silently fail, but is guaranteed not to
   * throw an exception.
   * 
   * UI elements that are read-only or disabled are not considered at all.
   * 
   * To identify a given attribute uniquely at runtime, you must specify the
   * node element to which that attribute belongs.
   * This will e.g. identify a specific cell in a given table row.
   * 
   * Example: If you have an input field whose "value" property is bound against
   * the attribute abc of node XYZ of this view called MyView and no other UI
   * element property is bound against XYZ.abc, then the following code will
   * focus on that input field.
   * <pre><code>
   * IWDAttributeInfo attribute
   *   = wdContext.nodeXYZ().getNodeInfo().getAttribute(
   *       IPrivateMyView.IXYZElement.ABC);
   * wdThis.wdGetAPI().requestFocus(wdContext.currentXYZElement(), attribute);
   * </code></pre>
   * 
   * Note how this allows to keep controller code independent of the UI, even
   * of IDs used for UI elements. If the input field in the example above is later
   * replaced by a <code>DropDownByKey</code> or some fancy new editor with
   * "guess what I want" value help, the code to request focus remains unaffected.
   */
  public void requestFocus(IWDNodeElement nodeElement, IWDAttributeInfo attribute);

You can use this to set the focus to an inputfield.

Hope that helps.

Regards

Stefan