Page 2 of 7

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

Posted: Mon Apr 29, 2019 10:53 am
by RSBasic
Thanks for your tip. That's interesting. Unfortunately it is only for C++. I take a look at it.

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

Posted: Tue Apr 30, 2019 7:10 am
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!

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

Posted: Fri May 03, 2019 9:12 am
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)

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

Posted: Fri May 03, 2019 11:07 am
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.

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

Posted: Sun May 05, 2019 8:52 pm
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.

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

Posted: Sun May 05, 2019 10:30 pm
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.

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

Posted: Mon May 06, 2019 7:39 am
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 :)

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

Posted: Mon May 06, 2019 1:47 pm
by HanPBF
Changelog:

Added: EnableRemoteDebugger()
Great!
Thanks a lot!

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

Posted: Fri May 17, 2019 11:41 am
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.

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

Posted: Fri May 17, 2019 1:44 pm
by HanPBF
Ok, could try myself if string as return value would work...

Did not -> always returning null.

Any idea?

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

Posted: Fri May 17, 2019 2:11 pm
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?

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

Posted: Fri May 17, 2019 4:18 pm
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.

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

Posted: Mon May 20, 2019 6:52 am
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!

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

Posted: Mon May 20, 2019 11:27 am
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?

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

Posted: Tue May 21, 2019 5:53 am
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!