PureBasic Forum https://www.purebasic.fr/english/ |
|
PB.Ex WebGadget (Windows) (WebKit) https://www.purebasic.fr/english/viewtopic.php?f=27&t=72703 |
Page 3 of 5 |
Author: | RSBasic [ Tue May 21, 2019 7:15 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
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). |
Author: | captain_skank [ Tue May 21, 2019 8:35 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
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 |
Author: | HanPBF [ Tue May 21, 2019 8:40 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
@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 ![]() Thanks a lot!!! |
Author: | HanPBF [ Tue May 21, 2019 8:42 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
@captain_skank That happened to me when source/compiled exe was not in same folder as CEF things. |
Author: | captain_skank [ Tue May 21, 2019 8:46 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
@HanPBF Yep your right ![]() ![]() |
Author: | HanPBF [ Tue May 21, 2019 9:51 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
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}) } |
Author: | RSBasic [ Tue May 21, 2019 9:56 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
Nice example ![]() |
Author: | RSBasic [ Fri Jul 12, 2019 8:59 pm ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
PB.Ex WebGadget 1.0.7.0 has been released. Changelog:
|
Author: | RSBasic [ Mon Jul 22, 2019 1:16 pm ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
PB.Ex WebGadget 1.0.8.0 has been released. Changelog:
|
Author: | firace [ Wed Jul 24, 2019 7:02 pm ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
Thanks for sharing, very interesting (although I haven't had a chance to give it a try yet) |
Author: | Thorium [ Thu Jul 25, 2019 10:21 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
Great work, thank you for sharing. |
Author: | Thorium [ Thu Jul 25, 2019 2:21 pm ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
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. |
Author: | RSBasic [ Thu Jul 25, 2019 3:01 pm ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
I tested this: https://stackoverflow.com/questions/556 ... r-55683969 But it's not working. ![]() |
Author: | RSBasic [ Mon Aug 05, 2019 2:09 pm ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
PB.Ex WebGadget 1.0.9.0 has been released. Changelog:
|
Author: | zikitrake [ Sat Aug 31, 2019 3:15 am ] |
Post subject: | Re: PB.Ex WebGadget (Windows) (WebKit) |
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) |
Page 3 of 5 | All times are UTC + 1 hour |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |