Using Javascript from SpiderBasic
e2robot
 
Posts: 38
Joined: Wed Mar 19, 2014 8:34 am

Messi - nice popup library

by e2robot Sun Mar 26, 2017 9:51 am

http://messijs.github.io/MessiJS/demos/


Simple example (does 4 example popups)

Code: Select all
!$("head").append("<link rel='stylesheet' type='text/css' href='http://messijs.github.io/MessiJS/stylesheets/messi.css' />");

!$.getScript("http://messijs.github.io/MessiJS/javascripts/messi.js", loadok);
!function loadok()
!{
Debug "OK"
!}





Procedure messi(title.s,message.s)
   
 !   new Messi(v_message, {title: v_title, titleClass: 'anim error', modal: true , buttons: [{id: 0, label: 'Close', val: 'X'}]});
 !  new Messi(v_message, {title: v_title, titleClass: 'anim info', modal: true , buttons: [{id: 0, label: 'Close', val: 'X'}]});
 !  new Messi(v_message, {title: v_title, titleClass: 'anim warning ', modal: true , buttons: [{id: 0, label: 'Close', val: 'X'}]});
 !  new Messi(v_message, {title: v_title, titleClass: 'anim success', modal: true , buttons: [{id: 0, label: 'Close', val: 'X'}]});
   
   
 
   
   
   
   

 
EndProcedure


Procedure buttonpressed()
 
messi("Error","No Problem !!")
 
  EndProcedure

If OpenWindow(1, 1, 1, 200, 100, "TEST", #PB_Window_SystemMenu|#PB_Window_TitleBar)

ButtonGadget(1 ,60, 50, 75, 30, "GO")
BindGadgetEvent(1,@buttonpressed(),#PB_EventType_LeftClick)

EndIf




More complex (with call back to SB code)
Compile with debugger on as that's what I am using in callback to test interaction

Code: Select all
!$("head").append("<link rel='stylesheet' type='text/css' href='http://messijs.github.io/MessiJS/stylesheets/messi.css' />");

!$.getScript("http://messijs.github.io/MessiJS/javascripts/messi.js", loadok);
!function loadok()
!{
Debug "OK"
!}





Procedure messi(title.s,message.s)
   
       
!    new Messi(v_message,{title: v_title,modal: true,buttons: [{id: 0, label: 'Yes', val: 'Y'},{id: 1, label: 'No', val: 'N'}],callback: function(val) { v_sb=val;
 
 If sb.s="Y"
   Debug "Yes"
 
 EndIf
 
 If sb.s="N"
   Debug "No"
 
 EndIf
 
 !}
 !}
!);
   
     
 
EndProcedure


Procedure buttonpressed()
 
messi("This is the title","This is the message")
 
  EndProcedure

If OpenWindow(1, 1, 1, 200, 100, "TEST", #PB_Window_SystemMenu|#PB_Window_TitleBar)

ButtonGadget(1 ,60, 50, 75, 30, "GO")
BindGadgetEvent(1,@buttonpressed(),#PB_EventType_LeftClick)

EndIf

IdeasVacuum
 
Posts: 136
Joined: Tue Feb 25, 2014 1:27 pm

Re: Messi - nice popup library

by IdeasVacuum Fri May 12, 2017 9:08 am

Hi e2robot

Just tried your examples, very nice indeed. I have seen a lot of javascript that relies on the successful connection to the developer's server
Code: Select all
!$.getScript("http://messijs.github.io/MessiJS/javascripts/messi.js", loadok);


If for any reason that should fail, effectively your app fails with it since an essential part won't be there?
e2robot
 
Posts: 38
Joined: Wed Mar 19, 2014 8:34 am

Re: Messi - nice popup library

by e2robot Mon May 15, 2017 2:07 am

You can easily save a copy of the external JS library locally and link to local copy

Just go to http://messijs.github.io/MessiJS/javascripts/messi.js

Cut and paste all the content into a js file stored on your web server instead.

Adjust your Spiderbasic program to load local js file.

Regards,
Phil
IdeasVacuum
 
Posts: 136
Joined: Tue Feb 25, 2014 1:27 pm

Re: Messi - nice popup library

by IdeasVacuum Tue May 16, 2017 11:59 am

Hello Phil, I hear you, but that isn't necessarily better or safer - it still relies on the availability of a Web Server.
What if the app is compiled to Android/iOS/MacOS/Win10/Linux? You could have a portable device running any of those but not necessarily have an Internet connection.

So, in an ideal world, we want the javascript code compiled with the SB code, Internet dependency thus reduced, or nil.
falsam
 
Posts: 269
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Messi - nice popup library

by falsam Tue May 16, 2017 12:52 pm

What if the app is compiled to Android/iOS/MacOS/Win10/Linux? You could have a portable device running any of those but not necessarily have an Internet connection.
Hello IdeasVacuum.

If the javascript file (messi.js) is included in the code folder, it will be exported to your mobile application.

The mobile app contains a browser that will interpret the Javascript code of your application.

An APK file is a compressed file that will contain the folders of your apllication and the javascript code generated by Spiderbasic.

If one of your folders contains messi.js, it will also be interpreted.

An internet connection is not necessary.

➽ Windows 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
IdeasVacuum
 
Posts: 136
Joined: Tue Feb 25, 2014 1:27 pm

Re: Messi - nice popup library

by IdeasVacuum Tue May 16, 2017 1:54 pm

Hi Falsam - good to hear from you. Thanks for the explanation, that's perfect.
What do you think - would it be good to be able to define an app for Windows10 too?
falsam
 
Posts: 269
Joined: Mon May 05, 2014 9:49 pm
Location: France

Re: Messi - nice popup library

by falsam Tue May 16, 2017 3:36 pm

IdeasVacuum wrote:What do you think - would it be good to be able to define an app for Windows10 too?
To generate mobile applications, SpiderBasic uses the Cordova SDK.

This SDK can also generate applications for Windows 10 (1) and Windows Phone. I do not know the dependencies required because I never create applications for windows 10.

Spiderbasic will be able to generate applications Windows 10 and Windows Phone? Mystery ;)

(1) Requirements : Windows 10, Windows 8.1, Windows Phone 8.1

➽ Windows 10 - JDK 1.8 - SB 2.20 - Android 5.5
http://falsam.com

Sorry for my poor english
Return to Javascript

Who is online

Users browsing this forum: No registered users and 2 guests