Raise a Event and Catch a Event multiple

  1. last week

    Markus R

    Nov 1 Pre-Release Testers, Xojo Pro Europe / Germany
    Edited last week

    i have a window with a list and one entry i can edit in a new window.
    this edit window have a container control with a event "AfterSaved"

    if me open this new edit window i try to use the add handler in the list window but i got a exeption there
    "Attempting to add a handler for an event that was already handled."
    i will handled it where i want and so often i want.

    AfterSaved is also used in the Edit Form self, the ContainerControl send it to his Window so the Window will be closed there.

    exists something like global events?
    example: i can raise a event "Hello" with arguments somewhere and all other places can receive this?

  2. Tim H

    Nov 1 Pre-Release Testers Portland, OR USA

    If you have implemented the AfterSaved event in the window, you need to re-raise the event in your AfterSaved code.

    sub AfterSaved()
        // do some stuff before forwarding the event to the outside world
        RaiseEvent AfterSaved
        // do some stuff afterward
    end sub

    The event system gives you precise control over when in your code the additional handler code will execute.

  3. Markus R

    Nov 1 Pre-Release Testers, Xojo Pro Europe / Germany

    thanks, i will play with it soon at next day

  4. Markus R

    Nov 2 Pre-Release Testers, Xojo Pro Europe / Germany
    Edited last week

    @Tim H re-raise the event

    i guess your meaning was a new event definition with the same nane in the edit form where the container control is placed?

    now i used a extra event definition only for my list update in the container control that i can use add handler in the window with my list. it was not my intend but it works.

  5. Tanner L

    is not verified Nov 2 Pre-Release Testers Toronto, Canada

    @Markus R example: i can raise a event "Hello" with arguments somewhere and all other places can receive this?

    For reference, please see this thread. https://forum.xojo.com/20267-delegates-events-and-objects-oh-my/0

or Sign Up to reply!