[Gambas-user] WebAudio, custom commands.
Benoit Minisini
benoit.minisini at gambas-basic.org
Tue Jul 19 12:04:57 CEST 2022
Le 19/07/2022 à 12:01, Bruce Steers a écrit :
>
>
> On Mon, 18 Jul 2022 at 16:18, Safiur Rahman <isafiur at gmail.com
> <mailto:isafiur at gmail.com>> wrote:
>
> Hi Bruce
>
> I think you can do it in the following way:
>
> a) Add Javascript to lib.js or write separately.
> eg.
> sound:
> {
> getaudiotime: function(id, idx)
> {
> var elt = $_(id);
> $_(idx+ ':entry').value = elt.currentTime;
> },
>
> .......
> .........
>
> b) Use WebTextBox to get the value. When I click a WebButton
>
> Public Sub WebButton1_Click()
>
> WebForm._AddJavascript("gw.sound.getaudiotime(" &
> JS(WebAudio1.Name) & ", " & JS(WebTextBox2.Name) & ")")
>
> End
>
> The WebTextBox is populated with the required value.
>
> --
> Regards
> Safiur Rahmam
>
>
> Thank you Safiur
> Can't get it to work though :(
> All that happens is the page goes into busy mode (window disabled with 3
> circles) and freezes :(
>
> Debugging does not seem possible either, it just works or it freezes
> till i figure out the error.
>
> I have this added to lib.js...
> gettime: function(id, idx)
> {
> var elt = $_(id);
> $_(idx + ':entry').value = elt.currentTime;
> },
>
> settime: function(id, seconds)
> {
> var elt = $_(id);
> elt.currentTime = seconds;
> },
>
> and i call it like this..
>
> Public Sub WebButton1_Click()
>
> WebForm1._AddJavascript("gw.sound.gettime(" & JS(WebAudio1.Name) & ", "
> & JS(WebTextBox1.Name) & ")")
>
> End
>
> Public Sub WebButton2_Click()
>
> WebForm1._AddJavascript("gw.sound.settime(" & JS(WebAudio1.Name) & ", 20)")
>
> End
>
> Neither work, just locks the window up :(
>
> BruceS
>
Usually a javascript syntax error somewhere... Look in the browser
debugger console.
--
Benoît Minisini.
More information about the User
mailing list