Cross-Platform Event-Definition

Hello,

i am currently writing a class that will be available for desktop, iOS and web.

You can select the target platform for a method in the second tab of the inspector. My problem now is that I want to give my class a paint event that is called via the Draw method. There are some subclasses of this class that use the paint event. However, I cannot specify a target platform for an event definition in the inspector. So I cannot create a cross-platform class, because for DrawiOS and DrawWeb i get the compiler error “Can’t find type with this name.”. Is there a workaround?

[code]Event PaintDesktop(g As Graphics)
Event PaintiOS(g As iOSGraphics)
Event PaintWeb(g As WebGraphics)

Sub DrawDesktop(g As Graphics)
RaiseEvent PaintDesktop(g)
End Sub

Sub DrawiOS(g As iOSGraphics)
RaiseEvent PaintiOS(g)
End Sub

Sub DrawWeb(g As WebGraphics)
RaiseEvent PaintWeb(g)
End Sub[/code]

can’t you override the method in the subclasses instead of using events ?

You “g as variant” and check what’s inside in the event.

Of course I can also overwrite the methods. I just wanted to find out if this might be a missing feature in the Xojo IDE.
<https://xojo.com/issue/59437> “Add Cross-Platform Event-Definition to IDE”

Yeah dont call it drawIOS or DRawWeb etc
simply call it “draw”
then in draw you could use #if Target to select which one it calls internally