Search found 829 matches

by Peter
Wed Mar 22, 2023 6:32 pm
Forum: Coding Questions
Topic: HTML button event
Replies: 4
Views: 57

Re: HTML button event

It may be that the function is in another scope and for this reason is not found.

Try the following:

Code: Select all

! function buttonclicked(id) {
!   alert(id);
! }
! window.buttonclicked = buttonclicked;
by Peter
Tue Mar 14, 2023 2:57 pm
Forum: Coding Questions
Topic: Static keyword confusion
Replies: 5
Views: 322

Re: Static keyword confusion

Is this stuff documented anywhere?
The naming rules are documented here: Inline Javascript.
However, it seems to me that the static variables are missing.
by Peter
Tue Mar 14, 2023 7:27 am
Forum: Coding Questions
Topic: Static keyword confusion
Replies: 5
Views: 322

Re: Static keyword confusion

Static variables have a different name in JavaScript: prefix: "so_" (I assume this stands for s tatic o bject). plus: procedure-name plus: $-sign plus: variable-name In your case: so_buttonhandler$v_value Procedure ButtonHandler() Static value If value = 0 value = 20 EndIf ! console.log(so...
by Peter
Tue Mar 07, 2023 8:47 pm
Forum: Javascript
Topic: Javascript script not loading
Replies: 2
Views: 267

Re: Javascript script not loading

Here's how it works: Procedure ButtonHandler() ! //create a synth and connect it to the main output (your speakers) ! const synth = new Tone.Synth().toDestination(); ! //play a middle 'C' for the duration of an 8th note ! synth.triggerAttackRelease("C4", "8n"); EndProcedure Proce...
by Peter
Sat Mar 04, 2023 12:14 pm
Forum: Coding Questions
Topic: ScrollAreaGadget - referring to it after CloseGadgetList
Replies: 2
Views: 97

Re: ScrollAreaGadget - referring to it after CloseGadgetList

After this definition, I want to ADD a button or string gadget. you can do this with OpenGadgetList() : Enumeration #Window #ScrollAreaGadget #ButtonGadget EndEnumeration OpenWindow(#Window, #PB_Ignore, #PB_Ignore, 305, 140, "ScrollAreaGadget", #PB_Window_ScreenCentered) ScrollAreaGadget(...
by Peter
Tue Feb 28, 2023 12:01 am
Forum: Coding Questions
Topic: SpiderBasic and netradio url.
Replies: 7
Views: 290

Re: SpiderBasic and netradio url.

Hey falsam. Welcome back! :)
by Peter
Mon Feb 27, 2023 7:10 pm
Forum: Coding Questions
Topic: SpiderBasic and netradio url.
Replies: 7
Views: 290

Re: SpiderBasic and netradio url.

hub73 wrote: Mon Feb 27, 2023 7:02 pm Perfect ! Many thanks !
Thanks for the coffee! Image
by Peter
Mon Feb 27, 2023 6:52 pm
Forum: Coding Questions
Topic: SpiderBasic and netradio url.
Replies: 7
Views: 290

Re: SpiderBasic and netradio url.

Enumeration #Window #ImageGadget #PlayButton #PauseButton EndEnumeration Procedure ImageGadgetEvent() SetGadgetState(#ImageGadget, 0) ! const audio = $('#monAudio')[0]; ! if (audio.paused) { ! audio.play(); SetGadgetState(#ImageGadget, ImageID(#PauseButton)) ! } else { ! audio.pause(); SetGadgetSta...
by Peter
Mon Feb 27, 2023 5:49 pm
Forum: Coding Questions
Topic: SpiderBasic and netradio url.
Replies: 7
Views: 290

Re: SpiderBasic and netradio url.

something like this? Enumeration #Window #Container EndEnumeration Procedure AddPlayer(Gadget) Protected GID = GadgetID(Gadget) Protected HTML.s = "<video controls='' autoplay='' name='media' style='height:50px;width:100%'>" + "<source src='https://www.lesfloralies.ovh/floralies.ogg' ...
by Peter
Sun Feb 26, 2023 6:24 pm
Forum: Game Programming
Topic: When to call SpriteWidth() and SpriteHeight() ?
Replies: 4
Views: 480

Re: When to call SpriteWidth() and SpriteHeight() ?

Unlike PureBasic, after a LoadSprite() the object is not immediately available. For this reason you specify with BindEvent(#PB_Event_Loading, ...) the procedure that will be executed when the object is available. Only when this procedure is called, the object is available and you can for example get...