It is currently Wed Sep 18, 2019 7:04 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Tue May 21, 2019 7:15 am 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1097
Location: Germany::Berlin()
Good morning

Yes, that's correct. You can only call PB procedure, pass parameter (JS -> PB), but don't return a return value (PB -> JS).

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Tue May 21, 2019 8:35 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Oct 06, 2006 3:57 pm
Posts: 530
Location: England
Morning,

First up thanks and congrats on all the work you've done recently, it is anexcellent body of work.

When i run this it displays a blank window, pauses and the quits with 'debugged executable quit unexpectedly'

I'm running it on windows 10 x64 v1809 the processor is a AMD FX8370 and i've tried with PB versions 5.70 and 5.71.

Any idea what i'm doing wrong ?

cheers


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Tue May 21, 2019 8:40 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 530
@RSBasic

Aha!!!! Thanks a lot for the quick answer!!!

So, the way to work here is calling procedure (PureBasic) from function (JavaScript) and let PureBasic send the answer asynchronously to JavaScript.
Which is more effort to manage but possible via exp. GUID match.

And I guess that internally there happens some messaging like calls when embedding CEF browser.

Now after this answer I still consider Your work here what it simply is: great :D

Thanks a lot!!!


Last edited by HanPBF on Tue May 21, 2019 8:42 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Tue May 21, 2019 8:42 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 530
@captain_skank

That happened to me when source/compiled exe was not in same folder as CEF things.


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Tue May 21, 2019 8:46 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Oct 06, 2006 3:57 pm
Posts: 530
Location: England
@HanPBF

Yep your right :) sorry :oops:


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Tue May 21, 2019 9:51 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Feb 19, 2010 3:42 am
Posts: 530
Here is the code for JavaScript using JSON:
Code:
var CEF = {
   Callbacks:{/*guid*/}
};

procedure resolveWebGadgetEx(GUID.s, P.s)   
   ExecuteWebGadgetExJavaScript(PBWebGadgetEx, "CEF.Resolves['" + GUID + "'](" + P + ")", @OutputWebGadgetEx, @ErrorOutputWebGadgetEx)   
endProcedure

CEF.call = (fun, arg={}) => {   // async call -> return value via resolve used
   let R = new Promise((resolve, reject) => {
      arg.GUID = JS.guid()
      
      CEF.Resolves[arg.GUID]   = resolve
      
      PB.call.call(null, fun, JSON.stringify(arg))
   });
   
   return R
};

CEF.callS = (fun, arg) => {      // sync call -> no return value used
   PB.call.call(null, fun, JSON.stringify(arg))
};


Here the PureBasic code to handle this (example with LibXL):
Code:
structure ArgWebGadgetEx
   GUID   .s
endStructure

structure saveExcelWorkbookArgWG extends ArgWebGadgetEx   
   WB             .i
   FilePath   .s
endStructure

procedure saveExcelWorkbookWG(*P)
   var P.s   = PeekS(*P)
   var J = ParseJSON(#PB_Any, P)
   var Arg.saveExcelWorkbookArgWG
   
   ExtractJSONStructure(JSONValue(J), @Arg, saveExcelWorkbookArgWG)
      
   var R = bool(saveExcelWorkbook(Arg\WB, Arg\FilePath) = 0)
      
   resolveWebGadgetEx(Arg\GUID, Str(R))
endProcedure



So, using it in JS could be done this way:
Code:
async free(){
      CEF.callS('freeExcelWorkbook', {WB:this.Nr})  // no return value needed...
   }
   
   async save(FilePath){
      return await CEF.call('saveExcelWorkbook', {WB:this.Nr, FilePath})
   }



Last edited by HanPBF on Tue May 21, 2019 12:25 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Tue May 21, 2019 9:56 am 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1097
Location: Germany::Berlin()
Nice example Image

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Fri Jul 12, 2019 8:59 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1097
Location: Germany::Berlin()
PB.Ex WebGadget 1.0.7.0 has been released.

Changelog:
  • Added: SetWebGadgetExAttribute()
  • Added: #PB_Web_Zoom for GetWebGadgetExAttribute()
  • Added: #PB_Web_Zoom for SetWebGadgetExAttribute()

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Mon Jul 22, 2019 1:16 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1097
Location: Germany::Berlin()
PB.Ex WebGadget 1.0.8.0 has been released.

Changelog:
  • Added: SetWebGadgetExSetUserAgent()

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Wed Jul 24, 2019 7:02 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Nov 09, 2011 8:58 am
Posts: 462
Thanks for sharing, very interesting (although I haven't had a chance to give it a try yet)

_________________
Warning - Proud GOTO lover ahead!


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Thu Jul 25, 2019 10:21 am 
Offline
Addict
Addict
User avatar

Joined: Sat Aug 15, 2009 6:59 pm
Posts: 1252
Great work, thank you for sharing.


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Thu Jul 25, 2019 2:21 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Aug 15, 2009 6:59 pm
Posts: 1252
I have a request: Please add option to change the path of the WebKit installation.
Currently it needs to be in the same directory as the application executable. It would be nice if we can specify a path, so applications can share one installation easily.


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Thu Jul 25, 2019 3:01 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1097
Location: Germany::Berlin()
I tested this: https://stackoverflow.com/questions/556 ... r-55683969

But it's not working. :(

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Mon Aug 05, 2019 2:09 pm 
Offline
Moderator
Moderator
User avatar

Joined: Thu Dec 31, 2009 11:05 pm
Posts: 1097
Location: Germany::Berlin()
PB.Ex WebGadget 1.0.9.0 has been released.

Changelog:
  • Added: #PB_Web_BlockPopupMenu for SetWebGadgetExAttribute()

_________________
ImageImageImageImage Image


Top
 Profile  
Reply with quote  
 Post subject: Re: PB.Ex WebGadget (Windows) (WebKit)
PostPosted: Sat Aug 31, 2019 3:15 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 699
Location: Spain
I just tried the latest version and it goes like silk!

Is it currently possible to define a proxy? (anonymous and/or with user:pass)

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye