Look at the attachments. You are trying to use FormExDesktop with Threading in ways that I didn't intend, I can already see that Showmodal doesn't work as I would expect and I don't understand why. Please understand that you are on your own using them this way. I probably won't be willing to spend much time if you have problems as it will not be of much benefit to anyone else.
Version 3.3 posted in post #1. This fixes a bug that hid the B4Script Rnd(min, max) function and also adds a ShareArray() method to BasicLib that lets an array be shared between the script and its' host so that changes made by one are visible to the other.
As BasicLib is probably best used with the Threading library BasicLib version 3.4, now posted, has improved CallHostSub and CallGUISub so they can now run host Subs in the IDE and not just when optimised compiled like earlier versions. There is also a bug fix asoociated with CallHostGUISub (but no-one seems to have found the bug so far!) so if you have downloaded a previous version you should probably update to this version
I've been playing with and extending this library for own interest recently and have come across a couple of bugs so I thought I would post an updated version.
Bug fixes
---------
CallSub used to error when calling a Sub with no parameters - fixed.
ArrayCopy source and destination were interchanged - fixed.
Improvements
-------------
Even higher performance due to optimising string literals and Sub name handling.
Multidimensional arrays with up to three dimenions now implemented. ArrayRank and ArrayTotalLen added.
Structures added although the indexers behave slightly differently to Basic4ppc. In Basic4ppc they are constants unique to each structure, in B4Script they are global variables. a side effect of this is that you can "dot" access any array with any variable.
Indirect array access implemented to simulate passing arrays as parameters using GetItem, SetItem, GetRank and GetTotalLen.
The BasicLib object has some additional decompiler methods and properties all prefixed "dec" that I implemented for debugging the compiler. They are briefly documented in the help but will be of no use in Basic4ppc applications.
It is a real object and there is already a Basic4ppc Dispose method defined - check in AutoComplete. However there really should not be a need to use it, let the .NET garbage collector take care of things.
I'm afraid there seems to be a bug in Do While ... Loop. Specifically calling a Sub in the While expression fails whereas just checking a local or global variable is fine.
This makes it easier to dynamically handle scripts within Basic4ppc programs using single quotes as delimiters but means that the string you are using is not legal. At the moment, to keep things simple the string handling doesn't care whether the closing delimiter matches the opening delimiter - I might take a look at that. Meanwhile use something like this
B4X:
sqlstr = "update set a = " & Chr(39) & "hello" & Chr(39) & " from table1"
agraham, could you expose BasicLib object property Name: CodeStyle. Boolean value, default is true, script code only use "" as string delimiter, string can include ' , single ' as comment, is the same as traditional Basic4ppc code style;
otherwise is flase, new style.
user select code style, Facilitate migration between BasicLib and Basic4ppc.
thanks.
... At the moment, to keep things simple the string handling doesn't care whether the closing delimiter matches the opening delimiter - I might take a look at that.
But rather the qualified similarity that AGraham expressed in his introduction to this library.
Using a choice of delimiter (and dropping the use of apostrophe to start a comment) and requiring a match at start and end, could make it possible to include an apostrophe in a string delimited by quotes and v.v.
I've already done the match start and end delimiters mod which makes it possible to include an apostrophe in a string delimited by quotes and v.v. - it was already implicit in the code and so simple I don't know why I didn't do it originally but there you go, mind on other things at the time probably.
You can't start a comment with an apostrophe in B4Script. It must start with REM and be on a separate line. This is because a comment is treated as a statement and each line can contain one, and only one, statement.