Okay now with some very helpful advice from Benoit I have the following answer to my issue...
firstly a problem with using an event handler the way i was...
Benoit Minisini wrote:
Note that you have a WebControl '_GetUpdateJS()' method that generates
for you the HTML code that calls 'gw.update' when a specific DOM event
is triggered.
So scrap that idea for that purpose as it was causing all my objects to refresh/flicker.
Benoit Minisini wrote:
You must send the 'Position' property from the browser to the server by
using:
gw.update(<id>, '<property>', <value>);
Where <id> is the id of the control, <property> the name of the
property, and <value> its value.
Then you handle that message on the server in the '_UpdateProperty'
hidden method of the control.
So this method works briliantly...
Event Position
Property Position As Float Use $fPosition
Public Sub _Render()
Print "<audio"; Me._GetClassId(); " src=\""; Html(Me._GetLink($sAudio)); "\"";
Print " ontimeupdate=\"gw.update(" & JS(Me.Name) & ",'position', $_(" & JS(Me.Name) & ").currentTime, null)\"";
Print "></audio>";
End
Public Sub _UpdateProperty(sProp As String, vValue As Variant)
If sProp = "position"
$fPosition = vValue
Raise Position
Endif
End
No more flickering.
the ontimeupdate event auto-sets $fPosition and raises the Position event.
One more quote from Benoit as it's important need-to-know stuff...
Benoit Minisini wrote:
When a property of a control changes, you usually must refresh it by
calling the _Refresh() method.
You can avoid a full refresh of the control to speed up things by using
custom javascript code instead. Look at the SetText() method of the
WebTextBox control to see an example.
Another point: you must not catch an event on the browser side if you
don't implement the event handler on the server side.
To detect that, use the 'Object.CanRaise()' method. As usual, look at
the '_Render' method of WebTextBox for an example.
Many thanks to Benoit for his help and hopefully this can help you too.
Bruce