Dynamic iOSMessageBox event handling

Hi there,

I do not succeed in handling ButtonAction event when iOSMessageBox when created dynamically:

Dim mb As new iOSMessageBox
AddHandler mb.ButtonAction, AddressOf butAction

And the Handler

butAction(mb As iOSMessageBox, index As Integer)
.... some action

This code compiles and run but the butAction method is never called

When added/dragged on a View in the IDE the ButtonAction event is fired…

Is it a bug ?

Thanks !

It appears to be because the variable goes out of scope. If you make the variable declaration “Static” then it will work, or you can add “mb as iOSMessageBox” as a property to your View. As to whether it’s a bug or not - I thought AddHandler maintained a strong reference so it should work regardless, but I’m not sure.

Even adding the ButtonAction to the messageBox dragged into the navigator, it does not fire. Looks like a bug.

Thanks Jason, I tried both static and as a view property and both are fine.
I have another issue/question with messageboxes but I’ll better open another thread.

Michel, I tried again with the messageBox added into the IDE and, with 2014r3.2, the event is firing correctly.

With mb as property to the view, yes.