PB.Ex WebGadget (Windows) (WebKit)
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
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).
Yes, that's correct. You can only call PB procedure, pass parameter (JS -> PB), but don't return a return value (PB -> JS).
- captain_skank
- Enthusiast
- Posts: 636
- Joined: Fri Oct 06, 2006 3:57 pm
- Location: England
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
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
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!!!
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!!!
Last edited by HanPBF on Tue May 21, 2019 8:42 am, edited 1 time in total.
Re: PB.Ex WebGadget (Windows) (WebKit)
@captain_skank
That happened to me when source/compiled exe was not in same folder as CEF things.
That happened to me when source/compiled exe was not in same folder as CEF things.
- captain_skank
- Enthusiast
- Posts: 636
- Joined: Fri Oct 06, 2006 3:57 pm
- Location: England
Re: PB.Ex WebGadget (Windows) (WebKit)
@HanPBF
Yep your right sorry
Yep your right sorry
Re: PB.Ex WebGadget (Windows) (WebKit)
Here is the code for JavaScript using JSON:
Here the PureBasic code to handle this (example with LibXL):
So, using it in JS could be done this way:
Code: Select all
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))
};
Code: Select all
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: Select all
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.
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: PB.Ex WebGadget (Windows) (WebKit)
PB.Ex WebGadget 1.0.7.0 has been released.
Changelog:
Changelog:
- Added: SetWebGadgetExAttribute()
- Added: #PB_Web_Zoom for GetWebGadgetExAttribute()
- Added: #PB_Web_Zoom for SetWebGadgetExAttribute()
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: PB.Ex WebGadget (Windows) (WebKit)
PB.Ex WebGadget 1.0.8.0 has been released.
Changelog:
Changelog:
- Added: SetWebGadgetExSetUserAgent()
Re: PB.Ex WebGadget (Windows) (WebKit)
Thanks for sharing, very interesting (although I haven't had a chance to give it a try yet)
Re: PB.Ex WebGadget (Windows) (WebKit)
Great work, thank you for sharing.
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.
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.
- RSBasic
- Moderator
- Posts: 1218
- Joined: Thu Dec 31, 2009 11:05 pm
- Location: Gernsbach (Germany)
- Contact:
Re: PB.Ex WebGadget (Windows) (WebKit)
PB.Ex WebGadget 1.0.9.0 has been released.
Changelog:
Changelog:
- Added: #PB_Web_BlockPopupMenu for SetWebGadgetExAttribute()
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)
Is it currently possible to define a proxy? (anonymous and/or with user:pass)
PB 6.0x, PureVision User.