This should work :
my_custom_handler := class:
Callback: type{_(:widget_message) : void}
HandleOnClickEvent(Payload:widget_message):void=
Callback(Payload)
your_ui_class := class():
CreateLoudButton(Name:string, Handler: widget_message->void):button_loud =
Button:button_loud = button_loud:
DefaultText := StringToMessage(Name)
CustomHandler := my_custom_handler{Callback := Handler}
Button.OnClick().Subscribe(CustomHandler.HandleOnClickEvent)
return Button
I use this kind of setup literally in all my files, don’t know if it’s the right way to go, but it should work!