Skip to Content
avatar image
Former Member

how to get id of button from event

Hi all!

I want to use one action for several buttons in a view. When I hit one, I want to get the id of the button from the event. I know that it's not in the standard, anyway I found a post by Maksim Rashchynski who proposed to use wdDoModifyView like this:

final String id = element.getId();

final IWDButton button = (IWDButton)element;

button.mappingOfOnAction().addParameter( "actionID", id );

sounds nice, but what is element? Where can I get it from?

anybody?

thanks

stefan

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 19, 2007 at 03:02 PM
    wdDoModifyView()
    {
      IWDButton button = (IWDButton) view.getElement("MyButton");
      button.mappingOfOnAction().addParameter("buttonID", button.getId());
    }

    (in more recent IDE versions this can be done in the view designer without code)

    Action "A" assigned to button: Add parameter "buttonID" of type string.

    Action handler:

    onActionA(..., String buttonID)
    {
      /* check button ID */
      if ("MyButton".equals(buttonID))
      {
      }
    }

    Armin

    Add comment
    10|10000 characters needed characters exceeded