If I create a web message dialog in code:
Var md As new WebMessageDialog
md.Title = "Title Text"
md.ActionButton.Caption = "Quit"
md.CancelButton.Visible = False
md.AlternateActionButton.Visible = True
md.AlternateActionButton.Caption = "Don't Quit"
md.Message = "Message text"
md.Explanation ="Explanation text"
md.show
then I can get the dialog to display as expexted, but how do I determine which button has been pushed? The show function doesn’t return a value.
Thanks
S
Greg_O
(Greg O)
November 2, 2023, 10:56pm
4
When the button pressed event fires, the button they pressed is passed in.
Thanks - but I can’t find in the documentation how to do that from code. How can I implement an event from code (rather than by hand building each dialog in the IDE)?
Best regards
Steve
Greg_O
(Greg O)
November 3, 2023, 12:20am
7
Right-click on WebMessageDialog in your code and select Add Method > From Event
It’ll add a method to the page with the correct signature.
Back in your code just after declaring your variable, put the following, replacing with the name of the method created in step 2.
AddHandler md.ButtonPressed, AddressOf <method>
Inside the method that was created, at the very top, put:
RemoveHandler obj.ButtonPressed, AddressOf <method>
It’s very important to call the remove version to prevent memory leaks.
4 Likes
Excellent! Thanks so much for the pointers.
Best regards
Steve