The project to reproduce: Module8 2.bugreport.zip (1.2 MB)
The build log: Module8 2.bugreport.txt (14.1 KB)
Print screen of the error:
The project to reproduce: Module8 2.bugreport.zip (1.2 MB)
The build log: Module8 2.bugreport.txt (14.1 KB)
Print screen of the error:
Update: The code was in error, but this compiler error should not have occurred.
The correct code would have been:
MyButton_Events.Click += @MyButton_Click
And the coorect error would have been:
There is no property named “Click” on MyButton.
I’m wondering if we can improve this.
if WithEvents_HtmlButtonElement impplements HtmlButtonElement, how about we simply change Button
from the HtmlButtonElement interface to the WithEvents_HtmlButtonElement class, so e can have both on one variable? would that be feasible?
It doesn’t implement it, it just hold a reference to it …
we could expose that, via “Implements”?
We might need a Mercury syntax for that (or convert this to Oxygene), but in Oxygene its possible to do the equivalent iff:
Public Class WithEvents_HTMLButtonElement
Inherits WithEvents_HTMLElement
Implements HTMLButtonElement
Public shadows readonly Property HtmlElement As HTMLButtonElement Implements HTMLButtonElement
Get
Return DirectCast(MyBase.HtmlElement, HTMLButtonElement)
End Get
End property
End Class
note the Implements HTMLButtonElement
on the property. that “forwards” the entire interface
It should inherit I think, but The element class is an interface for dynamic access of the JS properties, while element_events is a class that implements events.
I am afraid that this is incompatible …
I think it would be , with the forwarder.
instead of
Protected Property Body As HTMLBodyElement = TryCast(document.body, HTMLBodyElement)
Private Dim WithEvents Body_Events As WithEvents_HTMLBodyElement = New WithEvents_HTMLBodyElement(Me.Body)
wed just fo
Unit Property __Body As HTMLBodyElement = TryCast(document.body, HTMLBodyElement)
Private Dim WithEvents Body As WithEvents_HTMLBodyElement = New WithEvents_HTMLBodyElement(Me.__Body)
and since WithEvents_HTMLBodyElement
now implements HTMLBodyElement
, all the properties are available on it, plus the events.
without event support,we just generate it the old way, as the interface, as just the properties will be available…
That would be a nice solution !