PB.Ex WebGadget (Windows) (WebKit)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by RSBasic »

Thanks for your tip. That's interesting. Unfortunately it is only for C++. I take a look at it.
Image
Image
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

Could You check if it is possible to set RemoteDebuggingPort? Or is there a default port?

Is there a problem running this whole thing on Windows Server 2016? (Don't ask why...)

I checked the debugging feature, JavaScript function call and PureBasic procedure call from JS.

Again, what a great work!
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

ERROR; PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

Hello RSBasic!

Unfortunately when I put the sources and DLLs and rest of the files into a sub directory of current exe, program crashes.

Worse, there is no error message just the crash.

Did You talk to PB team if they want to embed this regularly in PB?
(cross OS development is not an argument)
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by RSBasic »

Hello HanPBF :)

I'm currently working on PB.Ex Mail.
HanPBF wrote:Could You check if it is possible to set RemoteDebuggingPort? Or is there a default port?
I will check that.
HanPBF wrote:Unfortunately when I put the sources and DLLs and rest of the files into a sub directory of current exe, program crashes.
Unfortunately it is not possible to change the path at the moment. Also not with SetCurrentDirectory(). I will check that.
HanPBF wrote:Did You talk to PB team if they want to embed this regularly in PB?
No, Fred or Timo can ask me if a library should be implemented.
Currently PB.Ex WebGadget is not ready yet.
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by RSBasic »

PB.Ex WebGadget 1.0.6.0 has been released.

Changelog:
  • Added: EnableRemoteDebugger()
HanPBF wrote:Could You check if it is possible to set RemoteDebuggingPort? Or is there a default port?
I added this. You can use the function EnableRemoteDebugger() with your any port number.
Image
Image
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by RSBasic »

LuckyLuke wrote:I was wondering if it would be easy to replace the current engine by https://ultralig.ht/.

The reason I ask this ...
Ultra-light
Only 8MB compressed, low memory usage, we've stripped WebKit to the bare essentials.
I looked at the C++ component. Unfortunately the effort is too big. I would either have to develop a C++ wrapper for my C# DLL that passes to PB or I would have to rebuild my complete C# DLL in C++ with all functions.
Image
Image
LuckyLuke
Enthusiast
Enthusiast
Posts: 181
Joined: Fri Jun 06, 2003 2:41 pm
Location: Belgium

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by LuckyLuke »

I looked at the C++ component. Unfortunately the effort is too big. I would either have to develop a C++ wrapper for my C# DLL that passes to PB or I would have to rebuild my complete C# DLL in C++ with all functions.
Thanks for the feedback.
Might be an option in the (near) future when they have c# bindings :)

LuckyLuke
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

Changelog:

Added: EnableRemoteDebugger()
Great!
Thanks a lot!
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

I just try to map LibXL into JS with PB Ex Webgadget.

Does the call from JS to PureBasic always needs a string as return value?
So:

Code: Select all

procedure.s testCallfromJS()
...
endProcedure

I get null as return value even PureBasic debug output shows a number.
Last edited by HanPBF on Fri May 17, 2019 1:44 pm, edited 1 time in total.
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

Ok, could try myself if string as return value would work...

Did not -> always returning null.

Any idea?
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

Before not getting back a result, I try to call a libxl procedure:

Code: Select all

procedure createXMLExcelWorkbook()
	var R = xlCreateXMLBookW()
		
	xlBookSetKeyW(R, "...", "...")
			
	ret R
endProcedure
When I call this code from Javascript after all the binding stuff:

Code: Select all

var PB;
(async function (){
	await CefSharp.BindObjectAsync('PBProcedure');
	
	PB = PBProcedure
})();

Code: Select all

BindWebGadgetExJavaScript(PB, "createXMLExcelWorkbook",		@createXMLExcelWorkbook(), GetCurrentProcessId_(), @ErrorOutputWebGadgetEx)
and call to the function

Code: Select all

async init(){
		this.Nr = await PB.call('createXMLExcelWorkbook')
}
I get this error:

Code: Select all

LibXL.js:67 Uncaught (in promise) System.InvalidOperationException: Could not execute method: call(createXMLExcelWorkbook, System.Reflection.Missing) - Missing Parameters: 1 ---> System.ArgumentException: Der fehlende Parameter hat keinen Standardwert.
Parametername: parameters
   bei System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   bei System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   bei System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   bei CefSharp.Internals.JavascriptObjectRepository.TryCallMethod(Int64 objectId, String name, Object[] parameters, Object& result, String& exception) in C:\projects\cefsharp\CefSharp\Internals\JavascriptObjectRepository.cs:Zeile 295.
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei CefSharp.Internals.JavascriptObjectRepository.TryCallMethod(Int64 objectId, String name, Object[] parameters, Object& result, String& exception) in C:\projects\cefsharp\CefSharp\Internals\JavascriptObjectRepository.cs:Zeile 304.
So, an argument for createXMLExcelworkbook is missing where no argument is needed...

Any idea?
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by RSBasic »

HanPBF wrote:and call to the function

Code: Select all

async init(){
		this.Nr = await PB.call('createXMLExcelWorkbook')
}
The call must be this:

Code: Select all

PBProcedure.call('createXMLExcelWorkbook', '');
The second parameter can be empty (but not null) or you can send any text as string to your PB procedure.
Image
Image
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

Ok, I mapped the variabe PBProcedure to a global variable PB.

I guess the call must be with wait, as it is async called and gives back a promise:

Code: Select all

LibXL.Workbook.init; this.Nr:[object Promise]
That was the second question: are values being returned?

With the default value of '' I get then

Code: Select all

Uncaught (in promise) System.InvalidOperationException: Could not execute method: call(createXMLExcelWorkbookWG, )  ---> System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.Collections.Generic.KeyNotFoundException: Der angegebene Schlüssel war nicht im Wörterbuch angegeben.
   bei System.ThrowHelper.ThrowKeyNotFoundException()
   bei System.Collections.Generic.Dictionary`2.get_Item(TKey key)
Thanks a lot!
User avatar
RSBasic
Moderator
Moderator
Posts: 1218
Joined: Thu Dec 31, 2009 11:05 pm
Location: Gernsbach (Germany)
Contact:

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by RSBasic »

Sorry, I don't understand.
Do you have a complete executable example code? You can send the code here or via PM.
I have an example code here: viewtopic.php?f=27&t=72703
With the buttons "BindProc" and "CallProc" I can understand. How do you do it?
Image
Image
HanPBF
Enthusiast
Enthusiast
Posts: 562
Joined: Fri Feb 19, 2010 3:42 am

Re: PB.Ex WebGadget (Windows) (WebKit)

Post by HanPBF »

This is the question:
is it correct that I don't get a return value when calling a PureBasic procedure from JavaScript?

Thanks in advance!
Regards!
Post Reply