Hello Spiders
I need to know how can I call an SB procedure from an html document loaded in a WebGadget like this:
On SB program:
Procedure TestProcedure(s$)
Debug s$ +" Ok!"
EndProcedure
On page loaded in WebGadget:
...
<span class="xxx" onclick="...???...f_testprocedure('test');">
...
Thanks a lot for all your help. You are a great team!!!
Best regards
Ezequiel
Can I call SB procedure from WebGadget document?
Re: Can I call SB procedure from WebGadget document?
Sorry, it's very obvious:
<span class="xxx" onclick="window.parent.f_testprocedure('test');">
Best Regards
Ezequiel
<span class="xxx" onclick="window.parent.f_testprocedure('test');">
Best Regards
Ezequiel
Re: Can I call SB procedure from WebGadget document?
A test without webgadget because I think it's useless
A simple example without CCS
■ HTML Code (This is an example : mainform.html)No <html> <header> <body>
■ SpiderBasic code■ Demo : http://falsam.com/sbtest/callsbprocedure.html
A simple example without CCS
■ HTML Code (This is an example : mainform.html)
Code: Select all
<h1>Call SpiderBasic procedure</h1>
<!-- your button -->
<p><button onclick="window.parent.f_dummy('test');" >Click Me</button></p>
■ SpiderBasic code
Code: Select all
; Remove spiderbasic body style
! $("body").removeClass("flat");
! $('*').css('background', 'transparent');
; Include your html file
!$("body").load("mainform.html");
Declare Dummy(Value.s)
Declare onClose()
;, Show value
; This procedure is called when you click on the button defined in the HTML page
Procedure Dummy(Value.s)
OpenWindow(#PB_Any, 0, 0, 300, 50, "Information", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(#PB_Any, 10, 10, 280, 24, "Value : " + Value)
BindEvent(#PB_Event_CloseWindow, @onClose() )
EndProcedure
Procedure onClose()
CloseWindow( EventWindow() )
EndProcedure
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Re: Can I call SB procedure from WebGadget document?
Sorry. I'll still answer your question with the Webgadget. It's true I don't know your project.ehbarba wrote:I need to know how can I call an SB procedure from an html document loaded in a WebGadget
html code is the same as my previous example
■ Code SpiderBasic
Code: Select all
Declare Start()
Declare Dummy(Value.s)
Declare onClose()
Start()
Procedure Start()
OpenWindow(0, 0, 0, 0, 0, "", #PB_Window_Background)
WebGadget(0, 20, 20, 800, 600, "mainform.html")
EndProcedure
;Show value
; This procedure is called when you click on the button defined in the HTML page
Procedure Dummy(Value.s)
OpenWindow(#PB_Any, 0, 0, 300, 50, "Information", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(#PB_Any, 10, 10, 280, 24, "Value : " + Value)
BindEvent(#PB_Event_CloseWindow, @onClose() )
EndProcedure
Procedure onClose()
CloseWindow( EventWindow() )
EndProcedure
➽ Windows 11 - JDK 1.8 - SB 2.40 - Android 13
➽ http://falsam.com
Sorry for my poor english
Re: Can I call SB procedure from WebGadget document?
Thank you very much Falsam.
Your samples are great and the point is fully well explained. I am using it in my project.
Best regards
Ezequiel
Your samples are great and the point is fully well explained. I am using it in my project.
Best regards
Ezequiel