Skip to Content
avatar image
Former Member

Programatically fire an event

Hi,

is it programatically possible to fire an event (not an action)? I want to simulate an user click.

Best regards

Roman

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Jun 19, 2008 at 01:19 PM

    Hi Roman,

    Yes it is possible.

    Check this thread.

    wdThis.wdFirePlug<Plugs name>();

    passing parameter to Eventhandler

    Regards,

    Mithu

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 19, 2008 at 01:35 PM

    Hi,

    If you could explain your use case it would be of help.

    Regards

    Ayyapparaj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 19, 2008 at 01:46 PM

    A button click results just in the call of the associated action handler. So to "simulate" a button click, you have to call the action handler with the parameter values (if any) that would result from a real button click.

    If you want to call the action handler from a different controller than the view controller, this is not possible. In that case you could either refactor the relevant code into some method of the component controller and call that method, or you could define a server-side event and fire that event which would be handled by the view controller and call the action handler.

    Armin

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 20, 2008 at 11:45 AM

    Hi,

    It is very straightforward.

    You should call the event, the same way you would call a fire-outbound-plug method.

    The only difference is that, events are parameterised methods.

    So, to call them programatically, pass null as the parameter.

    So, your cod will be:

    wdThis.onActiona_GO(null);

    here, a_GO is an event that normally gets triggered onAction of a button. But using the above code, i call call this method anywhere i want, thereby programatically triggering the event.

    I have used this several times, & it has worked beautifully.

    Regards,

    Hanoz

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Hanoz Tarapore

      hi hanoz,

      what if I have to popup file chooser of say FileUpLoad UI element programatically? I think Roman wants something similar.

      any thoughts will greatly appreciated.

      nikhil