PDA

View Full Version : [Beta] thinBasic 1.11.x.x



ErosOlmi
28-07-2019, 19:31
thinBasic 1.11.6.0 BETA TESTING update 2020/04/19

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.6.0.zip

Added F12 or View/Maximize Edit menu to remove almost all thinAir distractions and remain focused on code editing
Removed unnecessary tabs in output window, now only process monitor and runtime errors are there. Next will come when ready
Fixed some theming problems
Improved process monitor stability giving time to web browser control to load all its dependencies (DOM engine, javascript engine, ...) before using it.
Petr documented WCon module
Petr new calltips for TBGL
fixed bug in TBGL which could cause crash in case of window dragging.
beautified runtime error reporting and process monitoring
button to minimize / maximize panel with Process / Runtime error
insert code block did not respect cursor position
unnecessary tabs removed, kept just Process / Runtime error
unnecessary redraws of UI
stability issues in thinAir
Other minor changes

https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_6_0.htm (https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?2020___version_history.htm)


thinBasic 1.11.5.0 BETA TESTING update 2020/04/11

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.5.0.zip

Added process monitoring of scripts executed inside thinAir
You will be able to monitor cpu and memory of the single process
It is also possible to stop process from thinAir in case you loose control of your script.
Again improved call tips and autocompletion. Those two aspects will be improved in next releases.

https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_5_0.htm


thinBasic 1.11.4.0 ALPHA TESTING update 2020/03/29

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.4.0.zip

Improved autocompletion for UDT.
Added support for me. using dotted notation. Me. inside and UDT recognize UDT elements

https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_4_0.htm (https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_3_0.htm)


thinBasic 1.11.3.0 ALPHA TESTING update 2020/03/23

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.3.0.zip

Huge number of new features to test during those sad days: cDateTime, WCon, thinAir new CallTips.
Also few fixes, see in What's New in help for the list
Sorry not yet documented in details
https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_3_0.htm

To have an idea ... execute scripts in the following paths:

\thinBasic\SampleScripts\Classes\cDateTime\
\thinBasic\SampleScripts\WCon\




thinBasic 1.11.3.0 released for ALPHA TESTING

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.3.0.zip

Not yet finished but there is something to test.
Beta version will follow


thinBasic 1.11.2.0 released for BETA TESTING

DOWNLOAD URL: https://www.thinbasic.com/downloads.html#downloads

List of changes: https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_0_0.htm

Didn't want to finish the year without releasing what was already almost ready to be checked and used so far.
So here we are with a new release 1.11.2
Have fun.


thinBasic 1.11.1.0 released for BETA TESTING

DOWNLOAD URL: https://www.thinbasic.com/downloads.html#downloads

List of changes: https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_0_0.htm

In this release many User Interface (UI) commands are now aware of UTF-8 strings and passed as unicode to UI windows and controls.
Still many to change but seems we are n the right road.
Check example in \thinBasic\SampleScripts\Unicode\Unicode Window Test.tbasic



thinBasic 1.11.0.0 released for BETA TESTING

DOWNLOAD URL: https://www.thinbasic.com/downloads.html#downloads

Very excited about new features.
I published the list of changes already developed but still to be documented: https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_0_0.htm


Personally ... I started to love FreeBASIC more and more during the last months.
Especially when I discovered that JoseRoca (one of my programmer idol) started to use FreeBASIC for his WinFBX project: https://github.com/JoseRoca/WinFBX

Thinking to a strategy for going out from using Power Basic as main compiler used to develop ThinBASIC, I've come to the conclusion that FreeBASIC is the best choice:

syntax not far from Power Basic so source porting will not be a nightmare but just a matter of time
both 32/64 bits
rich set of functions
nice community that recently seems revamped
and other reasons


Porting ThinBASIC to be developed using FreeBASIC will be a long long run:

just ThinBASIC main Core engine is about 320K lines of code! excluding include file not developed by me ... remains about 170K lines of code
than there will be all ThinBASIC modules to recode, other 80k lines
thinAir, other 150k lines of code
thinDebug, other 50K lines of code
...

So it will take some time.

But what to do in the meantime?

Thinking on how to start I've decided to see if integration of FreeBASIC and ThinBASIC could be possible at script level in order to immediately give advantages and new features to programmers using ThinBASIC and at the same time experiment with FreeBASIC. And the following is the result of this initial integration.

In next ThinBASIC version 1.10.8, that I will release in a couple of weeks, you will see the first results of integration and interop: it will be possible to mix FreeBASIC and ThinBASIC source code into the same script and do not care about details. ThinBASIC will take care of it:

extracting FreeBASIC code into a source code that will be compiled on the fly by FreeBASIC compiler
producing a DLL with the same name of the ThinBASIC source code
silently declaring exported FreeBASIC functions/subs into ThinBASIC source code in order to use FreeBASIC functions as native ThinBASIC functions

It will be even possible to create ThinBASIC compiled new modules directly from a ThinBASIC script.

First tests are very exciting.

The magic is done by a new pre-parsing directive block #Compiled and #EndCompiled used to surround FreeBASIC code inside a ThinBASIC code.
Than programmer just need to declare the functions/subs that need to be visible by ThinBASIC source code as ... CDECL ... EXPORT
The rest is automatic

Here an example of FreeBASIC/ThinBASIC integration.

#Compiled

sub SayHelloFromFreeBasic cdecl alias "SayHelloFromFreeBasic" (byref sMessage as zstring) export
print "Hi there. I'm FreeBASIC sub SayHelloFromFreeBasic"
print "called from DLL:", sMessage
end sub


#EndCompiled


uses "Console"


'---------------------------------------------
' Thanks to thinBASIC autodetection,
' the FreeBasic function SayHelloFromFreeBasic is discovered automatically
' and can be used as native command
'---------------------------------------------
SayHelloFromFreeBasic(Compiled_DLL_FileName)

printl "Press a key to end"
waitKey


9976

I've already tested almost all set of numeric data types passed both ByVal and ByRef.
Also tested passing numeric arrays.
Tested asciiz strings and I'm working on dynamic string and UDTs.

After installation, please have a look at examples in \thinbasic\samplescripts\FreeBASIC\
You will find interesting things over there and we can discuss for further improvements.


Ciao
Eros

xLeaves
29-07-2019, 13:53
look forward to

I saw that ThinBasic is trying to better integrate with FreeBasic, which is a good omen.

I hope I can see this version soon.

Good job

Petr Schreiber
29-07-2019, 20:15
xLeaves,

I think you will really enjoy the new release ;)


Petr

ErosOlmi
31-07-2019, 09:31
Petr Screiber is greatly helping me in testing, developing help, suggesting direction, fixing errors.


Here another test using FreeBASIC functions passing numeric variable ByRef and ByVal and a numeric Array:


uses "console"

'----------------------------------------------------------------------------
' This example shows how to use FreeBASIC compiled functions from
' thinBasic script without the need to DECLARE FreeBASIC functions as
' expternal DLL functions.
' thinBasic will take care of it
'----------------------------------------------------------------------------

#Compiled
'----------------------------------------------------------------------------
' Code inside #Compiled ... #EndCompiled will be compiled on the fly using FreeBASIC
' compiler into a DLL whose name is the same name of the script
'----------------------------------------------------------------------------


'----------------------------------------------------------------------------
' There can be multiple #Compiled ... #EndCompiled blocks
' thinBasic will take care to concatenate into a single FreeBASIC source code
' before compiling
'----------------------------------------------------------------------------


#EndCompiled




#Compiled "===Scalar numeric variables==="
'----------------------------------------------------------------------------
' ATTENTION:
' FreeBASIC Functions declared with "CDecl" and "Export" will be visible
' to thinBASIC code. Parameters and return value must be compatible with
' thinBASIC variable types
'----------------------------------------------------------------------------


'----------------------------------------------------------------------------
function FB_Check_LongByVal Cdecl (ByVal lLong1 as Long, ByVal lLong2 as Long) As Long Export
'----------------------------------------------------------------------------


print "Long 1 from inside FB passed ByVal", lLong1
lLong1 = lLong1 * 2

return lLong1

end Function


'----------------------------------------------------------------------------
function FB_Check_LongByRef Cdecl (ByRef lLong1 as Long, ByVal lLong2 as Long) As Long Export
'----------------------------------------------------------------------------


print "Long 1 from inside FB passed ByRef", lLong1
lLong1 = lLong1 * 2

return lLong1

end Function


'----------------------------------------------------------------------------
function FB_Check_DoubleByVal Cdecl (ByVal lDouble1 as Double, ByVal lDouble2 as Double) As Double Export
'----------------------------------------------------------------------------


print "Double 1 from inside FB passed ByVal", lDouble1
lDouble1 = lDouble1 * 2.5

return lDouble1

end Function


'----------------------------------------------------------------------------
function FB_Check_DoubleByRef Cdecl (ByRef lDouble1 as Double, ByVal lDouble2 as Double) As Double Export
'----------------------------------------------------------------------------


print "Double 1 from inside FB passed ByRef", lDouble1
lDouble1 = lDouble1 * 2.5

return lDouble1

end Function


#EndCompiled


#Compiled "===Numeric arrays==="


'============================================================================
' Numeric ARRAYs
'----------------------------------------------------------------------------
' the way numeric arrays are handled by FreeBASIC and ThinBASIC is very different but
' they way memory is allocated is the same: numeric array data is just a consecutive
' sequence of bytes
' So passing a numeric array from ThinBASIC to a FreeBASIC function is easy as
' passing BYREF the first element of the numeric array and than inside FreeBASIC
' use that first element memory pointer with some FreeBASIC pointers math
' More info on FreeBASIC pointers: http://www.petesqbsite.com/sections/express/issue18/fb_pointers.html
'----------------------------------------------------------------------------


'----------------------------------------------------------------------------
function FB_Check_LongArray Cdecl (byref pLong as long, byval lMaxElements as long) As long Export
' passing a LONG ByRef means passing a pointer to the memory location where the first long is allocated
'----------------------------------------------------------------------------
Dim pArray As long Ptr
dim lIdx as Long

'---Get a pointer to the first element
pArray = @pLong

print "Ptr to an Arrays of LONG", pArray
print "Maximum elements", lMaxElements
print "Values are:"
for lIdx = 1 to lMaxElements
'---Here we access array elements values using pinter aritmentic
'---*(p + lIdx - 1) means access the first element offset lIdx - 1
'---So ... element 1 equal *(pArray + 1 - 1)
' element 2 equal *(pArray + 2 - 1)
' element x equal *(pArray + x - 1)
print chr(9), "Position", lIdx, "Value", *(pArray + lIdx - 1),
'---Multiply by 2 and add 5 to the array element
*(pArray + lIdx - 1) = *(pArray + lIdx - 1) * 2 + 5
'---Show new value
print "New value", *(pArray + lIdx - 1)

next


return 0

end Function
#EndCompiled






dim MyScriptLong1 as long
dim MyScriptLong2 as long


dim MyScriptDouble1 as double
dim MyScriptDouble2 as Double

'---LONG BYVAL
MyScriptLong1 = 123
printl "---Calling a FB function passing a LONG ByVal and returning a LONG---" in %CCOLOR_FYELLOW
printl "Long 1 from thinBasic script BEFORE calling FB function", MyScriptLong1
'---Call a compiled FreeBASIC function
printl "FB function return value", FB_Check_LongByVal(MyScriptLong1, MyScriptLong2)
printl "Long 1 from thinBasic script AFTER calling FB function", MyScriptLong1
PrintL "---------------------------------------------------------------------"
PrintL


'---LONG BYREF
MyScriptLong1 = -123
printl "---Calling a FB function passing a LONG ByRef and returning a LONG---" in %CCOLOR_FYELLOW
printl "Long 1 from thinBasic script BEFORE calling FB function", MyScriptLong1
'---Call a compiled FreeBASIC function
printl "FB function return value", FB_Check_LongByRef(MyScriptLong1, MyScriptLong2)
printl "Long 1 from thinBasic script AFTER calling FB function", MyScriptLong1
PrintL "---------------------------------------------------------------------"
PrintL




'---Double BYVAL
MyScriptDouble1 = 123.456
printl "---Calling a FB function passing a Double ByVal and returning a Double---" in %CCOLOR_FYELLOW
printl "Double 1 from thinBasic script BEFORE calling FB function", MyScriptDouble1
'---Call a compiled FreeBASIC function
printl "FB function return value", FB_Check_DoubleByVal(MyScriptDouble1, MyScriptDouble2)
printl "Double 1 from thinBasic script AFTER calling FB function", MyScriptDouble1
PrintL "---------------------------------------------------------------------"
PrintL


'---Double BYREF
MyScriptDouble1 = -123.456
printl "---Calling a FB function passing a Double ByRef and returning a Double---" in %CCOLOR_FYELLOW
printl "Double 1 from thinBasic script BEFORE calling FB function", MyScriptDouble1
'---Call a compiled FreeBASIC function
printl "FB function return value", FB_Check_DoubleByRef(MyScriptDouble1, MyScriptDouble2)
printl "Double 1 from thinBasic script AFTER calling FB function", MyScriptDouble1
PrintL "---------------------------------------------------------------------"
PrintL


'---ARRAY of LONG
'[breakpoint] Arrays of LONG passed from TB to FB and changed inside FB
dim ArrayOfLongs(10) as Long = 10,20,30,40,50,60,70,80,90,100
printl "---Calling a FB function passing BYREF the first element of an array of longs---" in %CCOLOR_FYELLOW
FB_Check_LongArray(ArrayOfLongs(1), 10)
PrintL "---------------------------------------------------------------------"
PrintL

printl "---Press a key to end---"
WaitKey




9977

xLeaves
31-07-2019, 19:10
FreeBasic is more standard and has more comprehensive syntax. It is good news to be able to develop ThinBasic using FreeBasic.

I am looking forward to the official start of this project, and can also provide some help. On FreeBasic, I have about 10 years of development experience.

ErosOlmi
01-08-2019, 09:44
Thanks xLeaves.
I'm pretty sure you can help a lot ThinBasic project, you have already done a huge work.

I'm finishing to try to find an easy way to handle strings in/out ThinBasic/FreeBasic without to much casting.
Actually I'm experimenting a FreeBasic type that wrap BSTR OLE32 strings the same used by ThinBasic.
Seems working but still few aspects to manage and then I will release.

Michael Hartlef
02-08-2019, 06:19
That is an interesting approach. Didn't know that FB was maintained again. How much longer Eros?

xLeaves
02-08-2019, 15:50
I recommend developing a new plugin interface. After all, there are too few PowerBasic compatible languages. In order to develop a plugin, I use C/C++ and FreeBasic to do a lot of extra work.

Old plugins can remain compatible

In fact, a development language refactoring, many of the original load can be removed, to make some large modifications, such as array operations

It can be replaced with a more elegant way of writing, even without limiting the scope like JS, for example:

Dim arr() = Array(1, 2, 3, 4, 5)
MsgBox(UBound(arr)) ' --> 4

xLeaves
02-08-2019, 15:56
In addition, I recommend that the support for Variant be further strengthened.

Although I hate the bad habits of programming novices that don't limit data types, it does reduce the difficulty of getting started. More and more programming languages, data types become value dependencies, not containers.

Especially when a function may return multiple data types, this is very beneficial (such as ADODB, Redis, etc.)

When you declare a variant type, you can allow omitting As Variant

The code will be more beautiful when written:

Dim val = RecordSet.Value("Field1")

mike lobanovsky
05-08-2019, 03:50
Dim arr() = Array(1, 2, 3, 4, 5)
MsgBox(UBound(arr)) ' --> 4

This is not correct. All thinBasic arrays are always 1-based. So, UBound will always return 5 for a 5-element array.

What I'd recommend would be reading the manual more thoroughly before giving recommendations.

xLeaves
05-08-2019, 12:44
This is not correct. All thinBasic arrays are always 1-based. So, UBound will always return 5 for a 5-element array.

What I'd recommend would be reading the manual more thoroughly before giving recommendations.

The point you are paying attention to is wrong.

What I want to say is that the array operation of ThinBasic can be written more beautifully.

Not where the index is.

I have written some programs with ThinBasic, of course I will use arrays, but I know if the array index starts from 1 or 0 is not my question.


Dim a = Array(1, 2, 3, 4, 5)

Dim arr(5) As Long
Array Assign arr() = 1, 2, 3, 4, 5

Which of these two methods is intuitive and easy to understand, it is clear at a glance.

So what I am saying is to let ThinBasic embrace better writing and focus on language standardization.

This is what any programming language that stands out from the crowd is doing.

primo
05-08-2019, 17:01
#Compiled
sub SayHelloFromFreeBasic cdecl alias "SayHelloFromFreeBasic" (byref sMessage as zstring) export
print "Hi there. I'm FreeBASIC sub SayHelloFromFreeBasic"
print "called from DLL:", sMessage
end sub
#EndCompiled
uses "Console"
SayHelloFromFreeBasic(Compiled_DLL_FileName)
printl "Press a key to end"
waitKey


@Eros, this is very nice approach to use freebasic fully from within thinbasic.
i also see the commands inside #Compiled ... #EndCompiled block is colored like thinbasic and this is very important for a pleasing coding experience.
can we access freebasic graphics capabilities and libraries in this way from thinbasic ??.
@Petr, is it possible to call TBGL from within freebasic Block inside thinbasic something like oxygen calling TBGL but easier ?
Thanks for all your efforts

ErosOlmi
05-08-2019, 23:58
[CODE]
can we access freebasic graphics capabilities and libraries in this way from thinbasic ??.


You will have full FreeBASIC arsenal as far as I can see so far :)

I'm changing #FBCode / #EndFCode block into #Compiled / #EndCompiled in order to be more general and possibly be used to compile source code not only using FreeBASIC but also using other compilers.
Imagine something like that:

#Compiled language = xxxx
....
#EndCompiled

where xxx can be the name of the language like C++ or rust ...

I think end of next week I will be able to release initial FreeBasic version.
Than we will see :)

ErosOlmi
06-08-2019, 00:01
The point you are paying attention to is wrong.

What I want to say is that the array operation of ThinBasic can be written more beautifully.

Not where the index is.

I have written some programs with ThinBasic, of course I will use arrays, but I know if the array index starts from 1 or 0 is not my question.


Dim a = Array(1, 2, 3, 4, 5)

Dim arr(5) As Long
Array Assign arr() = 1, 2, 3, 4, 5

Which of these two methods is intuitive and easy to understand, it is clear at a glance.

So what I am saying is to let ThinBasic embrace better writing and focus on language standardization.

This is what any programming language that stands out from the crowd is doing.

Actually you can do the following:

dim MyLongArray(5) as long = 1,2,3,4,5

Maybe I can implement something like the following where initialization will be done by direct assignment.

dim MyLongArray() as long = 1,2,3,4,5

primo
06-08-2019, 08:21
#Compiled language = xxxx
....
#EndCompiled

yes this is nice and more appropriate. i know of one basic called ParactBasic which have 2 versions one as an interpreter developed by Borland Delphi compiler v7.x Named as "Decimal Basic" https://hp.vector.co.jp/authors/VA008683/english/ and one as a compiler https://osdn.net/projects/decimalbasic/releases/p15417
the compiler convert basic to pascal and request the Lazarus to compile the source code as exe in folder C:\ParactBASIC\output with default name NoName.exe. this folder contains all the mediated files including the BASICunit.pas wiich is the conversion file from basic syntax to pascal so Lazarus can compile it.
of course Lazarus with its very big size should be installed previously as a standalone product.
9983

ErosOlmi
06-08-2019, 09:14
#Compiled language = xxxx
....
#EndCompiled

yes this is nice and more appropriate. i know of one basic called ParactBasic which have 2 versions one as an interpreter developed by Borland Delphi compiler v7.x Named as "Decimal Basic" https://hp.vector.co.jp/authors/VA008683/english/ and one as a compiler https://osdn.net/projects/decimalbasic/releases/p15417
the compiler convert basic to pascal and request the Lazarus to compile the source code as exe in folder C:\ParactBASIC\output with default name NoName.exe. this folder contains all the mediated files including the BASICunit.pas wiich is the conversion file from basic syntax to pascal so Lazarus can compile it.
of course Lazarus with its very big size should be installed previously as a standalone product.
9983


In our case it will be a cooperation between compiled code and thinBasic script code.


Code inside

#Compiled
....
#EndCompiled

will be compiled into a DLL whose name is the same name of the script. So if your script name is MyScript.tbasic your dll will be MyScript.dll

I'm changing thinBasic parser in order to be compatible with FreeBasic sub/function declaration at least for number and strings both scalar and arrays.
In this way ... exported functions present into the DLL will be automatically detected and declared by thinBasic so you will not need to do anything in your script other than using your compiled functions as native script command.

It will also be possible to create thinBasic compiled modules directly form thinBasic.
I will release a FreeBasic example. Quite easy once you get the idea behind thinBasic engine parser.

Petr Schreiber
08-08-2019, 18:59
Hi xLeaves,

thanks for your interest in TBGL. TBGL as-is, relies heavily on the parsing of arguments for functions on ThinCore, which makes it difficult to use from other languages.

But I think you can use native OpenGL from #compiled / #endcompiled blocks, which integrates with TBGL very nicely.

Eros is incredible, the switch from #fbCode to #compiled opens a lot of new possibilities.


Petr

primo
08-08-2019, 21:32
dim MyLongArray() as long = 1,2,3,4,5
it is approximately available: (mixing strings with numbers, the awareness of numbers inside strings)

Uses "console"
Dim NumberMatrix() As long
dim myNumbers
dim i, a as long
myNumbers = " 12 , 345 , 6789 "
Parse(myNumbers, NumberMatrix, ",")

For i=1 To UBound(NumberMatrix)
a = NumberMatrix(i)+2
Printl a
Next

waitkey

i have tried to make it is hard for thinbasic but it escape the test successfully

primo
11-08-2019, 16:06
i have downloaded the experimental thinBasic_1.10.8.0.zip yesterday. and it is very nice and a new technology.
i have tried the examples of passing variables and arrays between thinbasic and freebasic. if there is an example about UDT or array of UDT will be great. thanks

ErosOlmi
12-08-2019, 09:16
i have downloaded the experimental thinBasic_1.10.8.0.zip yesterday. and it is very nice and a new technology.
i have tried the examples of passing variables and arrays between thinbasic and freebasic. if there is an example about UDT or array of UDT will be great. thanks

:onthequiet:
:D

There will be ...
Passing UDT is just a matter of passing a pointer but the UDT must be declared in both languages: thinBasic and FreeBasic. Maybe in future I will be able to automagically keep an UDt declare from one language and declare into the other automatically. Will see.

I'm working on strings and for this I'm creating a FreeBasic class called thinString that mimic thinBasic string (ole32 BSTR strings) allowing in/out between interpreted and compiled code.
Also working on string arrays.

primo
12-08-2019, 11:39
Thanks Eros,
i want to try the Simpson figure generator as a test, i have posted before http://www.thinbasic.com/community/showthread.php?12619-Boosting-calculation-speed-using-compilers-DLLs-(such-as-FreeBasic)

for now my strategy is to make array of UDT xyz inside thinbasic VertexA() and three Linear arrays arrX, arrY, arrZ to pass to freebasic for filling it with data. then after return from freebasic to put the data inside arrX arrY arrZ into thinbasic VertexA.x VertexA.y VertexA.z
the example works nicely but when i exit the program i got an error thinbasic has stopped working (in win 7) and a GUI error in winXP. else everything is okay

to let the example works you will need to put the attached BartSimpsonsData.tbasic in the same folder as the following code , it contains just data (13 KB) like this
x = ((-5/37 *Sin(61/42-8 *t)-112/41....
y = ((-9/23 *Sin(38/25-6 *t)-67/38 ....
and the good thing it is added to inside freebasic code inside the #Compiled ... #EndCompiled Block with #INCLUDE "BartSimpsonsData.tbasic"
.

Uses "TBGL"
'Uses "math"

Function TBMain()

Type Point3D
x As Single
y As Single
z As Single
End Type

Type Colr
r As Byte
g As Byte
b As Byte
End Type

Local hWnd As DWord
Local FrameRate As Double
Local i as long
' -- Create and show window
hWnd = TBGL_CreateWindowEx("Plotting 3D Data in an array using GBuffers- Calculate with freebasic..Esc to quit", 600, 600, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow

TBGL_BackColor 255,255,255
'TBGL_SetDrawDistance 250

' -- Create 3D points buffer
DWord gbPoints = TBGL_GBufferCreate(%TBGL_POINTS, %TBGL_3D)

Global Nb As DWord = 22619 ' 72*pi/0.01
' -- Define data for it
dim VertexA(Nb) As Point3D ' single
dim ColorA(Nb) As Colr ' Byte

'dim VertexA(Nb) As TBGL_TVECTOR3F
'dim ColorA(Nb) As TBGL_TRGB

global arrX(Nb) as double
global arrY(Nb) as double
global arrZ(Nb) as double

'call freeBasic to fill the arrays with data
FB_Array_Of_Double(arrX(1), arrY(1), arrZ(1))

for i=1 to Nb
VertexA(i).x = arrX(i)
VertexA(i).y = arrY(i)
VertexA(i).z = arrZ(i)
ColorA(i).r = 255
ColorA(i).g = 0
ColorA(i).b = 0
next

' -- Create buffer dynamically linked to the arrays above
TBGL_GBufferDefineFromArray(gbPoints, %TBGL_DYNAMIC, CountOf(VertexA), VertexA(1), ColorA(1))

' -- Resets status of all keys
TBGL_ResetKeyState()
TBGL_PointSize 2

' -- Main loop
While TBGL_IsWindow(hWnd)
'init
FrameRate = TBGL_GetFrameRate

TBGL_ClearFrame
TBGL_Camera(0, 0, 90, 0, 0, 0)

' -- Turn triangle
TBGL_Rotate GetTickCount/50, 0, 1, 0
TBGL_Scale 0.6, 0.6, 0.6

' -- Render it
TBGL_GBufferRender(gbPoints)

TBGL_DrawFrame

' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While

Wend
' -- Destroying the buffer is not necessary,
' -- the garbage collector will take care of it

' -- Destroy window
TBGL_DestroyWindow
End Function

#compiled "===Numric arrays==="
Function theta(a As Single) As Single
If a<=0 Then
Function = 0
Else
Function = 1
End If
End Function

function FB_Array_Of_Double Cdecl (byref pDouble1 as double, byref pDouble2 as double, byref pDouble3 as double) As long Export
' passing a Double ByRef means passing a pointer to the memory location where the first Double is allocated
'----------------------------------------------------------------------------

Dim pArray1 As double Ptr
Dim pArray2 As double Ptr
Dim pArray3 As double Ptr
dim N as Long
'"We are now inside FreeBasic function"
'---Get pointer to the first element of the array
pArray1 = @pDouble1
pArray2 = @pDouble2
pArray3 = @pDouble3

Dim x As SINGLE
Dim y As SINGLE
Dim z As SINGLE
Dim t As SINGLE
Dim Pi As SINGLE
Pi = 3.141592

FOR N = 0 TO 22618
#INCLUDE "BartSimpsonsData.tbasic"

*(pArray1 + N - 1) = x * 0.05
*(pArray2 + N - 1) = y * 0.05
*(pArray3 + N - 1) = 0
'print *(pArray1 + N - 1)
t = t + 0.01
next

return 0

end Function

#endcompiled

ErosOlmi
12-08-2019, 11:56
Great :)
And thanks for testing.
By next week I will publish 1.10.8 for all.

I will check this evening your examples and why GPF on exit.
I saw that some FreeBasic programs (both exe or DLL) must have an "End" command in order to properly exit but I have to study it first.

primo
12-08-2019, 13:20
Eros
i have found the reason of error: in:
FOR N = 0 TO 22618
#INCLUDE "BartSimpsonsData.tbasic"
*(pArray1 + N - 1) = x * 0.05
*(pArray2 + N - 1) = y * 0.05
*(pArray3 + N - 1) = 0

we replace with:
FOR N = 0 TO 22618
#INCLUDE "BartSimpsonsData.tbasic"
*(pArray1 + N ) = x * 0.05
*(pArray2 + N ) = y * 0.05
*(pArray3 + N ) = 0

and then No error happened

ErosOlmi
12-08-2019, 14:48
Great.

Yes because base pointer is already pointing to the first element of the array.

ErosOlmi
13-08-2019, 07:01
This is the version directly passing UDT array ... in reality passing to FreeBasic byref the first element of the thinBasic UDT array and then using pointers to change all the elements.
Maybe also better to pass number of elements in such a way to have a dynamic function working with the elements known in thinBasic.

Note that I had defined Point3D both in thinBasic and FreeBasic.
Actually it is the only method to share an UDT structure: define in both world.


Uses "TBGL"'Uses "math"


Type Point3D
x As Single
y As Single
z As Single
End Type


Type Colr
r As Byte
g As Byte
b As Byte
End Type


Function TBMain()


Local hWnd As DWord
Local FrameRate As Double
Local i as long

' -- Create and show window
hWnd = TBGL_CreateWindowEx("Plotting 3D Data in an array using GBuffers- Calculate with freebasic..Esc to quit", 600, 600, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow

TBGL_BackColor 255,255,255
'TBGL_SetDrawDistance 250

' -- Create 3D points buffer
DWord gbPoints = TBGL_GBufferCreate(%TBGL_POINTS, %TBGL_3D)

Global Nb As DWord = 22619 ' 72*pi/0.01
' -- Define data for it
dim VertexA(Nb) As Point3D ' single
dim ColorA(Nb) As Colr ' Byte

'dim VertexA(Nb) As TBGL_TVECTOR3F
'dim ColorA(Nb) As TBGL_TRGB

'call freeBasic to fill the arrays with data
FB_Array_Of_Point3D(VertexA(1))

for i=1 to Nb
ColorA(i).r = 255
ColorA(i).g = 0
ColorA(i).b = 0
next

' -- Create buffer dynamically linked to the arrays above
TBGL_GBufferDefineFromArray(gbPoints, %TBGL_DYNAMIC, CountOf(VertexA), VertexA(1), ColorA(1))

' -- Resets status of all keys
TBGL_ResetKeyState()
TBGL_PointSize 2

' -- Main loop
While TBGL_IsWindow(hWnd)
'init
FrameRate = TBGL_GetFrameRate

TBGL_ClearFrame
TBGL_Camera(0, 0, 90, 0, 0, 0)

' -- Turn triangle
TBGL_Rotate GetTickCount/50, 0, 1, 0
TBGL_Scale 0.6, 0.6, 0.6

' -- Render it
TBGL_GBufferRender(gbPoints)

TBGL_DrawFrame

' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While

Wend
' -- Destroying the buffer is not necessary,
' -- the garbage collector will take care of it

' -- Destroy window
TBGL_DestroyWindow

End Function


#compiled "===Array of UDT==="
Type Point3D
x As Single
y As Single
z As Single
End Type


Function theta(a As Single) As Single
If a<=0 Then
Function = 0
Else
Function = 1
End If
End Function


function FB_Array_Of_Point3D Cdecl (byref pPoint3D as Point3D) As long Export
' passing first element of an UDT ByRef allows to manage the UDT even if it is an array using some pointer math
'----------------------------------------------------------------------------

Dim pArray As Point3D Ptr


dim N as Long
'"We are now inside FreeBasic function"
'---Get pointer to the first element of the array
pArray = @pPoint3D

Dim x As SINGLE
Dim y As SINGLE
Dim z As SINGLE


Dim t As SINGLE
Dim Pi As SINGLE
Pi = 3.141592


FOR N = 0 TO 22618
#INCLUDE ".\BartSimpsonsData.tbasic"

*(pArray + N).x = x * 0.05
*(pArray + N).y = y * 0.05
*(pArray + N).z = 0
'print *(pArray1 + N - 1)
t = t + 0.01
next


return 0

end Function


#endcompiled

primo
13-08-2019, 08:20
Thank you Eros very much. your method is neat, small and concise
this extra speed will be useful with fractals such as mandelbrot set, also with perlin noise generators...
infinite possibilities.

ErosOlmi
13-08-2019, 10:26
The following example is even simpler and still very fast.

It uses a compiled FreeBasic function passing BYREF the 3 Single element of the UDT.

The main loop FOR/NEXT is inside thinBasic interpreted code but the hard job is done by FreeBASIC compiled function.
Only pay attention to t variable that I declared Static to the function so it will retain its value on function exit.


Uses "TBGL"'Uses "math"


Type Point3D
x As Single
y As Single
z As Single
End Type


Type Colr
r As Byte
g As Byte
b As Byte
End Type


Function TBMain()


Local hWnd As DWord
Local FrameRate As Double
Local i as long

' -- Create and show window
hWnd = TBGL_CreateWindowEx("Plotting 3D Data in an array using GBuffers- Calculate with freebasic..Esc to quit", 600, 600, 32, %TBGL_WS_WINDOWED Or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow

TBGL_BackColor 255,255,255
'TBGL_SetDrawDistance 250

' -- Create 3D points buffer
DWord gbPoints = TBGL_GBufferCreate(%TBGL_POINTS, %TBGL_3D)

Global Nb As DWord = 22619 ' 72*pi/0.01
' -- Define data for it
dim VertexA(Nb) As Point3D ' single
dim ColorA(Nb) As Colr ' Byte

for i=1 to Nb

'call freeBasic function to fill the arrays with data
FB_3SingleByRef(VertexA(i).x, VertexA(i).y, VertexA(i).z)


ColorA(i).r = 255
ColorA(i).g = 0
ColorA(i).b = 0
next

' -- Create buffer dynamically linked to the arrays above
TBGL_GBufferDefineFromArray(gbPoints, %TBGL_DYNAMIC, CountOf(VertexA), VertexA(1), ColorA(1))

' -- Resets status of all keys
TBGL_ResetKeyState()
TBGL_PointSize 2

' -- Main loop
While TBGL_IsWindow(hWnd)
'init
FrameRate = TBGL_GetFrameRate

TBGL_ClearFrame
TBGL_Camera(0, 0, 90, 0, 0, 0)

' -- Turn triangle
TBGL_Rotate GetTickCount/50, 0, 1, 0
TBGL_Scale 0.6, 0.6, 0.6

' -- Render it
TBGL_GBufferRender(gbPoints)

TBGL_DrawFrame

' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While

Wend
' -- Destroying the buffer is not necessary,
' -- the garbage collector will take care of it

' -- Destroy window
TBGL_DestroyWindow

End Function


#compiled "===Passing 3 single variable ByRef==="


Function theta(a As Single) As Single
If a<=0 Then
Function = 0
Else
Function = 1
End If
End Function


'----------------------------------------
function FB_3SingleByRef Cdecl (byref x as single, byref y as single, byref z as single) As long Export
'----------------------------------------
Static t As SINGLE '---<<<< STATIC !


Dim Pi As SINGLE
Pi = 3.141592


'---This contain BIG expression too complex for thinBasic interpeter
#INCLUDE ".\BartSimpsonsData.tbasic"

x = x * 0.05
y = y * 0.05
z = 0
t = t + 0.01


return 0

end Function


#endcompiled

ErosOlmi
13-08-2019, 10:58
thinBasic 1.10.8.0 released for all.

In first post of this thread please find download url: https://www.thinbasic.com/community/showthread.php?12949-thinBasic-1-10-8-0

Consider all new features are under development so there will be many changes in next weeks.
Have fun.

primo
13-08-2019, 12:16
Hi Eros
i have tried to grasp your shorter version:
FB_3SingleByRef(VertexA(i).x, VertexA(i).y, VertexA(i).z)
but still have ambiguity. the older version can be understood easily, but the newest is simpler of course.
i have noticed also that you have declared the UDT outside the TB main loop, and so it is globally known
i still run the older 1.10.8.0 and will install the newest shorly
big thanks

ErosOlmi
13-08-2019, 12:27
Even if thinBasic is able to parse UDT definition inside subs/functions ... UDT definition should be defined outside any subs/functions.
UDT definition is always globally known, it is just a definition and not a variable/memory allocation.

UDT definition done in thinBasic code is actually not known inside FreeBasic #Compiled/#EndCompiled code.
In case you need to let both world known about UDT definition, you have to re-declare them.
Maybe I will be able to work on this aspect in order to let both world know about each other UDT definitions or at least UDT in thinBasic be passed to FreeBasic compiled code.

Will see.

DirectuX
13-08-2019, 17:58
Maybe I will be able to work on this aspect in order to let both world know about each other UDT definitions or at least UDT in thinBasic be passed to FreeBasic compiled code.

Will see.

Hi Eros,
why not let the programmer choose with an execution directive (https://www.thinbasic.com/public/products/thinBasic/help/html/execution_directives.htm) ?

Petr Schreiber
13-08-2019, 18:18
Hi DirectuX,

could you explain your idea more? I was thinking about:


TYPE Vector2d
...
END TYPE
TYPE Vector3d
...
END TYPE

#compiled language=freebasic import=Vector2d, Vector3d ' Here you explicitly specify you want specific types to be shared between thinBASIC and freeBASIC
...
#endcompiled



Petr

ErosOlmi
13-08-2019, 18:25
Will see will see.

I'm concentrated on FreeBasic and #Compiled/EndCompiled block.
There are still many aspect to finish first of all a good string interaction between thinBasic interpreted and FreeBasic compiled code.
Second ... a better sub/function parameters integration and return values.

Then I will think about UDT automatic sharing between the 2 worlds.

primo
14-08-2019, 10:37
this is a VB6 way of doing things in thinbasic
shotened from Calculator_Simple_Events example somewhere in the forum. (https://www.thinbasic.com/community/showthread.php?12778-thinBasic-1-10-x/page7)
we add text to textbox just by using something like txtNum.Text = txtNum.Text + total

USES "UI"
'---Define a button ID
begin ControlID
%txtNum
%cbOp
%btnPush
end ControlID
'string sOperations(4) = "+", "-", "*", "/"
dialog Font "Courier New", 14
DIALOG New Pixels , Name textDisplay, 0, "tests",-1,-1, 640, 380,
%WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW,

CONTROL ADD Textbox , Name txtNum , textDisplay.Handle, %txtNum , "" , 10, 30, 350, 300, %ES_AUTOHSCROLL | %WS_VSCROLL | %ES_AUTOVSCROLL | %ES_WANTRETURN | %ES_MULTILINE | %ES_RIGHT | %WS_TABSTOP ' | %ES_NUMBER
CONTROL ADD BUTTON , Name btnPush , textDisplay.Handle, %btnPush , "Close" , 480, 340, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP

DIALOG SHOW MODAL textDisplay.Handle
'------------------------------------------------
' Callback function used to handle dialog events
' not handled by specific event functions
'------------------------------------------------
CallBack Function textDisplay_OnCallBack() As Long
'------------------------------------------------

End Function

'------------------------------------------------
CallBack Function textDisplay_OnLoad() As Long
'------------------------------------------------
'---Limits window minimum size
DIALOG SET MINSIZE textDisplay.Handle, 550, 320
'---Force resize logic
control set Resize CBHNDL, %btnPush , 0, 1, 0, 1

'---Some initial values
txtNum.Text = "Visual Basic 6" + $CRLF
'---Change name to Run me
btnPush.Text = "Run me"

End Function
'------------------------------------------------
' Function fired when button Close is clicked
'------------------------------------------------
CallBack Function btnPush_OnClick() As Long
'------------------------------------------------

long i, total
for i=1 to 10
total = total + i
txtNum.Text = txtNum.Text + total + $CRLF
next
'DIALOG End CBHNDL
End Function




the only limitation is that we can't add a Unicode text to the text box. the Unicode text is any text other than English characters
any way you can use this VB6 way to do calculations and research and display it the easy way with a short code.

ErosOlmi
14-08-2019, 10:48
Thanks !

Great way to remember that part of UI module: named dialogs and controls.
I still have to document this area and improve handled events for each control, not all user interface controls are ready for it.

Unicode: is on the list!
Not only for UI module but for whole thinBasic adding a new dynamic string data type.

DirectuX
14-08-2019, 11:13
Hi DirectuX,

could you explain your idea more? I was thinking about:


TYPE Vector2d
...
END TYPE
TYPE Vector3d
...
END TYPE

#compiled language=freebasic import=Vector2d, Vector3d ' Here you explicitly specify you want specific types to be shared between thinBASIC and freeBASIC
...
#endcompiled



Petr


More something like this



#VARSHARE

Description

Instruct thinBASIC Core Engine how to share variables between thinBASIC script and #Compiled/#EndCompiled enclosed source code.

Syntax

#VARSHARE {ON | OFF | LIST | FULL} [, List]

Returns

None

primo
14-08-2019, 14:30
i have copied thinair folder from thinbasic version 1.10.4 to the new 1.10.8 and then begins to use it . because it can pass my second windows language to the text box, also i can get the characters of the string in the IDE one by one for processing, and even it is not Unicode in this way but have character codes above than English code range and less than 255. like gooooooooooooood old days. this is applicable to any language if its language package installed in the windows as a second language
Edit: i have discovered that this is applicable in windows xp, not win7+
sorry
in the Scite editor from scintella site there is an option like this:
file: Encoding: utf8 ...etc
i will search how to run programs from scite, and see the result after chabging the Encoding to utf8 in win7+

primo
15-08-2019, 05:34
Eros, i suggest to provide two links for TB downloads:
One for TB with FreeBasic (for the users who wants more power and the future users)
One for TB without FreeBasic ( no support for inline FreeBasic))

this is because i have the feeling that a few users may have a wrong impression that they are obligated to use freeBasic . you will watch how many downloads for every version.
you can rename the usual TB downloads like
1- ThinBasic Classic
2- ThinBasic Plus (with inline FreeBasic support)

Petr Schreiber
15-08-2019, 19:11
Primo,

if I understand you correctly, you are basically reporting that editing in 1.10.8.0 does not handle UTF-8 characters correctly, right?

If that is the case, then we can have a look. Could you please supply source code which would get saved wrong in 1.10.8.0? (= is okay, but saving it in new thinAir would damage it).

We don't want anyone to copy thinAir from legacy version, we want to make it work out of the box.


Petr

primo
15-08-2019, 21:50
Hi Petr
yes i have noticed that mixing ide's is harmful and can damage the files. so i have returns the newest thinAir
here is the exact description of the problem:
the new IDE works nice regarding the Unicode, and can display any language in the world like this:
10002
if we run the following code (or the example textbox in the UI examples) then copying any international language and pasting it to the textbox of the example:

Uses "UI"
'---Define a button ID
begin ControlID
%txtNum
%cbOp
%btnPush
end ControlID

dialog Font "Courier New", 14
DIALOG New Pixels , Name textDisplay, 0, "tests",-1,-1, 640, 380,
%WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW,

CONTROL ADD Textbox , Name txtNum , textDisplay.Handle, %txtNum , "" , 10, 30, 350, 300, %ES_AUTOHSCROLL | %WS_VSCROLL | %ES_AUTOVSCROLL | %ES_WANTRETURN | %ES_MULTILINE | %ES_RIGHT | %WS_TABSTOP ' | %ES_NUMBER
CONTROL ADD BUTTON , Name btnPush , textDisplay.Handle, %btnPush , "Close" , 480, 340, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP

DIALOG SHOW MODAL textDisplay.Handle
'------------------------------------------------
' Callback function used to handle dialog events
' not handled by specific event functions
'------------------------------------------------
CallBack Function textDisplay_OnCallBack() As Long
'------------------------------------------------

End Function

'------------------------------------------------
CallBack Function textDisplay_OnLoad() As Long
'------------------------------------------------
'---Limits window minimum size
DIALOG SET MINSIZE textDisplay.Handle, 550, 320
'---Force resize logic
control set Resize CBHNDL, %btnPush , 0, 1, 0, 1

'---Some initial values
txtNum.Text = "你好,世界! 侨" + $CRLF
String helloWorld = "бумага бумага"
txtNum.Text = txtNum.Text + helloWorld

'---Change name to Run me
btnPush.Text = "Run me"

End Function
'------------------------------------------------
' Function fired when button Close is clicked
'------------------------------------------------
CallBack Function btnPush_OnClick() As Long
'------------------------------------------------

Long i, total
String a
a = txtNum.Text
for i=1 to 10
total = total + i
txtNum.Text = txtNum.Text + total + $CRLF
Next

'DIALOG End CBHNDL
End Function





it will be displayed okay like this:
10003
but if want to assign the languages (other than english) like this:

txtNum.Text = "你好,世界! 侨" + $CRLF
String helloWorld = "бумага бумага"
txtNum.Text = txtNum.Text + helloWorld
it will display chaotic figures:
10004
other than these things the new thinbasic language is very nice

ErosOlmi
15-08-2019, 23:02
UI (User Interface) module is not unicode aware.
It will require a complete rewrite of that module and also adding a new string type in thinBasic Core engine.
It is on the list.

primo
16-08-2019, 08:12
Eros, i have found a nice and forgotten Unicode example by Uzulo here:
https://www.thinbasic.com/community/showthread.php?12698-Does-ThinAir-supports-Unicode
in fact this example show that there are a lot of advanced users of thinbasic out there in the Globe Earth
look at his example , i have kept only the Japanese Button, and added a TextBox, and i have imitating his methods exactly to the textbox until i get that gorgeous text in Japanese and in any Unicode Characters.
i will not understand the code until shortening it too much to a few lines.
10005

'
' =======================================
' FASADO. Provo uzi kodoprezenton UTF-8
' =======================================
'

uses "UI"

declare function SendMessageW lib "user32.dll" _
alias "SendMessageW" _
(ByVal t as DWord, ByVal m as DWord, _
ByVal wp as DWord, ByVal adrL as Long) _
as Long
declare function SetWindowTextW lib "user32.dll" _
alias "SetWindowTextW" _
(ByVal t as DWord, ByVal adrL as Long) _
as Long
declare function MessageBoxW lib "user32.dll" _
alias "MessageBoxW" _
(ByVal t as DWord, ByVal adrLt as Long, _
ByVal adrLcx as Long, ByVal n as DWord) _
as Long

Begin ControlID
%butEn
%butEo
%butRu
%butFa
%butKr
%butYi
%butAr
%butHi
%butJa
%knvP
%ID_TXT
End ControlID

%UTF8 = 65001
%DlgL = 800
%DlgAt = 300
%DlgA = 400
%CxL = %DlgL \ 3
%CxA = %DlgAt \ 3
%d = 10
%bL = %CxL - %d - %d
%bA = %CxA - %d - %d
%LtrA = 12

$Ttl = "Unicode-text buttons; each changes the colour of the canvas below."
$nButEn = "Well... Close!"
$LtrN = "Arial Unicode MS"

dim DlgH, DlgV, r as Long
dim tDlg, _
tButJa, tTxt, tKnv _
as DWord
dim nButJa, _
mFaCx, mFaT, nTxt _
as AsciiZ

' ================
' CXEFA PROGRAMO
' ================

FUNCTION TbMain()

nButJa = "まど を 閉じる。"
nTxt = "まど を 閉じる。"

desktop get client to DlgH, DlgV
DlgH = (DlgH - %DlgL) \ 2: DlgV = (DlgV - %DlgA) \ 2

dialog font $LtrN, %LtrA

tDlg = Dialog_New (Pixels, 0, $Ttl, _
DlgH, DlgV, %DlgL, %DlgA, _
%WS_DLGFRAME | _
%WS_CAPTION | _
%WS_SYSMENU | _
%WS_OVERLAPPEDWINDOW , 0)

dialog set client tDlg, %DlgL, %DlgA

CONTROL ADD TEXTBOX , tDlg, %ID_TXT, "" , 20, 200, 200, 102, %WS_TABSTOP

control add button, tDlg, %butJa, $SPC, %d+%CxL+%CxL, %d+%CxA+%CxA, %bL, %bA
control handle tDlg, %butJa to tButJa
nButJa = UTF8ToWideChar$(nButJa)
SendMessageW (tButJa, 12, 0, strptr(nButJa))

control handle tDlg, %ID_TXT to tTxt
nTxt = UTF8ToWideChar$(nTxt)
SendMessageW (tTxt, 12, 0, strptr(nTxt))

tKnv = control add canvas, tDlg, %knvP, "", _
%d, %d+%CxA+%CxA+%CxA, %DlgL - %d - %d, %bA, , %WS_EX_STATICEDGE
Canvas_Attach (tDlg, %knvP, %FALSE)
Canvas_Clear (%RGB_BLACK)

dialog show modal tDlg, call trFENESTRO

END FUNCTION

' =========================
' PROCEDUROJ KAJ FUNKCIOJ
' =========================

Callback Function trFENESTRO() as Long

SELECT CASE cbMsg

CASE %WM_COMMAND

select case cbCtl

case %butEn
if cbCtlMsg = %BN_CLICKED then Canvas_Clear (%RGB_BLUE)

case %butEo
if cbCtlMsg = %BN_CLICKED then Canvas_Clear (%RGB_RED)

case %butRu
if cbCtlMsg = %BN_CLICKED then
Canvas_Clear (%RGB_GREEN)
MsgBox (tDlg, "=m=", %MB_OK, "=t=")
end if

case %butFa
if cbCtlMsg = %BN_CLICKED then
Canvas_Clear (%RGB_CYAN)
MessageBoxW (tDlg, strptr(mFaT), strptr(mFaCx), %MB_OK)
end if

case %butKr
if cbCtlMsg = %BN_CLICKED then Canvas_Clear (%RGB_MAGENTA)

case %butYi
if cbCtlMsg = %BN_CLICKED then Canvas_Clear (%RGB_YELLOW)

case %butAr
if cbCtlMsg = %BN_CLICKED then Canvas_Clear (%RGB_BROWN)

case %butHi
if cbCtlMsg = %BN_CLICKED then Canvas_Clear (%RGB_GRAY)

case %butJa
if cbCtlMsg = %BN_CLICKED then Canvas_Clear (%RGB_POWDERBLUE)

end select

END SELECT

End Function

primo
16-08-2019, 10:58
here is the very short example , with the spirit of the previous example
note these variables:
global tTxt as DWord
global nTxt as AsciiZ

and the using of:

control handle textDisplay.Handle, %txtNum to tTxt
nTxt = "Պատուհան փակել" + $CRLF 'Malayalam - India Language
nTxt = UTF8ToWideChar$(nTxt)
SendMessageW (tTxt, 12, 0, strptr(nTxt))

but after every click on the button we add a Japanese string and then adding it by:

SetWindowTextW(tTxt, strptr(nTxt))

we need yet GetWindowTextW
also it seems txtNum.Text designed (not sure) in which the Text method send to the textbox with functions without the 'W' at its end.
In general i think the Unicode problem is solved for me. if it is simplified more will be good
10008

ErosOlmi
18-08-2019, 13:48
Thanks a lot primo, your examples inspired :p

Next update (out next week) will have a start in letting thinBasic user interface able to handle unicode.

10010

primo
18-08-2019, 16:40
Thank you Eros, this is a big breakthrough in globalizing ThinBasic. which will be appreciated over the time in all the countries of the World.
i have noticed in the picture the addition of .TextW this is great since the user have the choice to use .TextW or .Text in the easy VB fashion to use UI without sacrificing the usual way
Best Regards

ErosOlmi
18-08-2019, 17:02
Yes, you inspired me about TEXTW.

Some more improvements:

console output using code page UTF8 will allow UTF8 in console scripts (still not available for all languages)
thinAir will understand Notes in UTF8



10011

ErosOlmi
19-08-2019, 22:47
thinBasic version 1.10.8 will be removed.
New features introduced are quite big so I will produce version 1.11 by tomorrow I hope.

With 1.11 I think I've found a solution for multi language without the need to introduce a new string type but using standard dynamic thinBAsic strings.
In general all internal thinBasic strings will be UTF-8 Strings.
I've started developing string functions working with "characters" compared to current string functions that are working with bytes.
So, for example, ...
Len(string) returns the length in bytes
CLen(String) returns the length in characters

Left$(string, nBytes) returns the left nBytes from a string
CLeft$(String, nChars) returns the left n Characters from a string and will work in all case in which there are UTF-8 characters regardless if UTF-8 char is 1 or 2 or 3 or 4 bytes long.

And so on with CRight$, CMid$ ...
If this road will be confirmed I will go on creating character version of the most important string functions

Attached an example of what I mean

10012

primo
20-08-2019, 06:30
just for thinking storming
it may be useful to have ideas from the Programming Languages which support Unicode from many years ago
basic256: this support FULLY Unicode from its beginning , it has a feature of one functions (Mid, asc, left... etc) knowing what is ascii and what is Unicode automatically, as an example:
write in the IDE this code:

txt="aПривет мир"
print length(txt)
ch = mid(txt,1,1)
print ch;" ";asc(ch)
ch = mid(txt,2,1)
print ch;" ";asc(ch)
the output is
11
a 97
П 1055

as can be seen it considers the length as characters, and Asc is representing it's UNICODE value. 'a' is the English 'a' while 'П' is Russian

another example is purebasic,
if the File Format --> Encoding Utf8

txt.s="aПривет мир"
Debug Len(txt)
ch.s = Mid(txt,1,1)
Debug ch + " " + Asc(ch)
ch = Mid(txt,2,1)
Debug ch + " " + Asc(ch)

output:
11
a 97
П 1055

but if the File Format --> Encoding Plain Text then
11
a 97
? 63

there are 2 functions here Asc and Ascii, but One Mid, Left,... etc
and what decide how to consider utf8 or ascii is the IDE adjusted as Encoding plain text or Encoding utf8

most Unicode awareness prize is for basic 256

now ThinBasic:
Left$(string, nBytes) returns the left nBytes from a string
CLeft$(String, nChars) returns the left n Characters

Not sure what to suggest, since if i suggest to be like Basic 256 ie One function for all then you will need to change all the string functions to have a self awareness of Unicode and this is a big job.
if you decide it like:
Left$
CLeft$
it is of course usable, but it needs more ideas
isn't it is possible to let the thinair have the choice of Encoding ? either text or utf8.

What Petr say ??

ErosOlmi
20-08-2019, 07:14
Yes, of course we are in the phase where we need to decide.

I do not like the idea to "force" strings to be all unicode because thinBasic is a general purpose scripting language used not only for user interfaces but for many other situations where unicode in not necessary.
I think having strings UTF-8 and have special functions dedicated to unicode let programmers choose what they need the way they need when they need.

Consider that if a programmer works in plain text ... functions working with bytes and those working with chars will act the same but at the same time programmer can works in all worlds (ansi, utf-8, wide) at the same time string by string.

I still didn't abandon the idea to have a new unicode dedicated string variable type like "WString" both dynamic and fixed.
It can be another option for programmers.

Anyway ... I'm open to all opinions.

primo
20-08-2019, 07:43
i heard before that some opengl functions does not work with Unicode, so full Unicode may let TBGL modeule not working (but not sure). i begins to realize your suggestion is better for everything to works well while fulfilling the wishes of international users to have a UI in their own Language.
you may needs to collect more ideas.

Petr Schreiber
20-08-2019, 20:46
Hi Primo,

the only limitation of TBGL would be the unability to print bitmap characters, as they use bitmap grid of 16x16 characters as look up table to draw the text.

Other than that - any kind of drawing of geomerty is unicode agnostic.

The font/print handling is very elementary, some proper text handling could be added as separate module.

I am under heavy workload these days, but I will try to give unicode/utf8 deeper thought soon and will share my ideas with Eros for consideration.

I really appreciate the effort Eros puts into it and I find it great to imagine there would be easy to use way to work with unicode naturally in thinBASIC.


Petr

DirectuX
21-08-2019, 10:10
Yes, of course we are in the phase where we need to decide.

I do not like the idea to "force" strings to be all unicode because thinBasic is a general purpose scripting language used not only for user interfaces but for many other situations where unicode in not necessary.
I think having strings UTF-8 and have special functions dedicated to unicode let programmers choose what they need the way they need when they need.

Consider that if a programmer works in plain text ... functions working with bytes and those working with chars will act the same but at the same time programmer can works in all worlds (ansi, utf-8, wide) at the same time string by string.

I still didn't abandon the idea to have a new unicode dedicated string variable type like "WString" both dynamic and fixed.
It can be another option for programmers.

Anyway ... I'm open to all opinions.

I suggest a switch to tell thinbasic how to deal with encoding, thus

changing encoding doesn't entail code rewriting (changing all string-related keywords)
in case the developed application deal with various encodings, code will be less prone to have near-duplicate parts of code
less keywords to deal with



#ENCODING "Windows-1252"
#ENCODING "UTF-8"
...

primo
21-08-2019, 14:00
#ENCODING "Windows-1252"
#ENCODING "UTF-8"
the suggestion of DirectuX is nice, one group of functions for the user. this #ENCODING switch defines what to do with the function (Len) as an example and how to change its behavior.
the hard problem remains on the side of the developers how to do that programaticaly.
may be:
if #ENCODING "UTF-8" the (Len) will call internally its CLen twin without the user to notice that
if #ENCODING "otherwise" the (Len) will call itself like in the classic ThinBasic

primo
23-08-2019, 20:46
testing some features of thinBASIC version 1.11.0.0 https://www.thinbasic.com/downloads.html#downloads
add these lines to the end of Function MainWindow_OnLoad() in example "Unicode Window Test" in \SampleScripts\Unicode

string s = "Беги меня"
txt1.Textw += s + $CRLF
long i
string hx_str, ch
string a = "Беги меня"
txt2.TextW += a + ": "+Clen(a)+" characters"+$CRLf
for i=1 to clen(a)
ch = CMid$(a,i,1)
hx_str = PEEKHex$(STRPTR(ch),2)
txt2.TextW += ch + " "+val("&h0" + hx_str)+$CRLf

next
and you will get output like below:
it is suitable for who wants to use his national language for the UI and some string functions like CLen CMid$ ...
i am glad that Eros have added the Simpson example, i was about to request its addition since it is funny and show the convenience of thinbasic-freebasic connection. freebasic makes the calculations, thinbasic display the graphics or perform analysis from the calculations. look it in \SampleScripts\FreeBASIC\Projects\BartSimpsons

to add some Language package to your windows Look:
https://support.microsoft.com/en-us/help/14236/language-packs Language Interface Pack (LIP)

Petr Schreiber
24-08-2019, 17:34
I really appreciate how community joins to help resolve the next important step in thinBASIC.

I value it very much, and I am looking forward to further discussion on the topic.

To add my point of view, I am unsure about global switches. Why? As long as script is monolithic, it is easy to judge the consequences, but once you start to integrate #include files from other, we can easily get into conflict, such as when main scripts sets the processing to #ENCODING "Windows-1252", and the included file as #ENCODING "UTF-8". Should it abort? Should such external included file be unusable?

ThinBASIC does not have concept of code units, which would enable the directive to be local to the file.

I have my hands dirty with global switches as well, because TBGL started with a lot of them, inheriting this code smell from OpenGL API design.

However, I addressed it with local TBGL_PushColor / TBGL_PopColor instead of TBGL_Color and the same for all other state changing objects. I wish I did this on the beginning. :oops:

This is why I would be careful about global switches. Thing to consider, please feel free to argue with me :) I am also still forming my opinion.

In theory, a less issuish could be region oriented switch, right?:


#ENCODING "UTF-8"
... code here ...
#ENDENCODING


This sounds good, however, imagine you load file and do not know if it is ASCII / UTF-8 or Unicode ahead. Then both the switch and region based approach start to cause issues.

Ok - so this is Petr complaining, what does he propose?

First, we should make clear which functions are unicode/utf8 ready, and which not.

- I think a proper data type to hold unicode text should be added, be it UTF8 or WSTRING
- currently, a lot of functions uses thinbasic_parseString. I think this and related parsing functions should raise runTime error in case user passes something which is UTF8 with strange character, or Unicode.
- I expect the character based functions to continue to work, after adjustment with some special thinBasic_ParseAnyString (just made this up) functions, explicitly acknowledging they are ready to go beyond ANSI/ASCII
- functions documented to work on character (LEFT$, RIGHT$, ...) level should continue working on character level, functions documented to work on byte level (LEN, ...) should work on byte level
- counterparts to work on byte/character level could be added
- it would be nice to add something like CHR$ able to create unicode code point by code
- it would be nice to have something like ASC to return character/codepoint code


Petr

DirectuX
25-08-2019, 11:18
Petr,
first, I would like to share my appreciation as how your post was constructed.

Then,

I am unsure about global switches. Why? As long as script is monolithic, it is easy to judge the consequences
Easy to forget, and you're right, global switches would be problematic. I remember TBGL push/pop coding to be easy, and I liked it. For longer scripts, I think the push/pop code to be more readable than region oriented switch one.



This sounds good, however, imagine you load file and do not know if it is ASCII / UTF-8 or Unicode ahead. Then both the switch and region based approach start to cause issues.
I can't understand this part. Here the problem is that one do not know the encoding of the file. You may want a function like this one ? :function.mb-detect-encoding (https://www.php.net/manual/en/function.mb-detect-encoding.php) Please, tell more about this.



I think a proper data type to hold unicode text should be added, be it UTF8 or WSTRING
Here, I understand you reasoning it here as a binary problem: utf-8 or not. Please explain, am I right or false ? see examples 10015 or encodings (https://www.php.net/manual/en/mbstring.supported-encodings.php)
Adding functions for every scenario would be heavy, isn't it?



- currently, a lot of functions uses thinbasic_parseString. I think this and related parsing functions should raise runTime error in case user passes something which is UTF8 with strange character, or Unicode.
- I expect the character based functions to continue to work, after adjustment with some special thinBasic_ParseAnyString (just made this up) functions, explicitly acknowledging they are ready to go beyond ANSI/ASCII
- functions documented to work on character (LEFT$, RIGHT$, ...) level should continue working on character level, functions documented to work on byte level (LEN, ...) should work on byte level
- counterparts to work on byte/character level could be added
- it would be nice to add something like CHR$ able to create unicode code point by code
My sentiment : too much adding. For backward compatibility and as you said, existing functions should by default behave as usual but unless the script told them to do otherwise (above push/pop discussion or similar): when context-specified, the same functions would answer regarding appropriate encoding. Note that, doing so, reusing old includes will not cause issue.



it would be nice to have something like ASC to return character/codepoint code
Eventually this functionality could be handled as above as other string-related functions.

Petr Schreiber
25-08-2019, 14:30
Hi DirectuX,

thank you very much for your comments. I really appreciate you took time to analyze the proposal and comment in detail.



This sounds good, however, imagine you load file and do not know if it is ASCII / UTF-8 or Unicode ahead. Then both the switch and region based approach start to cause issues.

I can't understand this part. Here the problem is that one do not know the encoding of the file. You may want a function like this one ? :function.mb-detect-encoding (https://www.php.net/manual/en/function.mb-detect-encoding.php) Please, tell more about this.


Badly worded from my part, I was writing faster than I was thinking. The idea was - imagine you have script with code which loads some random file during its execution. For example, script to analyze text from file passed via command line. You don't know the encoding of the dynamically loaded file at the time of the execution. Therefore, you cannot easily choose correct #ENCODING setting for further processing via string functions, which would otherwise be guided by #ENCODING in the original proposal.

I would like to avoid constructions like this:


if File_IsAscii(filename) then
<some string processing>
elseIf File_IsUtf8(filename) then
#ENCODING UTF8
<exactly the same string processing, just duplicated here to use correct encoding>
#ENDENCODING
end if




...
My sentiment : too much adding


I understand, but I want to avoid state when someone reads the help file, checks that Left$ works on character level, then tries to get first 2 characters from unicode chinese text and the result is actually two first bytes. This is what happens now and user has feeling that thinBASIC is "broken".

What I propose is that if Left$ currently cannot work with other than ASCII characters, it should cause runTime error rather than silently returning "byte garbage".


In the future, the internally used function thinBasic_ParseString in Left$ implementation would be replaced with thinBasic_ParseAnyString, and the Left$ would correctly handle both ansi and utf8 on byte level, for example.
That means more comfort for script author (no need for #ENCODING / #ENDENCODING) while preserving backwards compatibility


It would be very exciting to have proper utf8 handling in thinBasic. For me especially, as I am from Czech republic and my language uses all kinds of nonstandard characters. Just want to make sure it will be build on foundations which will stand the test of time :)


Petr

DirectuX
25-08-2019, 17:00
I want to avoid state when someone reads the help file, checks that Left$ works on character level, then tries to get first 2 characters from unicode chinese text and the result is actually two first bytes. This is what happens now and user has feeling that thinBASIC is "broken".

To me it seems more a documentation issue : Left$ works on character level providing you specified the correct encoding id.
Anyway, I understand.


I would like to avoid constructions like this...

That agree with this second point

changing encoding doesn't entail code rewriting (changing all string-related keywords)
in case the developed application deal with various encodings, code will be less prone to have near-duplicate parts of code
less keywords to deal with
where push/pop solution should be ok.


FE = requestFileEncoding(filename)
EncodingPush(FE)
<some string processing>
EncodingPop


I'm not against any solution but still not entirely convinced :)

José Roca
25-08-2019, 21:55
IMO using UTF-8 with Windows, that natively uses UTF-16, is a bad idea. Implement an UTF-16 string data type and leave UTF-8 to Linuxers.

ErosOlmi
26-08-2019, 10:09
Thanks José for your opinion.

If I was developing an application ... yes I would have chosen unicode maybe since the beginning.
But with the so big amount of code written to develop thinBasic it would necessity to change all. And I would also create problems to others I think.

I think the more convenient way for thinBasic to have unicode in user interface is to automatically transform all utf-8 strings in/out to unicode when it is needed. For user it will be transparent.

I'm making some changes and seems working fine.

In future I will try to add an unicode string data type to natively deal with unicode strings.

10016

PS: I removed CLEN, CMID, CLEFT, CRIGHT ... and added LENW, MIDW, LEFTW, RIGHTW
If more functions working with unicode strings will be added, I will use the W addition to the end of the classical function.

Very soon a new version.

DirectuX
26-08-2019, 11:36
I'm making some changes and seems working fine.

Hi Eros,
Seeing the screen capture...
did you test those sort of Unicode chars ? 🔒 📲 ⏯ ⟳ ∛ 😓 🚗 ɔısɐquıɥʇ basic⃔ thin thinb͜ksic

ErosOlmi
26-08-2019, 11:52
No but just testing ...
10017

UI seems ok.
Console has problems but that is another story :)

ErosOlmi
26-08-2019, 11:53
Released thinBasic Beta 1.11.1.0.
See first post of this tread.

List of new changes regarding UTF-8 and Unicode: https://www.thinbasic.com/public/products/thinBasic/help/html/index.html

primo
26-08-2019, 15:56
Thanks for the Update, yes LenW is better than CLen since we can track it in the Docs better.
i imagine the most hard part will be Parse$ and related.
from what i read:
say we are talking about "Я"
https://www.compart.com/en/unicode/U+042F
The source file containing "Я" is encoded as utf-8 with sequence 0xD0 0xAF, but the executable at runtime it will be encoded as utf-16 with sequence UTF-16 with sequence 0x042F
so using ASC("Я") will give us 0x042F = 1071 ie the Encoding utf-16
in fact i don't understand why is this this way. but i guess this is what happened in the Languages which support Unicode
and again i say your project of adding unicode and freebasic will be appreciated over the time and not immediately.

ErosOlmi
26-08-2019, 19:14
Ciao Primo,

yes that is the way: if you scan byte by byte you will find 0xD0 0xAF but if you scan in unicode it is 0x042F
It is just a matter on how you interpret the bytes

Can you explain me more about PARSE$?
PARSE$, PARSECOUNT, ... will work as usual both in ascii or utf-8 strings.

The following example will return the result in the picture:

uses "console"Console_SetOutputCP(%CP_UTF8)

string sBuffer = "thinBasic,Беги меня,копия,多言語テスト,안녕하세요 세계 (Korean),こんにちは世界 (Japanese)"
string sSep = ","
string s


printl "Find tokens separated by", sSep, "inside the following string:"
Printl sBuffer in %CCOLOR_fLIGHTCYAN
PrintL


long nTokens = parsecount(sBuffer, sSep)
long nCount
printl "Tokens found:", nTokens
printl "Tokens are:"
for nCount = 1 to nTokens
s = PARSE$(sBuffer, sSep, nCount)
printl $tab, nCount, "is:", S
Next


printl "---Press a key to end---"
WaitKey




10018

primo
26-08-2019, 21:06
Hi Eros
you seems have done it already, in your same example i want to parse$ the text with Russian char "e" : look Беги меня,копия
and it parse the text correctly. ... i am still testing
but this means that Parse$ works with ascii and utf8 without adding W like Midw$
10019


Uses "UI"
'---Define a button ID
begin ControlID
%txtBox
%cbOp
%btnPush
end ControlID

dialog Font "Courier New", 14
DIALOG New Pixels , Name textDisplay, 0, "tests",-1,-1, 640, 380,
%WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW,

CONTROL ADD Textbox , Name txtBox , textDisplay.Handle, %txtBox , "" , 10, 30, 350, 300, %ES_AUTOHSCROLL | %WS_VSCROLL | %ES_AUTOVSCROLL | %ES_WANTRETURN | %ES_MULTILINE | %ES_RIGHT | %WS_TABSTOP ' | %ES_NUMBER
CONTROL ADD BUTTON , Name btnPush , textDisplay.Handle, %btnPush , "Close" , 480, 340, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP

DIALOG SHOW MODAL textDisplay.Handle


'------------------------------------------------
' Callback function used to handle dialog events
' not handled by specific event functions
'------------------------------------------------
CallBack Function textDisplay_OnCallBack() As Long
'------------------------------------------------

End Function

'------------------------------------------------
CallBack Function textDisplay_OnLoad() As Long
'------------------------------------------------
'---Limits window minimum size
DIALOG SET MINSIZE textDisplay.Handle, 550, 320
'---Force resize logic
control set Resize CBHNDL, %btnPush , 0, 1, 0, 1

'---Some initial values
'---Change name to Run me
btnPush.Text = "Run me"

End Function
'------------------------------------------------
' Function fired when button Close is clicked
'------------------------------------------------
CallBack Function btnPush_OnClick() As Long
'------------------------------------------------
string sBuffer = "thinBasic,Беги меня,копия,多言語テスト,안녕하세요 세계 (Korean),こんにちは世界 (Japanese)"
string sSep = "е"
string s
long nTokens = parsecount(sBuffer, sSep)
long nCount

for nCount = 1 to nTokens
s = PARSE$(sBuffer, sSep, nCount)
txtBox.text += S + $crlf
Next



End Function

ErosOlmi
26-08-2019, 21:20
In reality I didn't do anything :)
Most of the string functions will work out of the box, some other not.

Also PARSE functions will not work in all cases: for example if you will use the ANY option there will be problems because ANY works on bytes level and not Chars level.
I will try to improve all the functions. Actually I'm working giving priority for User Interface so all thinBasic controls will be unicode aware.

We are just at the beginning :)

primo
28-08-2019, 17:20
LETTER_SetMask$ seems to work okay with Unicode. it defines what to consider as letters for any statistical possible tests
as an example we want to consider only the letters: "меняо"
so in sentence : "Беги меня,копия" we should get "еменяоя"
Question: Can we color as an example the result еменяоя" ?

Uses "UI"
'---Define a button ID
begin ControlID
%txtBox
%cbOp
%btnPush
end ControlID

dialog Font "Courier New", 14
DIALOG New Pixels , Name textDisplay, 0, "tests",-1,-1, 640, 380,
%WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW,

CONTROL ADD Textbox , Name txtBox , textDisplay.Handle, %txtBox , "" , 10, 30, 600, 300,
%WS_VSCROLL | %ES_AUTOVSCROLL | %ES_WANTRETURN | %ES_MULTILINE | %WS_TABSTOP | %WS_VSCROLL | %ES_AUTOVSCROLL | %ES_WANTRETURN | %ES_MULTILINE '%ES_AUTOHSCROLL
CONTROL ADD BUTTON , Name btnPush , textDisplay.Handle, %btnPush , "Close" , 480, 340, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP

DIALOG SHOW MODAL textDisplay.Handle


'------------------------------------------------
' Callback function used to handle dialog events
' not handled by specific event functions
'------------------------------------------------
CallBack Function textDisplay_OnCallBack() As Long
'------------------------------------------------
End Function

'------------------------------------------------
CallBack Function textDisplay_OnLoad() As Long
'------------------------------------------------
'---Limits window minimum size
DIALOG SET MINSIZE textDisplay.Handle, 550, 320
'---Force resize logic
control set Resize CBHNDL, %btnPush , 0, 1, 0, 1

'---Some initial values
'---Change name to Run me
btnPush.Text = "Run me"

End Function
'------------------------------------------------
' Function fired when button Close is clicked
'------------------------------------------------
CallBack Function btnPush_OnClick() As Long
'------------------------------------------------
Dim txt As String
Dim i As Long
txt = "Беги меня,копия"
txtBox.text += "the text is : "+ $crlf
txtBox.text += txt + $crlf
'LETTER_GetMask$ 'the built in mask is A to Z, a to z
String mask = "меняо"
LETTER_SetMask$(mask)
txtBox.text += "the mask is :"+ mask + $crlf

Dim tmp As String
tmp = LETTER$(txt)
txtBox.text += "after applying the new mask we extract only these characters:" + $crlf
txtBox.text += tmp+ $crlf


End Function

ErosOlmi
28-08-2019, 19:39
You cannot color part of the text of TEXTBOX.
You need to use RICHEDIT control but I didn't had time so far to modify it for unicode compatibility

ErosOlmi
31-12-2019, 14:26
thinBasic 1.11.2 released for BETA TESTING

DOWNLOAD URL: https://www.thinbasic.com/downloads.html#downloads

List of changes: https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_0_0.htm

Didn't want to finish the year without releasing what was already almost ready to be checked and used so far.
So here we are with a new release 1.11.2
Not much things but worth to have a look I think

Have fun
Eros

ErosOlmi
03-02-2020, 18:28
thinBasic 1.11.3.0 released for ALPHA TESTING

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.3.0.zip

Not yet finisched but there is something to test.
Beta version will follow

DirectuX
03-02-2020, 19:04
Thanks for the improvements !

Alpha testing :

HScroll bar : i see no change (https://www.thinbasic.com/community/project.php?issueid=608)

UDT : I have a simple code that worked with previous beta. It doesn't work any more. Can share.

SWICH : Fix confirmed (fast test)

Code completion : still appears while typing comment. Code tip too. Or is it something else ?

Null char at end of script : looks ok :)

RAWTEXT :
uses "CONSOLE"

dim myStr as String




' this is NEAR OK : thinAir code coloring is inadequat
myStr = RawText
7 CHARS
END RawText

PrintL len(myStr) ' 7 chars = OK


' this is not OK
myStr = RAWTEXT
"this is a sign: ' , and this is another sign: " "
END RAWTEXT

PrintL myStr

waitkey


ok, I just remembered you set the second part as a new issue.

first part was reported as issue #599 (https://www.thinbasic.com/community/project.php?issueid=599)

Petr Schreiber
03-02-2020, 21:11
I did few tests on my PC:
- horizontal scroll bars behave differently, but still not 100% correct
- BEFORE - there was intense flicker
- NOW - IF I move it fast, it works okay to move between start and end of line, if I move it slow, it sometimes does nothing at all

- user tools menu now handles up to 20 tools in total (up to 17 from thinAir_Tools_Usr.ini)
- user tools respect the thinAir_Tools_Usr.ini, excellent!

DirectuX, I see no code completion in comments on my PC :confused:



Petr

DirectuX
03-02-2020, 21:57
I did few tests on my PC:
- horizontal scroll bars behave differently, but still not 100% correct
- BEFORE - there was intense flicker
- NOW - IF I move it fast, it works okay to move between start and end of line, if I move it slow, it sometimes does nothing at all

- user tools menu now handles up to 20 tools in total (up to 17 from thinAir_Tools_Usr.ini)
- user tools respect the thinAir_Tools_Usr.ini, excellent!

DirectuX, I see no code completion in comments on my PC :confused:



Petr


Hi Petr :)


scroll bars :
never seen flicker :confused:
screenshot : 10126

code completion :
screenshots : 10127 & 10128

ErosOlmi
04-02-2020, 11:07
Updated again https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.3.0.zip
Horizontal scroll bars should work better now.

DirectuX
04-02-2020, 12:38
Updated again https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.3.0.zip
Horizontal scroll bars should work better now.

The scoll bar still doesn't allow to scroll to the end of the right. It stops before. Then to go further , the arrow must be clicked. Then, coming back to the left is stopped before the start of the screen. Again , arrow is required to show the beginning.

It behaves as if the scroll bar wasn't aware of the text width, but the arrows was.

DirectuX
04-02-2020, 12:50
Remark : in thinAir nPage seems to never change whatever the larger of the script. (see nPage on this picture (https://www.codeproject.com/Articles/1042516/Custom-Controls-in-Win-API-Scrolling))

ErosOlmi
04-02-2020, 13:08
The scoll bar still doesn't allow to scroll to the end of the right. It stops before. Then to go further , the arrow must be clicked. Then, coming back to the left is stopped before the start of the screen. Again , arrow is required to show the beginning.

It behaves as if the scroll bar wasn't aware of the text width, but the arrows was.

Scintilla Edit control uses a default 2000 column width: https://www.scintilla.org/ScintillaDoc.html#SCI_SETSCROLLWIDTH

As a work around I've added an option in theme file in order to improve width.
Change it into Default.theme.xml to a value like 6000 like the following

<item name = "scroll.width">6000</item> <!-- max hor scrollbar width. 0 to use default -->


Maybe I will find a clever way to adjust based on current script max width.

DirectuX
04-02-2020, 14:29
can't we just enable SCI_SETSCROLLWIDTHTRACKING (https://www.scintilla.org/ScintillaDoc.html#SCI_SETSCROLLWIDTHTRACKING) ?

DirectuX
04-02-2020, 14:50
Change it into Default.theme.xml to a value like 6000 like the following

<item name = "scroll.width">6000</item> <!-- max hor scrollbar width. 0 to use default -->


This works as expected ! Thanks Eros :good:

ErosOlmi
04-02-2020, 15:38
can't we just enable SCI_SETSCROLLWIDTHTRACKING (https://www.scintilla.org/ScintillaDoc.html#SCI_SETSCROLLWIDTHTRACKING) ?

Still to study consequences.

To be able to have splitting zones in editor (4 editable zones clones of the source code) some of the scroll bars are handled by scintilla editor and some are handled by my code.
Scrollbars marked are handled by my code, others are handled by Scintilla control.
I have to simulate what scintilla does.
10129

DirectuX
04-02-2020, 16:25
no problem :yes:


Not about thwarting your plans, but :

do you find it handy to have split windows ?

In desktop environment, I regularly find it easier to have two windows. It let them dock Left/Right (Win auto-size) or Bottom/Up but also fast switch with Alt+TAB.
In thinAir we already can have as many windows as wanted, ok, no Alt+TAB in thinAir :cry:. I mostly use it the way the "Arrange All" button (https://support.office.com/en-us/article/video-view-files-in-split-and-multiple-windows-8c6377a1-ed45-498e-80dc-635a6ae34547?omkt=en-001&ui=en-US&rs=en-001&ad=US)work in MS WORD (which is very convenient).


About in-script navigation ergonomics, I suggest improving further the "go to definition" & "go to previous position" features. By example, by extending this functionality to other user-definitions and includes-wide goto. Adding keyboards shortcuts would help too (we have no kb shortcuts for the "go to" features, for user tools, for close window. That may seems details, but after all, that's details that stands one out of the crowd
:)

DirectuX
15-02-2020, 17:42
Thinking to a strategy for going out from using Power Basic as main compiler used to develop ThinBASIC, I've come to the conclusion that FreeBASIC is the best choice:

syntax not far from Power Basic so source porting will not be a nightmare but just a matter of time
both 32/64 bits
rich set of functions
nice community that recently seems revamped
and other reasons


Porting ThinBASIC to be developed using FreeBASIC will be a long long run:

just ThinBASIC main Core engine is about 320K lines of code! excluding include file not developed by me ... remains about 170K lines of code
than there will be all ThinBASIC modules to recode, other 80k lines
thinAir, other 150k lines of code
thinDebug, other 50K lines of code
...

So it will take some time.


What about only roughly overwriting freeBasic keywords with thinBasic's ?


just ThinBASIC main Core engine is about 320K lines of code! excluding include file not developed by me ✘
... remains about 170K lines of code ✔
than there will be all ThinBASIC modules to recode, other 80k lines ✔
thinAir, other 150k lines of code ✘
thinDebug, other 50K lines of code ✘
...


saves 350k lines rewrite ? If I'm not mistaken, remains 250k rather than 600k.
then for modules, a pool to know with which modules to start with.

Petr Schreiber
17-02-2020, 20:52
Hi DirectuX,

I would start with those modules, which got opensourced & are small. These will show if FreeBASIC is really way to go.

For example:
https://github.com/ThinBASIC/thinBasic_registry

Another example looks similar, but will be more challenging to port - StringBuilder:
https://github.com/petrSchreiber/thinBasic_StringBuilder

It is simple, but uses COM based classes, which is the only type of classes thinCore SDK is able to wrap. This is where things might start to squeak as PowerBASIC has really neat implementation of COM.


Petr

ErosOlmi
23-03-2020, 15:32
thinBasic 1.11.3.0 ALPHA TESTING update 2020/03/23

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.3.0.zip

Huge number of new features to test during those sad days: cDateTime, WCon, thinAir new CallTips.
Also few fixes, see in What's New in help for the list
Sorry not yet documented in details but I'm working on.
https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_3_0.htm

To have an idea ... execute scripts in the following paths:

\thinBasic\SampleScripts\Classes\cDateTime\
\thinBasic\SampleScripts\WCon\

DirectuX
23-03-2020, 17:29
Thanks !

Wcon is nice and new tips too, so is CDATETIME !
Do you too have a vertical bar in thinAir on the 90th column ?

Take care .

Petr Schreiber
23-03-2020, 18:34
DirectuX,

check the magical palette alterations WCON allows, it is my favourite feature of the new module.

No need to redefine any drawed primitives, just altering palette can do nice tricks:


uses "wcon"


begin const
%COLOR_SKY_1 = 1
%COLOR_SKY_2 = 2
%COLOR_SKY_3 = 3
%COLOR_SKY_4 = 4

%COLOR_HOUSE = 5
%COLOR_HOUSE_WINDOW = 6
%COLOR_HOUSE_WINDOW_LIT = 7
end const


wcon_setFont "Consolas", 10, 18
wcon_window "Palette tricks", 100, 100, 80, 30, 8


drawSky(%COLOR_SKY_1, %COLOR_SKY_2, %COLOR_SKY_3, %COLOR_SKY_4)
drawHouses(%COLOR_HOUSE, %COLOR_HOUSE_WINDOW, %COLOR_HOUSE_WINDOW_LIT)


wcon_print cset$("This is the scene without palette, press key", wcon_cols using " ") in 0, 14 at 1, 1


wcon_inkey$


applyHousePaletteDay(%COLOR_HOUSE, %COLOR_HOUSE_WINDOW, %COLOR_HOUSE_WINDOW_LIT)
applySkyPaletteDay(%COLOR_SKY_1, %COLOR_SKY_2, %COLOR_SKY_3, %COLOR_SKY_4)
wcon_refresh


wcon_print cset$("Palette applied for day, press key", wcon_cols using " ") in 0, 14 at 1, 1


wcon_inkey$


applyHousePaletteDawn(%COLOR_HOUSE, %COLOR_HOUSE_WINDOW, %COLOR_HOUSE_WINDOW_LIT)
applySkyPaletteDawn(%COLOR_SKY_1, %COLOR_SKY_2, %COLOR_SKY_3, %COLOR_SKY_4)
wcon_refresh


wcon_print cset$("Palette applied for dawn, press key", wcon_cols using " ") in 0, 14 at 1, 1


wcon_inkey$


applyHousePaletteNight(%COLOR_HOUSE, %COLOR_HOUSE_WINDOW, %COLOR_HOUSE_WINDOW_LIT)
applySkyPaletteNight(%COLOR_SKY_1, %COLOR_SKY_2, %COLOR_SKY_3, %COLOR_SKY_4)
wcon_refresh


wcon_print cset$("Palette applied for night, thanks for watching :)", wcon_cols using " ") in 0, 14 at 1, 1


wcon_inkey$




sub drawSky(skyColor1 as int32, skyColor2 as int32, skyColor3 as int32, skyColor4 as int32)
int32 topRow = 1
int32 height


int32 skyColors(4) = skyColor1, skyColor2, skyColor3, skyColor4


for i as int32 = 1 to 4
height = wcon_rows/(i*2)
wcon_box %WCon_Border_None, 0, i, 1, topRow, wcon_cols, height
topRow += height
next
end sub


sub drawHouses(houseColor as byte, houseWindowColor as byte, houseWindowColorLit as byte)
int32 height
int32 houses = 8
int32 houseHeight
int32 houseWidth = wcon_cols / houses
int32 houseX, houseY

int32 h, wx, wy
for h = 1 to houses
houseHeight = rnd(wcon_rows * 0.1, wcon_rows * 0.6)

if houseHeight <= 3 then iterate for ' let's not draw the small one

houseX = (h-1) * houseWidth + 1
houseY = wcon_rows-houseHeight + 1
wcon_box %WCon_Border_None, 0, houseColor, houseX, houseY, houseWidth, houseHeight

for wx = houseX + 1 to houseX + houseWidth - 2
for wy = houseY + 1 to houseY + houseHeight - 2
wcon_print chr$(254) in iif(rnd > 0.5, houseWindowColor, houseWindowColorLit), houseColor at wx, wy
next
next
next
end sub


' --


sub applyHousePaletteDay(houseColor as byte, houseWindowColor as byte, houseWindowColorLit as byte)
WCon_PaletteSetColor(houseColor, rgb(64, 64, 64))
WCon_PaletteSetColor(houseWindowColor, rgb(64, 192, 255))
WCon_PaletteSetColor(houseWindowColorLit, rgb(70, 200, 255))
end sub


sub applyHousePaletteDawn(houseColor as byte, houseWindowColor as byte, houseWindowColorLit as byte)
WCon_PaletteSetColor(houseColor, rgb(48, 48, 48))
WCon_PaletteSetColor(houseWindowColor, rgb(64, 192, 255))
WCon_PaletteSetColor(houseWindowColorLit, rgb(253, 187, 90))
end sub


sub applyHousePaletteNight(houseColor as byte, houseWindowColor as byte, houseWindowColorLit as byte)
WCon_PaletteSetColor(houseColor, rgb(32, 32, 32))
WCon_PaletteSetColor(houseWindowColor, rgb(40, 40, 40))
WCon_PaletteSetColor(houseWindowColorLit, rgb(255, 192, 0))
end sub


' --


sub applySkyPaletteDay(skyColor1 as byte, skyColor2 as byte, skyColor3 as byte, skyColor4 as byte)
WCon_PaletteSetColor(skyColor1, rgb(30, 87, 140))
WCon_PaletteSetColor(skyColor2, rgb(34, 113, 179))
WCon_PaletteSetColor(skyColor3, rgb(99, 164, 204))
WCon_PaletteSetColor(skyColor4, rgb(89, 144, 175))
end sub


sub applySkyPaletteDawn(skyColor1 as byte, skyColor2 as byte, skyColor3 as byte, skyColor4 as byte)
WCon_PaletteSetColor(skyColor1, rgb(3, 111, 121))
WCon_PaletteSetColor(skyColor2, rgb(59, 157, 160))
WCon_PaletteSetColor(skyColor3, rgb(244, 212, 187))
WCon_PaletteSetColor(skyColor4, rgb(253, 187, 90))
end sub


sub applySkyPaletteNight(skyColor1 as byte, skyColor2 as byte, skyColor3 as byte, skyColor4 as byte)
WCon_PaletteSetColor(skyColor1, rgb(0, 0, 100))
WCon_PaletteSetColor(skyColor2, rgb(0, 0, 75))
WCon_PaletteSetColor(skyColor3, rgb(0, 0, 50))
WCon_PaletteSetColor(skyColor4, rgb(0, 0, 25))
end sub



Petr

DirectuX
23-03-2020, 21:54
Very cool Petr !

primo
23-03-2020, 21:59
Thanks Eros
i am testing. just a speedy note:
FreeBASIC included with thinbasic:
FreeBASIC Compiler - Version 1.06.0 (02-17-2019)
while the current freebasic is FreeBASIC-1.07.1

ErosOlmi
23-03-2020, 22:22
Yes I know but didn't had time to test it so far.
Will do asap

Hope that with CDateTime class object I closed the gap to have an easy date and time calculations in thinBasic.

primo
24-03-2020, 06:33
Eros, this is not a critical thing, it is almost the same
i will begins testing today
thanks for all your efforts

primo
24-03-2020, 09:58
in the IDE when i write Dim and space there is a big pop up describing the usage:
https://i.postimg.cc/d36Bnt3C/ide.png

i know i can disable the calTips from options
the issue is i can't return to the IDE unless minimizing the big popup and then expanding then the ide appears
seems the editor now support nicely the Unicode, since i can get the correct asc for a unicode char above 255 and written in the ide editor

ErosOlmi
24-03-2020, 10:07
Yes, I'm experimenting live help using Call Tips.
Some Call Tips can be big, I need to find correct compromise between informational and usability.

What resolution are you working?

primo
24-03-2020, 10:37
my resolution is 800x600 because i have poor eyes, i test this in xp and in win7. in higher resolutions even when making fonts larger i don't feel comfortable
thanks

ErosOlmi
24-03-2020, 10:41
:oops: sorry I didn't think about that.
I will reduce the amount of text and think a way to adapt automatically not to cover all the screen.

In the meantime I fix this you can change/disable call tips using the following node in Deafult Theme or adding a similar node withe the needed changes in another theme:
<style name = "calltip">
<item name = "activate">true</item>
<item name = "showlevel">9</item>
<item name = "font.face">Consolas</item>
<item name = "font.size">9</item>
<item name = "color.background">245,247,254</item>
<item name = "color.foreground">0,0,0</item>
</style>

If you set item name "activate" to false it will not show call tips

primo
24-03-2020, 11:19
yes now it works
if the calTips activated: and i write Dim and then space the tips appear but i can see the code so i write A and the tips disappear. this is what is needed thanks

ErosOlmi
24-03-2020, 11:25
What did you change? Maybe "font.size"

primo
24-03-2020, 11:42
i replaced
<style name = "calltip">
<item name = "font.face">Consolas</item>
<item name = "font.size">11</item>
<item name = "color.background">245,247,254</item>
<item name = "color.foreground">0,0,0</item>
</style>
by your code above
previously the situation is like this:
10137
now the situation is like the following, i can see the code:
10138

DirectuX
25-03-2020, 09:42
Eros,
maybe if we could choose between a tooltip (for hi-res) and a tab with scroll in the bottom panel (low-res) ?

10139

ErosOlmi
25-03-2020, 12:18
Yes, nice idea. I will consider how to implement
Thanks.

In the meantime I've uploaded a new thinBasic version.

Reduced some Call Tip text in order to have smaller call tips windows.
Another idea Petr gave to me is to have shrinkable zones in call tips but at the moment I cannot do it because call tips window is not under my control but Scintilla standard
Some improvements on thinAir UDT parsing and code completion ... just experimental but the idea seems to work
I finished File_CopyEX and documented. It wraps CopyFileExW Windows API function. Still not understand how to resume stopped copies .... MS documentation say it should leave the partial file on disk when function is called with %COPY_FILE_RESTARTABLE flag but instead it is removed. Will check again.
Added some documentation of cDateTime new class.

DirectuX
25-03-2020, 19:30
In the meantime I've uploaded a new thinBasic version.
I supposed it is located at the same previous link, I installed it, but can't difference them. (the "about" panel seems the same, maybe displaying a 'build number' for the testing sessions could help). Note: Freebasic isn't listed in the file info tab

I finished File_CopyEX and documented. It wraps CopyFileExW Windows API function. Still not understand how to resume stopped copies .... MS documentation say it should leave the partial file on disk when function is called with %COPY_FILE_RESTARTABLE flag but instead it is removed. Will check again. I wanted to test an idea about this, but the script curiously fails looking for a parenthesis in the callback function. (The sample from the help page). Do you have the same issue in the last thinBasic ?

10142

ReneMiner
26-03-2020, 06:39
Hey guys,

i'm just online to upload something and i wanted to report a minor buggy bug- am downloading new release now, but until i can check it ... it's a bit cumbersome ... SD-card into the phone, run to a building with a free wifi, return, sd-card out and then into pc... etc....


So i don't know if already corrected: applies to Thinair-User-Tools. There is a predefined ini-file in thinair\tools-subfolder, called thinair_tools_Usr.ini
i tried both (maybe Usr was a typo?) but if its called like above or if exchange "Usr" with "User" - in both cases the user-tools don't show up in the thinAir-menubar. So maybe it was forgotten to check both of the ini-files for tools. It works great if i hack in my tool-shortcuts into the regular .ini but that will be overwritten if i install a new version so i back-up my add-ons list already ;)
Now am nosy for the new version

and- to speed up code-completion i suggest:

Use 7z and unpack the thinbasic-offline-help. Then you have like 3000 single html-pages. Then use HTMLAsText-utility from Nirsoft (https://www.nirsoft.net/utils/htmlastext.html) - it will convert the complete help-files in one go into straight txt-files. Every page of the help file looks then as this example (ABS-function):


ABS








Navigation: ThinBASIC Language > thinBasic Functions > Numeric functions >


ABS















Description






Return the absolute value of a numeric expression.






Syntax






n = ABS(numeric_expression)






Returns






Number






Parameters










Name



Type



Optional



Meaning
























Remarks






Restrictions






See also






Numeric Handling,






Examples
























© 2004-2019 thinBasic. All rights reserved. Version 1.10.6 Web Site:
http://www.thinbasic.com





or another one (with parameters):



DIR_ListArray








Navigation: ThinBASIC Modules > File >


DIR_ListArray















Description






Fill an array variable with the list of files found in the specified path
having the requested characteristics.


Function will also return number of files found.






Syntax






nFiles = DIR_ListArray(StringArrayVariable, Path, Mask, [Attribute,
[Options]])






Returns






Number: number of files found.






Parameters

...( i cut a bit, all we need is above, except we could add an equates-list if we had the space for it - but not on a tooltip )-...

© 2004-2019 thinBasic. All rights reserved. Version 1.10.6 Web Site:
http://www.thinbasic.com




Thats from the offline-help file. It looks exactly as this above. I think it's a tiny effort only to parse all these files according to thinBasic-keywords.ini and fill it to the format of the code-tips. Maybe 2 hours and every keyword that has a page in help-file is finished and ready to go on codetips. Even i am not convinced of codetips as they are (see below)

Just look for

First line: Name - but that is not needed to fill the codetips when you use Dir_ListArray and go through Keywords.ini since all pages (i.e.Textfiles) are named as that keyword.
But it can tell you that there is a mistake in the helpfile if it doesn't match the titke.

"Description" - all that follows until it hits another one of the "delimiting headers"
"Syntax" : of course most important
"Returns" : should be on codetip too
"Navigation" the last before the current keyword tells us what module that keyword comes from.


Side-Effects you can get :
1. a list all undocumented keywords-(just to mention Disk_Size, Disk_Free from file-module, developed but not documented)
2. a list of all keywords that have a page in help-file but no description yet... thats quite a few and if there's no text between "Description" and "Syntax"- put into that list...
3. a list of all unused keywords ( for example Each which was probably thought to go as a pseudo-variable like in a batch-file with something as


{
[Do] [For|With] Each {<vartype>|<udt>} [At (<ptr1>, <ptr2>, <ptr3>,...) | In Array <name>]
' perform some operation /function on Each as
Each.Position.Reset()
' or
Each.X += 1
[Do|With] Next

Anyway how it was thought - the keywords are used but non-functional yet.

And just because i did it already i append the extracted and into txt converted help - but it's of the previous tB-version.

All that brings me to another thing that i thought could be very, very, very useful:

Make the console a part of thinAir! As the statusbar on bottom, maybe 5 to 8 lines by default, resizeable using a splitbar below code-window. If executing console-file from thinAir use it as STDOUT if no other DIRECTIVE in the code.
And: Make it that i can use it while i am coding to instantly execute my input. Example:
I type


Ready > ? Hex$(1234)

? - the short of print as in the 1980s,
(just for nostalgic purpose dedicated to a built-in-editor-direct-commandline)

and it would save that line to a very small file (always same file..) and thinbasic will execute this 1-line script and return an output instantly:



Ready > ? Hex$(1234)
thinBasic: 4D2
Ready > _


For enhancement it could have predefined variables as ASM had (x,y,z & 2 arrays a() + b() as numbers and maybe also strings like s1$,s2$, s3$ and 2 arrays L$() + N$() (List$()+Name$()) that will keep their values stored in the invisible part of the script (or .ini) so it will allow to perform more complicated calculations until we type "CLM" (clearMemory)
- It would make tools as the ASCii-table unnecessary since we can type ? ASC("X") or ? CHR$(41) to retrieve what we want to know from thincore.

It should be like the Codebrowser and Explorer have a TAB-control so we can switch from this Console to some other (new) textbox that shares this position on thinAir-surface.
And here we are back at what i described above.
Trash the tooltip-codetips - since they always cover the code and they are too small and disappear when i want to read them, make it bit bigger,give us cake and not breadcrumbs!
Replace tooltip-codetips with an instant-help-window that can be visible where we have that built-in console. Just have a TAB-controls as mentioned for console and thinBasic-quickhelp to share the same location. It could display a bit more than just tooltips and for sure stays visible as long as we want.

OK, that's it for tonight -i know it's a lot... hopefully you got some ideas, in the meantime i will try out the new version.


Addendum: Now where is it? I cannot find a new version and- another very disturbing bug that i found in thinAir:
The setting "Show only currently open files" for the filelist below Explorer-Tree always returns to "YES" by itself.

I have to say that my thinBasic is not installed on "C:\thinBasic" but on "E:\thinBasic". On "C:\thinBasic" as well as "D:\thinBasic" i have symbolic links that link the directory on "E:\thinBasic" so i can use thinBasic in all my windows-versions (even from X: where i have a Windows PE as emergency-system as flatboot on HD - and there tb is the most valuable tool of all! Especially if starting from usb it allows to access everything that windows says would be impossible...)

DirectuX
26-03-2020, 13:40
Make the console a part of thinAir! As the statusbar on bottom, maybe 5 to 8 lines by default, resizeable using a splitbar below code-window. If executing console-file from thinAir use it as STDOUT if no other DIRECTIVE in the code.
And: Make it that i can use it while i am coding to instantly execute my input.

Personally I would find something like this particularly useful in thinDebug :

while code execution is in pause (or at breakpoint), it would be nice/useful/convenient... to be allowed to execute new instructions in this very context of that pause.

ErosOlmi
26-03-2020, 15:45
I supposed it is located at the same previous link, I installed it, but can't difference them. (the "about" panel seems the same, maybe displaying a 'build number' for the testing sessions could help). Note: Freebasic isn't listed in the file info tab
I wanted to test an idea about this, but the script curiously fails looking for a parenthesis in the callback function. (The sample from the help page). Do you have the same issue in the last thinBasic ?

10142

Here it is working fine.
There is an updated version online at the same link of the first post of this thread if you have time.

I will make another update by this evening or max tomorrow.
I'm finding a way to increase build number for every update. Actually I have a backup process of sources at avery version changing so I need to review the entire process.

DirectuX
26-03-2020, 19:20
It works. I think that Copy/Paste from web help is in cause (my fault !?). Had to remove carriage returns.

DirectuX
27-03-2020, 18:09
Though there is still something wrong. I have a previous code with File_CopyEX that raise an error in thinDebug (but not in straight thinAir !? ). I'll make a test with previous alpha and tell you.

DirectuX
27-03-2020, 18:11
Personally I would find something like this particularly useful in thinDebug :

while code execution is in pause (or at breakpoint), it would be nice/useful/convenient... to be allowed to execute new instructions in this very context of that pause.

.. or to be able to replace instructions on the fly

DirectuX
27-03-2020, 18:59
update:



sSFile = Dialog_OpenFile(hDlg, "Source file", DIR_GetCurrent, "All Files (*.*)|*.*" , "*", %OFN_FILEMUSTEXIST)
sDpath = Dialog_BrowseForFolder(hDlg, "Destination folder", DIR_GetCurrent, %TRUE) & FILE_PathSplit(sSFile, %Path_FileExt)

mbresult = MsgBox 0, sSFile & $crlf & "will be copied to" & $crlf & sDpath, %MB_OKCANCEL

if mbresult <> %IDOK Then
MsgBox 0, "Aborting demo"
Stop
endif


runs well in thinAir, but when in thinDebug, it stops on an error :

10145

ReneMiner
27-03-2020, 21:49
while installation this new version 1.11.03 repeatedly (maybe 5 times msgbox "Internal Error -failed to expand group constant. Sounds -ehh windish or does tb have a group policy too?

ErosOlmi
28-03-2020, 10:35
So i don't know if already corrected: applies to Thinair-User-Tools. There is a predefined ini-file in thinair\tools-subfolder, called thinair_tools_Usr.ini
i tried both (maybe Usr was a typo?) but if its called like above or if exchange "Usr" with "User" - in both cases the user-tools don't show up in the thinAir-menubar. So maybe it was forgotten to check both of the ini-files for tools. It works great if i hack in my tool-shortcuts into the regular .ini but that will be overwritten if i install a new version so i back-up my add-ons list already ;)
Now am nosy for the new version


Ciao Renč

here it is working fine to add new user tools. "Usr" is correct
Added something like the following in \thinBasic\ThinAir\Tools\thinAir_Tools_Usr.ini

[MyTool001]
Menu=My personal tool 001
CommandLine=%thinAirinstallpath%\Tools\thinClippy\thinClippy.exe "%sourcecodefullpathnameext%" -w
SaveScriptBefore=true

Then Close thinAir and re-open and you should have a new menu
10146


Regarding your idea for Call Tips thanks. I will go through it ...
Before doing it, at the moment I'm concentrated on fixing bugs and try to find the right compromise in usability and informational not to be too much intrusive during programming.

Next update will have something also on autocompletion for UDT element parsing, at least for UDT defined in the same script.

ErosOlmi
28-03-2020, 10:45
update:



sSFile = Dialog_OpenFile(hDlg, "Source file", DIR_GetCurrent, "All Files (*.*)|*.*" , "*", %OFN_FILEMUSTEXIST)
sDpath = Dialog_BrowseForFolder(hDlg, "Destination folder", DIR_GetCurrent, %TRUE) & FILE_PathSplit(sSFile, %Path_FileExt)

mbresult = MsgBox 0, sSFile & $crlf & "will be copied to" & $crlf & sDpath, %MB_OKCANCEL

if mbresult <> %IDOK Then
MsgBox 0, "Aborting demo"
Stop
endif


runs well in thinAir, but when in thinDebug, it stops on an error :

10145

I tried and here it seems working fine
Only problem I saw is that Dialog_BrowseForFolder function seems not adding a trailing "\"

Maybe copy/paste problem from web page?
10147

I will try to check what is causing that copy/paste problem, maybe a unicode char is inserted like end of line or end of paragraph

DirectuX
28-03-2020, 11:58
Maybe copy/paste problem from web page?
It's my own typed code.



I tried and here it seems working fine
Did you try with F8 in thinDebug ?, it's were it bugs.


I will try to check what is causing that copy/paste problem, maybe a unicode char is inserted like end of line or end of paragraph
yeah told so in a previous post, it looked like the issue came from carriage returns.

ErosOlmi
28-03-2020, 12:11
Yes, I executed in debug step by step with F8

DirectuX
28-03-2020, 12:55
Then I don't know what's wrong.
I'll try to find out this w-e.

Edit : when I comment out this part of code, the debugger finds and error lower, again commenting out the lower error leads me deeper in the code...and so on. Seems thinDebug doesn't locate accurately what is bothering it. It will take longer to find the incriminated line.

DirectuX
28-03-2020, 14:04
'Modeless
CONTROL ADD BUTTON , hDlg, %button1,"Start COPY", 65, 420, 45, 20

Commenting out this line removes the error. Eros, did you change something to the buttons ?

ErosOlmi
28-03-2020, 15:43
No, didn't change anything in that area.
I'm working mostly in thinAir

Can you send me a complete code example giving error so I can test it?

DirectuX
28-03-2020, 19:47
No, didn't change anything in that area.
I'm working mostly in thinAir

Can you send me a complete code example giving error so I can test it?

Conversation continued in the asynchronous-file-operations (https://www.thinbasic.com/community/showthread.php?13026-asynchronous-file-operations) thread.

ErosOlmi
28-03-2020, 20:18
Debugging a script that use an user interface message pump can create false runtime errors.

Problem is related to the fact that windows message pump is too intense to be trapped correctly so parsing of script at runtime can jump into script position different from the one expected by thinBasic Core Engine.

Windows events are fired asynchronously and stopping them at runtime by the debugger move parsing position in a place that Core do not expect.

I do not know if I will be able to solve this for the moment with current thinBasic Core structure that is single thread parsing.
The only way I see to solve this situation it to have different parsing threads working at the same time: one for Core engine and others for windows/controls events each working separately with a script pointer different for each one.

Will think about that.

DirectuX
28-03-2020, 20:29
Debugging a script that use an user interface message pump can create false runtime errors.

Problem is related to the fact that windows message pump is too intense to be trapped correctly so parsing of script at runtime can jump into script position different from the one expected by thinBasic Core Engine.

Windows events are fired asynchronously and stopping them at runtime by the debugger move parsing position in a place that Core do not expect.

I do not know if I will be able to solve this for the moment with current thinBasic Core structure that is single thread parsing.
The only way I see to solve this situation it to have different parsing threads working at the same time: one for Core engine and others for windows/controls events each working separately with a script pointer different for each one.

Will think about that.

If the problem is known, it's half ok.


"a script that use an user interface message pump"
Does it mean modeless only ? Because the second example is modal and has the error too.

ErosOlmi
28-03-2020, 20:36
Yes all.

And error can or cannot occurs randomly depending on messages sent to/from the script.
Maybe I will find a way to solve without recoding thinBasic from the ground up removing some events only when script is under debugging.
It would be similar to Visual Designers that remove events when in visual editing.

Will see.

DirectuX
28-03-2020, 20:46
Thanks Eros I understand.
Not prioritary from my window,
but maybe worth highlighting it in documentation or better put a warning in the thinDebug error message.

ReneMiner
28-03-2020, 22:30
I do not know if I will be able to solve this for the moment with current thinBasic Core structure that is single thread parsing.
The only way I see to solve this situation it to have different parsing threads working at the same time: one for Core engine and others for windows/controls events each working separately with a script pointer different for each one.

Will think about that.


K, lets get crazy:

Why so difficult?Isn't the easiest way to have thinBasic.exe find a directive in the script as:

#Multithreading On

Then it would need a script-structure that follows a few rules: most important: each thread requires its own scriptfile. TBMain must be inside the main-file which only original thinBasic.exe has access to.
Then thinBasic might create a copy of itself lets say "tbTemp00000001.exe" and shells ASYNC
tbTemp00000001.exe threadDoThis.tBasicU
to fire the first thread. it would continue executing the main-script and as soon it hits another task it will not busy itself with executing it but create another copy of itself in the temp-folder and delegate the execution of the new thread to the TB.exe-clone, shell ASYNC:
tbemp00000002.exe threadDoThat.tBasicU
etc.
The original thinBasic.exe will only do the main-script and supervise it's temporary copies and wait for some threads that will actually not run infinite, the clones will know their own ID from command$ so they can send feedback to the one who started them "I am tBTemp00000042.exe and i am finished.
thinBasic.exe will know, there is a clone that has no job -so it doesn't need to clone itself delegate if there is another thread to do. And finally - lets say a tBProject-file had a built-in variable that keeps track of the current execution-state (100= preparse, 200= declarations, 300 =allocating globals,....1000 Start at app_entrypoint.... 99999999 = Destroy and stop execution.... If anyone pushes the exit-button "Superthincore" will delete all the thread-executing clones after putting them safely to sleep.

If it is possible to do multiple threads at once from a foreign multithreading environment where thinBasic acts as embedded scripting language then its for sure possible in its native environment. Just don't think in the current, conservative way but try the crazy, the unthinkeable,
use the "I don't care whats the limit"-way then its possible to get beyond that what appears as current limitation.

ErosOlmi
29-03-2020, 01:34
:D:D Rene the motivator

Yes yes ... I will work on it but before I what to finish the work on thinAir.
I want thinAir to become a great editor for all of you using thinBasic.
So far it is just an editor but with the call tips, the auto completion and other ideas I have it can become great I hope.
I think I'm on the right track.

Very soon a new update ... with more thinAir features.
Next update will have revision number updated :)

ErosOlmi
29-03-2020, 10:52
thinBasic 1.11.4.0 ALPHA TESTING update 2020/03/29

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.4.0.zip

Improved autocompletion for UDT.
Added support for me. using dotted notation. Me. inside and UDT recognize UDT elements

https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_4_0.htm (https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_11_3_0.htm)

ReneMiner
01-04-2020, 10:16
Still a problem if running scrpts via thinAir.After scrpit-execution thinbasic-process is not terminated correctly and is causing thinAir to lag and finally to crash, erasing from currently open script-list up to all Thinair-settings.

To prevent it, it will be necessary to store the process-ID when a script is executed from thinAir by pressing F5/f8 of click on the icon.
So my suggest: Place the another one to the toolbar-buttons like in the attached png that says "STOP".
So we can Start (F5) or Debug (f8) or run obfuscated, Have a button to Pause (for debugger) and a NEW button: Stop that will force the thinbasic-script-execution process to stop.


I draw icons for it already and a few more to it- attached dll-archive filled with dozens of new thinBasic dedicated icons.

Again thinAir-Settings :the filebrowser- setting "Show only currently open items" is very annoying - it always returns by itsel to setting_ "YES" and causes the file-list below browser tree to stay empty. Maybe make "No" the default setting for this?

EDIT: SORRY I EXCHANGED SOMETHING, IT WAS THE WRONG FILE THAT I ATTACHED PREVIOUSLY, I HOPE THATS BETTER NOW
______________________________________________________________________________________
If you need some tool to extract the icons from the dll - or if you want to add more, a free tool that can handle icons all sizes, animated cursors and able to read or write icon-libraries or dll-files the best i've found so far is Greenfish Icon Editor (GFIE) Pro 3.6. (http://greenfishsoftware.org/gfie.php)

ReneMiner
01-04-2020, 11:11
I am sorry- uploaded dll came of the wrong folder. This one contains a bit more...

ErosOlmi
01-04-2020, 11:54
Thanks Renč.

I created "Process" tab exactly to be able to control executed process.
thinAir is an evolving construction site at the moment so give me some time.
thinAir Options will be recoded from the ground up.

Thanks for the icons :)

DirectuX
01-04-2020, 14:12
On my machine (win8.1 x64), when installing v1.11.4.0 alpha 2020/03/29 there is an error : 10154
(I tried as admin too.)
(AV log says nothing related)

Note: It can be bypassed with "skip".

ErosOlmi
01-04-2020, 14:52
Thanks a lot for reporting.
In this version I've updated SetUp process using latest Inno Setup version 6.0.4
I will try to go back to version 6.0.2 and report your error

ReneMiner
01-04-2020, 21:56
THEMES-isssue:
if using the split Editor-Window and apply a new theme it will only be applied to the current active code-window so i can end up using 4 diffferent themes at the same time on each instance of thinair.

If one of the themes is no more available on reload of thinair later, it gives an Error-message about this and the code-window will stay empty. Until i split to open all 4 codewindows and apply a valid theme to each of the 4 portions it will repeat the error-message .

Solution:
Make sure to apply a theme to all portions of the code-window - no matter if visiible or not to prevent.

(see attached image)


for the built-in console/process/output-section :
it's good to know that it's planned but can not test the look of any themes because of no text-sample in these boxes. And hopefully the area gets some splitter to size them al gusto

ReneMiner
03-04-2020, 04:37
..and please add a setting to have the code-tip-text optional displayed inside the Info-Area too or in another of those 4 or maybe a 5th tab for this. The disadvantages of tooltip-codetips are they cover the code and they vanish before i finished reading it. Also they appear always in different positions so i would prefer to see it always in the same position and i don't like them disappearing when i want to read but i don't want them to cover the code.

Only replace the displayed tip with another tip then, do not vanish a the tooltips do, just leave it there readable until another one is to dsiplay. If click into the window on a keyword it could do the same as F1 when pointer is hovering a keyword anf open offline help on that topic.

Also to the codetips when showing syntax of user-functions they only show the first line. Example:



Function mySuperfunc(ByRef Eros As Olmi, ' do not continue this line but follow code until ")" + "AS" + <unquoted_String>
Optional ByVal Rene As Miner ' >> because this is a comment it should not be visible in codetips
) As ThinBasicUsers ' but "as result-type" should be displayed
...

Codetips do not show all parameters until the end but only what is on the first line.
Same will be if codetips for declared functions come up and
"Declare Function someFunction(-...
...) As result"
will use more than one line

If parsing function headlines( or declare function-lines ) it should go until the close-parens and check for "AS" + unquoted String.
If it says function but there is no "As ResultingType" in the end ,it would show the TB-default:"As Long"
for Subs it is enough to check until parenthesis are even again

ErosOlmi
04-04-2020, 21:28
Thanks a lot Renč. I will go through all your ideas as soon as possible.

ErosOlmi
04-04-2020, 21:32
In the meantime a little preview of what you will find in next update 1.11.5
When script is executed output process window will enlarge and a monitoring toll will appear showing some info that can be useful to create better script: cpu usage, memory consumption, gdi objects allocated and more info will come.
All in a nice html control window very easy to be adapted for personal needs.

10174

I think next week I will be able to release new version.

ReneMiner
05-04-2020, 00:05
Between these 2 pictures is a time of less than half a minute after I set the setting in the second row to No, it returns to yes again instNtly

Petr Schreiber
05-04-2020, 15:34
Rene,

thanks a lot for the reported issues & ideas!


Petr

ReneMiner
06-04-2020, 22:51
Sorry, taking screenshots with the phone was not the ideal solution...
I made a real screenshot.

Please look into that magnifying glass there. What can you see?
Right. Thats a font drawn with foreground white on a background that is white too.
For essential settings & bundle try to use some INVERTED font or draw it in XOR-Mode. Only make sure not to use RGB(128,128,128)...

The problem is, with scintilla- I tried dozens of scintilla based html- and texteditors but all have in common there is no built-in way to change fontcolors of treeviews and listviews. Mostly i have black on black or white on white and it needs some time to find the control and sendmessage to the container that all his childs must can continue to use white on white but with another drawmode applied.

And i was not really satisfied with the icon that combines the freebasic with thinbasic-logo, the psychology of that icon doesnt give any good karma - thinBasic must not be displayed bigger than freebasicand all of a sudden on top of it. I made some additional icons where freebasic is displayed in front.

primo
07-04-2020, 16:29
Control Append Text hDlg, %ID_TextBox ... does not work with unicode
but
Control set Text hDlg, %ID_TextBox ... works
a test for Russian words Один and два
displayed as meaningless rubbish with Control Append Text while displayed okay with Control set Text

tested with TB 1.11.4.0
uncomment line 37 to see the correct working of Control set Text

Uses "UI"

Begin ControlID
%ID_TextBox

End ControlID

Function TBMain()
Dim hDlg, hFont As Long

Dialog New 0, "TextBox experiments", -1, -1, 500, 400, _
%WS_DLGFRAME Or %DS_CENTER Or %WS_CAPTION Or %WS_SYSMENU, _
0 To hDlg

Control Add Textbox , hDlg, %ID_TextBox, "" , 5, 25, 450, 310, %WS_BORDER Or _
%WS_TABSTOP Or _
%ES_WANTRETURN Or _
%ES_MULTILINE Or _
%ES_AUTOHSCROLL Or _
%ES_AUTOVSCROLL Or _
%WS_VSCROLL Or _
%WS_HSCROLL
Integer FW_BOLD, CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH
FW_BOLD = 700: CHARSET = 204: OUT_DEFAULT_PRECIS =0:CLIP_DEFAULT_PRECIS =0:DEFAULT_QUALITY=0: DEFAULT_PITCH=0
hfont = CreateFont(-18, 30, 0, 0, FW_BOLD, FALSE,_
FALSE, FALSE, CHARSET, OUT_DEFAULT_PRECIS,_
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH,"Arial")

Control Set Color hDlg, %ID_TextBox, Rgb(0,0,255), Rgb(200,255,200)

Control Send hDlg,%ID_TextBox, %WM_SETFONT, hFont, 0

Control Append Text hDlg, %ID_TextBox, "One" + $CRLF+ $CRLF
Control Append Text hDlg, %ID_TextBox, "Two" + $CRLF+ $CRLF
Control Append Text hDlg, %ID_TextBox, "один" + $CRLF + $CRLF
Control Append Text hDlg, %ID_TextBox, "два" + $CRLF+ $CRLF
'Control set Text hDlg, %ID_TextBox, "один" + $CRLF + $CRLF + "два" + $CRLF+ $CRLF
'---Show dialog in MODAL
Dialog Show Modal hDlg, Call dlgCallback
End Function

CallBack Function dlgCallback() As Long

Select Case CBMSG
Case %WM_CLOSE
End Select

End Function


CHARSET = 204 for Russian as explained in :
http://www.manmrk.net/tutorials/basic/PowerBASIC/pbcc5/font_new_statement.htm

ReneMiner
08-04-2020, 14:13
The regular Autocomplete-function should be adjusted (more configurable)

Currently seems thinAir has forgotten about equates and preprocessor-keywords.
if typing #, $ or % nothing happens with autocomplete but CDATA in default-theme is ok, they are still in the wordchar-list or is there a new setting (the settings-dialog says in codetip Autocomplete will show the keywords for that are codetips available. The previous setting (autocomplete shows even user-variables, keywords, numbers and quoted strings of all current open files was much better then.
The other thing : what could be improved is the setting at which char the autocomplete wiill open, in notepad++, synwrite or even sciTE its configurable and it should be at least 2nd or 3rd char before it opens. The annoying thing of that 1st-char-setting is i type any keyword for exapmle

"SEL" (i use enter because it says "SELECT" - it fills in the autocomplete-text "SELECT" stops at the last Char("T") has so to speak already 1 char for a keyword and appends instantly the first keyword that starts with "T" - so my typed Word is
"SELECTBGL_ALPHAFUNC" and i must backspace until its the desired "SELECT" only. It will probably not happen when the autocomplete requires 2 chars or more to open.
Another point to this: it already works to use TAB- as well as RETURN-Key (some others use space-key only which is a bit crazy if the user wants to insert a space) so we are advanced. But smart were, if i use TAB-Key i want to continue on the current line and if the autocompleted expression is a functional keyword- i.e. a FUNCTION for example
Dir_ListA... it would know that must continue on this Line with "rray("
for sure until the open parenthesis - with or without line-continuation it should do this .


To make it understandeable i will use

.. dots instead of spaces and
: a colon for the new cursorposition
|~| indent - if $SPC & $SPC & $SPC or $TAB, auto or manual will not matter
the code in the line that i type in the example starts after the first |~|



If whatever then
|~|X = Dir_ListA: <<<here i press TAB-Key and it completes to be like below the line
EndIf the cursor will stay in the current line
______________________________________________________
If whatever then
|~|X = Dir_ListArray(.:.)
EndIf
'______________________________________________________
'______________________________________________________
'Same again but used enter-key this time:

If whatever then
|~|X = Dir_ListArray(
|~||~|:.)
EndIf


will end up one line down, but instead of one space behind the cursor it would add
1 more indent since the actual codeline is not starting here.


But this can only be when the completed keyword is a function or known to be an array, i.e. makes use of Parenthesis after the keyword.
In other cases when no parenthesis will follow we have a few keywords that are followed by another one,
examples: Array Scan ... Control Add... Desktop Get ... . Of course as long no delimiter follows the keyword (even comma) it will not jump down into the next line on enter. It should at max complete
"Contr" to become "Control Get Text .:" when this line was selected using the arrow keys

Just for a clue , there is
"CONTROL{$SPC}SET{$SPC}RESIZE" or
"CONTROL{$SPC}SET{$SPC}TEXT"
- space chars can be inserted due prefix escaped as \x20 (regEx) or like {$SPC} =thinbasic-syntax to replace something within a string , usually we do like {1} within quoted string and replace {1} with the first replacement {2} with second...
If the autocomplete knows the expression continues after the whitespace because {$SPC} means the keyword continues as in "End{$SPC}With" - so "End{any white space}With is for the parser known to handle.
And >< Any('white space') = $SPC should be doable for the autocomplete to since it needs only to print spaces that are not recognized as delimiting tokens.

Anyway, too much already... does anyone know how to determine cursor-position in a standard-textbox?
Or is it possible to use the scintilla-control right from thinAir_SciLexer.dll by declare in tB?
Or does someone have created the "scintilla.inc" for tB already?

Petr Schreiber
09-04-2020, 07:37
@Rene - note taken regarding visibility, there is a plan to recode the dialog
@Rene - note taken regarding call tips, makes sense - thank you! I think #, $, % will work in 1.11.5 already
@primo - Primo, thank you for letting us know! This somehow slipped under the table, we will have a look :drink:


Petr

Petr Schreiber
09-04-2020, 08:42
@Rene - fix prepared for high contrast issue you found, will be present in next release.


Petr

ReneMiner
09-04-2020, 13:36
somethin else i discovered last night. I stumbled across wcon. I read as much as the help said: A console control and i thought: Wow, exactly what i was looking for. I made a nice dialog and put all the resources around where i thought my viewport could contain this new direct-responding tool which mght test small chains of few orders or something, but i searched and searched and in the powerbasic forum the people talking about a control. But its as the canvas-window just a single window. It does not even accept to be a child since on creation is no parameter that would accep a parent. So this is not a control but just another multicolor-console.window? And can we bring this to be standard-output using classic console functions?
Or is it possible to cut the dll apart again and remove the window so the control can be used with some additional stuff as maybe a listview together in one window? I mean i have plenty of commandline-tools that all lack some auto-update and provide data viewable sorted in a table somehow..

And by the way there are 2 screens: the first one is probably a bug when calculating the ´coding area width´´and the scroll is at pos 0 but the displayed column is somewhere else.It will not always allow me to scroll until the very first column. Then the vertikal line that tells the right border of the page is ahead is bit annoying since i do not use autoline linebreak and sometimes write until text is 5 or more desktops width and then i sort it..

And the other image displays the search & replace-window. Why are those buttons to replace all disabled? I am fastertyping a small utility that assorts and replaces what i want then hitting 2000 times the mousebutten if have to replace each one by one.
And ANNOYING: If open Search & Replace the focus is in the top-row even i selected an expression in the codewindow already. Most of the time i accidently erase what i wanted to replace becase i put the replacement-text where actually belongs the search-text.


And maybe i should ask in another thread- is it possible to use ocx-controls somehow in TB? How can i load scintilla control (the one that drives thinair) as a RTF-replacement? And if it were possible to detect the cursor position in a standard textbox as thinbasic has in stock - so i can insert text or cut or select it from the textbox then it were probablynot necessary to find a console control but only to capture the output of commandline tools. Any ideas?

ReneMiner
09-04-2020, 16:52
What i wanted to say: there is (i guess you heard of it) synwrite another text editor using scintilla also really good made in comparison to some others its a full notepad++ replacement, some things handled even better. But what wanted to say is that their lexer is able to open another language while currently already full in environment. Means you edit maybe some Thinbasic-script and have embedded assembler code. You define a switch as #ASM_Inline=" and from there the syntax highlight can be either basic, ASM or mixed. If you like you can then still go into another section of you code where's maybe Freebasic, Ini- or registry settings or imported code of whatever. For me its not so interesting what different languages are use but the mechanics that can slightly make thinAir a bit less stressed.

I think about Typing:



Uses "UI", "UIadv" - does the lexer know its time to add codetips , keywords etc. Of UI-Module
#include Once "Headers.bas" ... predefined importware ahead, lets add the green tags---


USES "TBGL"
Include "..\Inc\*gl*.inc"

' heavy packages upcoming, hundreds of additional functions & keywords, additional helpfile to activate, '' ' shorten Autosave-breaks from 5 to 3 minutes


And by the way, most editors offer built in macro-support. Its like i have a page full of codelines that must be assorted, remove doublequotes or i place something onto the clipboard and shell a batch or tb-script and let it do something. I guess most of the functtions are createable in thinBasic- but one or two things are always done pretty fast and it can be useful. Is something as built-in macro- recorder planned orwill we hook mouse and keyboard ourselves with native methods? Still a few of those macro.recorders are available that just persist of a dialog with a button - could be plugIn too

ErosOlmi
11-04-2020, 14:27
thinBasic 1.11.5.0 BETA TESTING update 2020/04/11

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.5.0.zip

Added process monitoring of scripts executed inside thinAir
You will be able to monitor cpu and memory of the single process
It is also possible to stop process from thinAir in case you loose control of your script.
Again improved call tips and autocompletion. Those two aspects will be improved in next releases.

https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_5_0.htm

Process monitor is built using a web browser control updating its content with data taken from process info.
Charts are created using https://www.chartjs.org/ javascript library.

Hope this feature will work for all of you.

primo
11-04-2020, 17:31
Thanks for the nice new features
is it possible to Hide or UnHide the "OutPut - Info - ToDo - Process" lower window in the IDE ? will be suitable to hide it if we want more IDE space.
the Hide should of cource imply the process.monitoring.active">false
unhide: will imply the process.monitoring.active">true
in the Default.theme

DirectuX
11-04-2020, 19:28
Thanks for the nice new features
is it possible to Hide or UnHide the "OutPut - Info - ToDo - Process" lower window in the IDE ? will be suitable to hide it if we want more IDE space.
the Hide should of cource imply the process.monitoring.active">false
unhide: will imply the process.monitoring.active">true
in the Default.theme

Hi Primo, I had the a similar idea about it, hide or at least make it sizeable down to 0.

And Happy Easter :egg26:

ErosOlmi
11-04-2020, 20:13
Will work on this in order to give as much coding space as possible.
I will try to make edit control full screen also

ReneMiner
11-04-2020, 21:08
Beautiful. I like it. And for the additional windows- for me its ok. I would just like something- as an empty 3rd tab where are code+filebrowser where i could load my own plugins & tools while running it fullscreen. For me its quite enough space even to split the codewindow into 6 an _ you can just hold ctrl and turn the mousewheel to zoom out, jou wont believe what you can display on one single desktop already. If the small /half-size windows could split into left and right or if it were alltogether costumizeable like in the small image that i attached here.

to make it short: look at the small image thats named partitions. Not quite yet but almost. If we could plit a bit more (mabye the right side into 4 partitions) and we can decide what to display in these parts (codetips, resources, process-window, todo-list, direct-input to run single statements within 1-line-scripts or even the option to open a helpfile in one of the partitions instead having it dissapper behind the ide - why not tell the help-file: here, this area is your little desktop (scintilla can display html already by default ;) ) and another thing independend of how or if at all-the partitions will be reality:

A PlugIN-slot:
A predefined borderless window with a maximum size limit that will add 1 more tab to codebrowser/filebrowser- It should execute tB-functions as the users program the control- I would like to create another treeview for example to display all variables of a project. And i want to implement a few small utilities that i often use. For example a textbox that gets filled with names of icon-when i give choose a path and makes it instantly ready to use code for an image-list. And it were cool to have a plugin-section within the main-menu that not just lists the available plugins but also can exchange the current one during runtime of thinair. It should be possible to create submenus and order the plugins as i find them. A new plugIn can either create a new folder(i.e. popup) or go into one that exists already.

ErosOlmi
13-04-2020, 23:44
thinAir next version will have a kind of "concentrate on edit" mode or F12

Pressing F12 will hide/show: menubar, toolbar, output window, statusbar.
Only MDI tabs, editor and code browser will remain on screen.

1018810189

Also added a new option in themes to specify code browser indentation level in pixels in order to have more compressed code browser treeview elements

DirectuX
14-04-2020, 08:23
Thanks Eros for all the efforts you make in thinAir's improvement !

ReneMiner
14-04-2020, 09:04
This ist the not so good News. Thinair Crashes extremely often. Always if a bug occured thinair closes and did not save history so I have to search all my folders for the file I just created.It crashes at so simple stuff when running a console script and do something as using dism.exe /online /cleanup-image /scanhealth Without administrator privileges. So thinair can not debug when using F5. I didn't try F8 yet

ErosOlmi
14-04-2020, 09:18
OK Renč I want to solve this definitely.
It happened only few times to me so not easy to understand, I need some info.

What Operating system are you using? From you signature it seems Windows 10, right?
Is it crashing only when executing a script or also on closing thinAir
Any additional info you think are useful to me?

Thnaks
Eros

ReneMiner
14-04-2020, 09:53
Yes i am using win 10.
I am Not Sure sometimes it happens while coding also but definetely If Windows raises Error Always. I am at the doctor right now. I will Check intense when i returned at the house.i am running on. An Asus vivobook 4GB RAM, 2 TB internal HD + some Micro-sd-card with 200GB that i never pulled Out since ... Months. Only attached a Mouse, nothing Else Runs. But i am on Win 10 v 1909 (an esd that was published 2 months before the official 1909. IT IS having Bugs - Backgroundtaskhost.exe often shells stack-overflow and mostly the Startmenu does Not Work (Not opening Startscreen when click taskbar Nor win-key Works. I can renew the Windows without any effect or Install again. I have also the official 1909 but there's No Enterprise- Version on the iso and since i registered the Enterprise from Developer Test Version i have a license for that- and for Home-Edition. Maybe i can inject MS Edge from the later 1909 into the Developers Test-Image . I will try this afternoon . Else i will Just Put a Backup that i Made before it got the stack-overflow. It's Caused by Microsoft Edge which i never Made to remove fast enough. And its Like Windows destroys itself on purpose. But in PE-mode (different edition win10 Professional, flat boot so WinPE running from HD instead of ramdisk) thinair also crashed a few times. But its the same tB-Installation which ist located on Partition E:\
But for C: i have a symlink since its NTFS, means installed onto C:\thinbasic but it gets directly to E:\thinBasic folder. For Partition x:\ which is fat32 to be bootable i implemented the required registry -keys that IT IS installed to E:. If i have Bugs with that thinBasic writes the error-logs right next to the Script

primo
14-04-2020, 11:43
what is this vertical line in the IDE:
10190
can we change its position, i tried to drag it by mouse and it is sticky

ReneMiner
14-04-2020, 11:52
Thats the right Border. Means IT stays in the Line that has the Most chars. Its pretty useles and you can Change its Position Default 80 in the thinair-default theme. Perhaps its possible to turnof witha negative value but IT will Return i fear. Set IT at 20480 in the theme then i guess you will only See IT If you have 20kb on one line. Maybe make it Hex(7FffFFff) 7 and seven f

ErosOlmi
14-04-2020, 11:54
Yes i am using win 10.
I am Not Sure sometimes it happens while coding also but definetely If Windows raises Error Always. I am at the doctor right now. I will Check intense when i returned at the house.i am running on. An Asus vivobook 4GB RAM, 2 TB internal HD + some Micro-sd-card with 200GB that i never pulled Out since ... Months. Only attached a Mouse, nothing Else Runs. But i am on Win 10 v 1909 (an esd that was published 2 months before the official 1909. IT IS having Bugs - Backgroundtaskhost.exe often shells stack-overflow and mostly the Startmenu does Not Work (Not opening Startscreen when click taskbar Nor win-key Works. I can renew the Windows without any effect or Install again. I have also the official 1909 but there's No Enterprise- Version on the iso and since i registered the Enterprise from Developer Test Version i have a license for that- and for Home-Edition. Maybe i can inject MS Edge from the later 1909 into the Developers Test-Image . I will try this afternoon . Else i will Just Put a Backup that i Made before it got the stack-overflow. It's Caused by Microsoft Edge which i never Made to remove fast enough. And its Like Windows destroys itself on purpose. But in PE-mode (different edition win10 Professional, flat boot so WinPE running from HD instead of ramdisk) thinair also crashed a few times. But its the same tB-Installation which ist located on Partition E:\
But for C: i have a symlink since its NTFS, means installed onto C:\thinbasic but it gets directly to E:\thinBasic folder. For Partition x:\ which is fat32 to be bootable i implemented the required registry -keys that IT IS installed to E:. If i have Bugs with that thinBasic writes the error-logs right next to the Script

OK thanks.
I'm trying to go intense debug here to try to trap the problem.
So far no crash but I'm sure there is something because I experienced it in the past.
In 1.11.4 I recoded the process that save open scripts list and I thought I fixed because it never happened after that change but maybe there is something else somewhere.

ReneMiner
14-04-2020, 11:58
Problem ist that IT will Not save a Log i guess. because it Waits for the end to make the final save. Will profiler make notes or is a Button to save memory when running on F8-mode? If you have to create then make it both ;)

ReneMiner
14-04-2020, 12:01
Problem ist that IT will Not save a Log i guess. because it Waits for the end to make the final save. Will profiler make notes or is a Button to save memory when running on F8-mode? If you have to create then make it both ;)

And IT saves the Script before it Runs yes. But IT doesnot Update the recent-files-list before it Crashes so my thinair Starts after the Crash Always sad and empty

primo
14-04-2020, 13:42
Thank you ReneMiner , yes it works, when we replace 90 by -1 the right hand border is disabled
found here
<options name = "edge">
<item name = "mode">1</item>
<item name = "column">90</item>

regarding the crash of the IDE, it seems stable in my win7 x64, but a shoot in the Dark that the reason happened when Process is active, i say that because in winXP the process does not stop when we close the program, it continue counting in the End: line until the IDE crash, i don't ask to correct this for XP but it may refer to the IDE crash in win 10.

ReneMiner
14-04-2020, 14:48
Yes that i observed top. Once IT has run the Statusbar the Numbers still keep in flickering and changing. Since i am Back Home i started Scripts twice but both Times after execution terminated regular (Press Key to end at console-app, .tBasicC)
Thinair crashed Always. But i am currently setting Up Something. Maybe in a few minutes i can give IT a try on WinPE/RE

ReneMiner
14-04-2020, 20:18
Just for the wcon a question again. How can i use the Control without the Windows or Vice versa, can i make the Control sizeable using a splitbar so i might place a Listview or treview to empower the console to fill results in odered manner and polled automatically If possible? I mran there are many useful Tools. A menu to the console would be doable and is already possible but a menu can provide no table when IT Always closes. To replace the console with a standard textbox needs to know how for example can i find the Cursor textPosition or Selektion start to end. Or is the scintilla Control Able to be my Instant console while i am coding so i could use simple Functions as to get a square root or some Unicode 2 Hex instantly. Write the Codeline to a Script, execute and the Output cold be displayed in output

And to add something closer on topic, see image. I never saw this before. Its not a codeline there and i did not draw a
>>>>>> box that points right. anyway i had it one minute earlier already. i clicked onto a code-folldmark (theyre way to many) better use a comment as ' [+] [:] [-] so users can place them code-independet .
i clicked this +-sign and the whole page folded into half or something, that was more than simple folding as i know from notepad++. And then the vertical right scrollbar did no more reaction. i had to restart thinair becaus i could not access my script. It did no more move- and than that symbol - nothing happens if i click it and it blocks the line so thereis no line-number nor possible to write....


And please tell me how to separate the wcon from its window- or how can i make this window the child inside a viewport

DirectuX
15-04-2020, 18:39
Thank you ReneMiner , yes it works, when we replace 90 by -1 the right hand border is disabled
found here
<options name = "edge">
<item name = "mode">1</item>
<item name = "column">90</item>

regarding the crash of the IDE, it seems stable in my win7 x64, but a shoot in the Dark that the reason happened when Process is active, i say that because in winXP the process does not stop when we close the program, it continue counting in the End: line until the IDE crash, i don't ask to correct this for XP but it may refer to the IDE crash in win 10.

Hi Primo,

to disable, set <item name = "mode">0</item>

ReneMiner
15-04-2020, 19:25
Yes IT has Something to so with a setting that can be changed through themes. I can Not Tell which but i did not overwrite my buggy OS yet. All i did was to use a Copy of thinair default.theme and created a new theme of it.since i use IT last night i had less Crashes of thinair so i think IT IS Something maybe related to window-settings in themes. Because i made a completely new one. Perhaps another process that is started by thinair and that uses values stored in themes and when IT finished will save(?) But has No permission (did Not inherit Admin-Privileges by thinair?) Just i read Eros Post again and have to add:IT Crashes Always instantly after i Close the os-message If for example Administrator-rights required to execute a command. IT Crashes also when the Script was terminated by thinBasic but then i See the prrocess-window doing some Action and thinair disappears without further Message. That Happens also If i start a Script that i Just typed in and IT Claims error, Missing Parenthesis or If without endif or Something that is the usual when i try to run a Test, normally i would fix the Missing Parenthesis, Look for the if-endif etc. But now its crashing when i click the thinBasic-error-message "OK" - i See behind that Message thinair going to the Position of the error- but AS soon that process of thinBasic ends and thinair should have full Control again thinair Windows vanishes. Its Not in taskbar Nor listed in Task-Manager. So i assume its Crashes or run into gpf an was terminated by Windows-Policy because of illegal accessing Something. Sorry typing into the Phone i try to correct but IT IS.... Grrrr

ReneMiner
16-04-2020, 11:50
definetely something changed. i made sure it will not start thinair without admin privileges. So its no more crashing as before and i am sure it must be a setting in the theme-file that i exchanged. Thats the one i use at the time. I don't know why but thinair is not able to handle few scripts in memory , currently i have like 8 or 9 open scripts, none more than 16kB. But its 2 of 3 hours thinair is not responding and it shows a hilarious number how much memory it consumes. See screenshot. If my scripts occupy altogether 300kB - and none is
running you will know that i am bit shocked and its annoying to wait until it responds again so i can save and close it. Why no autosave with a timer that saves configurable every x minutes all scripts that have been changed in that time to some backup folder. Not just for that current cause but also sometimes i code and type
and type and type and - no i dont like the approach - i want to go back 1 hour. Then it would be nice to have backups in different stages. just with a data-time-stamp into a folder that i provide lets say i could set it to 20 stages that will be kept of a script. if it is more than it will not instantly delete any script but ask to zip all of the backups into an archive. then if more than 20 stages of that script again and i already gave permission to zip the backups let it add them to the zip archive. and lets say it makes the 100 full- no problem. Give the message once (the backup-archive of scriptfile xy.tBasic already contains 100 stages of development". "OK" i move it somewhere or rename it and put it somewhere and if project done maybe i will delete it, maybe i only finished because i had plenty of backups. if not important to me, i will change settings maybe save once in 30 minutes or per hour.


<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) Eros Olmi


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->


<!--
Parent theme file name.
IMPORTANT: ALWAYS INDICATE a parent theme. Default.theme.xml is the preferred.
Any setting not found in this theme will be derived from parent theme.
Parent theme is recursive: a theme can have a parent that has another parent ...
-->
<ThinAirTheme version = "1" parent = "Default.theme.xml">


<ThemeInfo>


<!-- Version of souce code example -->
<Version>1.0</Version>


<!-- Last update date -->
<UpdateDate>2018/04/30</UpdateDate>


<!-- Description of the souce code example -->
<Description_Short>Modified thinBasic theme</Description_Short> <!-- Name to be displayed in the templates listing -->
<Description_Long>no never Default. Always special thinBasic theme</Description_Long> <!-- Description to be displayed -->


<!-- Author information -->
<Author_Name>RenePlayed</Author_Name>
<Author_eMail>try@thinbasic.com</Author_eMail>
<Author_WebSite>https://www.thinbasic.com</Author_WebSite>
</ThemeInfo>


<resources>


<editor>
<style name = "default">
<item name = "font.face">IBM Plex Mono</item>
<item name = "font.size">11</item>
<item name = "font.bold">false</item>
<item name = "font.weight">0</item> <!-- 0 to 900 by steps of 100 -->
<item name = "font.italic">false</item>
<item name = "font.underline">false</item>
<item name = "color.background">11,22,44</item>
<item name = "color.foreground">240,245,243</item>
<item name = "text.case">0</item> <!-- 0=mixed (as typed), 1=upper, 2=lower, 3=camel -->
</style>


<style name = "comments">
<item name = "color.foreground">40,140,80</item>
<item name = "font.italic">true</item>

</style>


<style name = "keywords">
<item name = "color.foreground">250,185,165</item>
<item name = "text.case">3</item> <!-- 0=mixed (as typed), 1=upper, 2=lower, 3=camel -->
<item name = "font.face">IBM Plex Mono Semibold</item>

</style>


<style name = "strings">
<item name = "font.face">IBM Plex Mono Medium</item>
<item name = "color.foreground">222,244,150</item>
</style>


<style name = "constants">
<item name = "text.case">1</item> <!-- 0=mixed (as typed), 1=upper, 2=lower, 3=camel -->
<item name = "color.foreground">120,220,240</item>
<item name = "font.face">IBM Plex Mono Semibold</item>

</style>


<style name = "numbers">
<item name = "font.face">IBM Plex Mono Medium</item>
<item name = "color.foreground">180,160,240</item>
</style>


<style name = "operators">
<item name = "font.face">IBM Plex Mono Semibold</item>
<item name = "font.bold">true</item>
<item name = "color.foreground">255,200,130</item>
</style>


<style name = "whitespace">
<item name = "color.background">55,22,33</item>
<item name = "color.foreground">126,162,200</item>
</style>


<style name = "indentguide">
<item name = "color.background">55,22,33</item>
<item name = "color.foreground">126,162,200</item>
</style>


<style name = "caret">
<!-- Cursor -->
<item name = "color.foreground">200,250,180</item>
<item name = "width">1</item> <!-- The width of the line caret: 0, 1, 2 or 3 pixels. The default width is 1 pixel-->
<item name = "period">220</item> <!-- The rate at which the caret blinks in milliseconds -->
</style>


<style name = "caretline">
<!-- Line containing the cursor -->
<item name = "visible">true</item>
<item name = "font.weight">600</item> <!-- 0 to 900 by steps of 100 -->
<item name = "color.background">95,184,248</item>
<item name = "alpha">66</item> <!-- Alpha ranges from 0 which is completely transparent to 255 which is opaque. The value 256 is opaque and uses code that is not alpha-aware and may be faster -->
<item name = "visiblealways">true</item> <!--TRUE to make the caret line always visible even when the window is not in focus-->
<item name = "frame">0</item> <!-- supported from scintilla 3.7.5. If 1 means no caret line color but a frame-->
</style>


<style name = "selection">
<!-- selected text -->
<item name = "overridestyle">true</item>
<item name = "font.weight">900</item> <!-- 0 to 900 by steps of 100 -->
<item name = "color.background">40,240,212</item>
<item name = "color.foreground">240,230,20</item>
<item name = "alpha">80</item>
<item name = "frame">4</item>
<item name = "eol.filled">false</item> <!-- select the entire line up to the right hand border -->
</style>


<style name = "brace">
<!-- brace matching -->
<item name = "highlighting.color.foreground">194,156,250</item>
<item name = "highlighting.color.background">99,66,33</item>
<item name = "bad.color.foreground">240,254,160</item>
<item name = "bad.color.background">250,80,50</item>
</style>


<style name = "margin.linenumber">
<item name = "font.face">larabiefont rg</item>
<item name = "font.size">9</item>
<item name = "font.bold">false</item>
<item name = "font.weight">300</item>
<item name = "font.italic">false</item>
<item name = "font.underline">false</item>
<item name = "color.background">10,35,20</item>
<item name = "color.foreground">250,230,200</item>
</style>


<style name = "margin.folding">
<item name = "flags">8</item> <!-- https://www.scintilla.org/ScintillaDoc.html#SCI_SETFOLDFLAGS -->


<item name = "highlightblock">true</item>


<item name = "color.background">33,166,166</item>
<item name = "color.foreground">33,99,66</item>


<item name = "folder.color.background">33,166,166</item>
<item name = "folder.color.foreground">0,188,3127</item>


<item name = "folder.open.color.background">33,166,166</item>
<item name = "folder.open.color.foreground">124,35,88</item>


<item name = "folder.openmid.color.background">33,166,166</item>
<item name = "folder.openmid.color.foreground">124,35,88</item>


<item name = "folder.sub.color.background">33,166,166</item>
<item name = "folder.sub.color.foreground">124,35,88</item>


<item name = "folder.midtail.color.background">33,166,166</item>
<item name = "folder.midtail.color.foreground">124,35,88</item>


<item name = "folder.tail.color.background">33,166,166</item>
<item name = "folder.tail.color.foreground">124,35,88</item>


<item name = "folder.end.color.background">33,166,166</item>
<item name = "folder.end.color.foreground">124,35,88</item>


</style>


<style name = "margin.error">
<item name = "color.background">27,74,98</item>
<item name = "color.foreground">225,222,200</item>
</style>


<style name = "calltip">
<item name = "activate">true</item>
<item name = "showlevel">9</item>
<item name = "font.weight">600</item>
<item name = "font.face">Borgen Bold</item>
<item name = "font.size">11</item>
<item name = "alpha">75</item>
<item name = "color.background">16,12,50</item>
<item name = "color.foreground">234,245,80</item>
</style>


<style name = "indicator.region">
<item name = "active">true</item> <!-- tru/false if activate indicator for regions -->
<item name = "style">9</item> <!-- 0 ... 19 7 = INDIC_ROUNDBOX: https://www.scintilla.org/ScintillaDoc.html#Indicators -->
<item name = "color.foreground">230,221,87</item>
<item name = "alpha">165</item>
<item name = "alpha.outline">140</item>
<item name = "setunder">true</item>
</style>


<style name = "indicator.function">
<item name = "active">true</item> <!-- tru/false if activate indicator for regions -->
<item name = "style">7</item> <!-- 0 ... 19 7 = INDIC_ROUNDBOX: https://www.scintilla.org/ScintillaDoc.html#Indicators -->
<item name = "color.foreground">0,225,125</item>
<item name = "alpha">140</item>
<item name = "alpha.outline">120</item>
<item name = "setunder">true</item>
</style>


<style name = "indicator.sub">
<item name = "active">true</item> <!-- tru/false if activate indicator for regions -->
<item name = "style">7</item> <!-- 0 ... 19 7 = INDIC_ROUNDBOX: https://www.scintilla.org/ScintillaDoc.html#Indicators -->
<item name = "color.foreground">0,225,125</item>
<item name = "alpha">140</item>
<item name = "alpha.outline">120</item>
<item name = "setunder">true</item>
</style>


<style name = "indicator.callback">
<item name = "active">true</item> <!-- tru/false if activate indicator for regions -->
<item name = "style">7</item> <!-- 0 ... 19 7 = INDIC_ROUNDBOX: https://www.scintilla.org/ScintillaDoc.html#Indicators -->
<item name = "color.foreground">225,115,0</item>
<item name = "alpha">100</item>
<item name = "alpha.outline">100</item>
<item name = "setunder">true</item>
</style>


<style name = "indicator.type">
<item name = "active">true</item> <!-- tru/false if activate indicator for regions -->
<item name = "style">7</item> <!-- 0 ... 19 7 = INDIC_ROUNDBOX: https://www.scintilla.org/ScintillaDoc.html#Indicators -->
<item name = "color.foreground">185,12,116</item>
<item name = "alpha">200</item>
<item name = "alpha.outline">150</item>
<item name = "setunder">true</item>
</style>


<options name = "edge">
<item name = "mode">0</item>
<item name = "column">90</item>
<item name = "color">11,22,44</item>
</options>


<options name = "mouseover">
<item name = "delay">80</item>
</options>

<options>
<item name = "margin.linenumber.width">32</item>
<item name = "margin.symbol.width">8</item>
<item name = "margin.folding.width">18</item>


<item name = "tabs.usetabs">true</item>
<item name = "tabs.tabwidth">2</item>

<item name = "tabs.indent">2</item>
<item name = "tabs.tabindent">1</item>
<item name = "tabs.backspaceunindent">1</item>


<item name = "word.chars"><![CDATA[_#%$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]]></item>


<item name = "scroll.width">1366</item> <!-- max hor scrollbar width. 0 to use default -->

</options>


<options name = "whitespace">
<item name = "viewws">2</item>
<!-- viewws:
0 The normal display mode with white space displayed as an empty background colour.
1 White space characters are drawn as dots and arrows,
2 White space used for indentation is displayed normally but after the first visible character, it is shown as dots and arrows.
3 White space used for indentation is displayed as dots and arrows.
-->
<item name = "size">0</item>
<item name = "tab.drawmode">1</item>
<!-- tab.drawmode:
0 The default mode of an arrow stretching until the tabstop.
1 A horizontal line stretching until the tabstop.
-->
<item name = "extra.ascent">0</item>
<item name = "extra.descent">0</item>
</options>

</editor>


<codebrowser>
<style>
<item name = "color.background">11,22,44</item>
<item name = "color.foreground">240,245,243</item>
<item name = "color.line">204,228,134</item>
<item name = "font.face">PT Mono</item>
<item name = "font.size">10</item>
<item name = "font.width">0</item>
<item name = "font.weight">0</item> <!-- 0 to 900 by steps of 100 -->
</style>
</codebrowser>


<filebrowser>
<!--
DO NOT USE:
still under development
-->
<style>
<item name = "treeview.background">11,22,44</item>
<item name = "treeview.foreground">240,245,243</item>

<item name = "treeview.selected.background">0,180,255</item>
<item name = "treeview.selected.foreground">215,223,0</item>


</style>
</filebrowser>


<panels>
<style>
<item name = "main.color.background">55,125,185</item>
<item name = "output.color.background">45,105,25</item>
<item name = "info.color.background">33,77,133</item>
<item name = "todo.color.background">133,77,33</item>
<item name = "process.color.background">0,35,75</item>
</style>

<options>
<item name = "process.monitoring.active">true</item>
<item name = "process.html.template">ProcessMonitor\Html\ProcessMonitor_Template_1Chart.htm</item>
<item name = "process.monitoring.sampling.points.max">30</item>
<item name = "process.monitoring.sampling.delay">900</item> <!-- DO NOT GO BELOW 500 -->

<item name = "process.onstart.maximize">false</item>
<item name = "process.onstop.minimize">true</item>

</options>


</panels>

</resources>


</ThinAirTheme>




dont bother -the fonts will not effect that and it will drop back to defaults. I used these fonts many times already.
Now check "the screenshock" :D

DirectuX
16-04-2020, 12:20
definetely something changed. i made sure it will not start thinair without admin privileges. So its no more crashing as before and i am sure it must be a setting in the theme-file that i exchanged. Thats the one i use at the time. I don't know why but thinair is not able to handle few scripts in memory , currently i have like 8 or 9 open scripts, none more than 16kB. But its 2 of 3 hours thinair is not responding and it shows a hilarious number how much memory it consumes. See screenshot. If my scripts occupy altogether 300kB - and none is
running you will know that i am bit shocked and its annoying to wait until it responds again so i can save and close it. Why no autosave with a timer that saves configurable every x minutes all scripts that have been changed in that time to some backup folder. Not just for that current cause but also sometimes i code and type
and type and type and - no i dont like the approach - i want to go back 1 hour. Then it would be nice to have backups in different stages. just with a data-time-stamp into a folder that i provide lets say i could set it to 20 stages that will be kept of a script. if it is more than it will not instantly delete any script but ask to zip all of the backups into an archive. then if more than 20 stages of that script again and i already gave permission to zip the backups let it add them to the zip archive. and lets say it makes the 100 full- no problem. Give the message once (the backup-archive of scriptfile xy.tBasic already contains 100 stages of development". "OK" i move it somewhere or rename it and put it somewhere and if project done maybe i will delete it, maybe i only finished because i had plenty of backups. if not important to me, i will change settings maybe save once in 30 minutes or per hour.


Hi

If it can help about the memory consumption,
I monitored here thinAir (launched without admin privilege), It looks that memory usage grow with usage from around 20Mb (start) to 39Mb (some minutes later) then never cross beyond 40Mb. Memory seems released correctly after closing a tab.

If I understand correctly you think your problem is related with the theming ? Do you have the same problem with the default theme ?

About auto save, if evolution is made, can it be compatible with this ?
https://www.thinbasic.com/community/project.php?issueid=588

Edit: monitored in task manager, the thinAir integrated monitoring shows grater memory usage (about 45Mb), curious.

ErosOlmi
17-04-2020, 00:33
Renč,


copy/paste xml file in forum as code is not a good way to share because forum parser destroy it adding special chars. Better to attach xml file as zip file.
I've also added xml files as forum supported files so now it is possible to attach an xml file directly into posts


Anyway here attached a fixed xml version of your theme.
It seems working fine here.

10194

Please try on your system and let me know if it works so we can start from this point.

In a couple of days I will release thinBasic new version that has a lot of changes in thinAir process monitor mechanism and I hope some of your bad experiences will disappear.
I've never had all the GPF you had.
I also tested under Windows 7 with no error.

But this doesn't mean there are no problems.
I had some GPF on slow Windows 10 Hyper-V virtual machine at the very first thinAir execution: problem was caused because thinAir was using Web Browser control DOM document before the slow machine was able to load all web control dependencies like javascript engine but in new version I will release very soon I should have solved this issue testing web control loading status and waiting till DOM document is finally loaded.


Also consider theming is still under development so there will be some changes in next thinBasic release.
For example I will remove OPTIONS (settings that change thinAir behaves) from themes and I will left only UI aspects.
Options will be inside dedicated xml file and there will be a mechanism of user option override in such a way default thinAir options that come from installation can be modified by local user options.



Ciao
Eros

primo
17-04-2020, 09:07
can we add color to the textBox (ie vb6 style) like this vb6 example
Private Sub Form_Load()
Text1.ForeColor = RGB(255, 0, 0)
Text1.Text = "okay"
Text1.BackColor = RGB(0, 255, 0)
End Sub

also how to print text to the Form

here is the TextBox in thinBasic in vb6 style introduced in TB versions 1.11. ..., note that it is supporting Unicode

USES "UI"
'---Define a button and textBox ID
begin ControlID
%txtBox
%btnPush
end ControlID

dialog Font "Courier New", 14
DIALOG New Pixels , Name Form, 0, "tests",-1,-1, 640, 400,
%WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW
CONTROL ADD Textbox , Name txtBox , Form.Handle, %txtBox , "", 10, 30, 350, 350, %ES_AUTOHSCROLL | %WS_VSCROLL | %ES_AUTOVSCROLL | %ES_WANTRETURN | %ES_MULTILINE | %WS_TABSTOP ' | %ES_NUMBER
CONTROL ADD BUTTON , Name btnPush , Form.Handle, %btnPush , "Okay" , 480, 340, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP
control set Color Form.Handle , %txtBox, rgb(255,0,0), rgb(0,255,0)
DIALOG SHOW MODAL Form.Handle
'------------------------------------------------
CallBack Function Form_OnLoad() As Long
'------------------------------------------------
txtBox.Text = "visual basic 6" + $CRLF
'---Change name to Run me
btnPush.Text = "Run me"

End Function
'------------------------------------------------
' Function fired when button Run me is clicked
'------------------------------------------------
CallBack Function btnPush_OnClick() As Long
'------------------------------------------------
long i, total
string Txt
'txtBox.Color = rgb(0,100,0) 'doess not work
Txt = "まど を 閉じる。"

txtBox.Text = txtBox.Text + Txt + $CRLF
txtBox.Text = txtBox.Text + Peek$(strPtr(Txt), len(Txt)) + $CRLF
txtBox.Text = txtBox.Text + len(Txt) + $CRLF
End Function

ReneMiner
17-04-2020, 09:47
I am sure your joker to colorize a Control ist sendMessage. It's a Function from win32api, butits available AS many Others through thinBasic already. I don't know exactly the Syntax but IT IS not prefixed "Win_" AS Most of the other adopted Windows Functions. Get the win32.chm there in any Case AS Long its still available http://laurencejackson.com/win32/
Its Not a mistake to have a book about the engine that is driving your Scripts

Oops... Sorry i did Not read completely. But the Link ist useful. So i leave it AS ist now, Walking from the doctor Back Home and seems since i am sick since december already that i will also in the next weeks have some time to Code and test.while i am waiting for surgery.
@Eros; Just asking did you See my thread in the members-only-area about multihreading? I am pretty certain the language there ist fast and powerful enough to run thinBasic in 40 to 48 threads at the Same time. You should probably Check. Sadly Petr was Not Able to come online because He is the Kind of Guy who will get a Basic running example within minutes. And i would like to implement thinBasic into the visual Assembler that comes with Compiler and i think a dozen different dialects of ASM and it has the complete visual Designer including the controls that createtheirs Events procedures automatic instantly when sa Control ist placed in the Editor

DirectuX
17-04-2020, 10:34
Options will be inside dedicated xml file and there will be a mechanism of user option override in such a way default thinAir options that come from installation can be modified by local user options.


Something persistent through new tb release (like thinAir_Tools_Usr.ini ) ?

ErosOlmi
17-04-2020, 13:27
can we add color to the textBox (ie vb6 style) like this vb6 example
Private Sub Form_Load()
Text1.ForeColor = RGB(255, 0, 0)
Text1.Text = "okay"
Text1.BackColor = RGB(0, 255, 0)
End Sub


Yes sure, it is already developed. Add something like the following in Form_OnLoad function for example


txtBox.forecolor = rgb(255,0,0)
txtBox.backcolor = rgb(0,255,0)

.forecolor and .backcolor are also available in other controls I've already converted into VB style



also how to print text to the Form

Can you explain?

Ciao
Eros

ErosOlmi
17-04-2020, 13:32
@Eros; Just asking did you See my thread in the members-only-area about multihreading? I am pretty certain the language there ist fast and powerful enough to run thinBasic in 40 to 48 threads at the Same time. You should probably Check. Sadly Petr was Not Able to come online because He is the Kind of Guy who will get a Basic running example within minutes. And i would like to implement thinBasic into the visual Assembler that comes with Compiler and i think a dozen different dialects of ASM and it has the complete visual Designer including the controls that createtheirs Events procedures automatic instantly when sa Control ist placed in the Editor


Sorry, not. But I will, you ideas are always so clever to not have a look :)
I need to go in order and give priority to more basic things that give value to all using thinBAsic
Multithreading in script is one of the ideas I have for thinBasic 2.x version

Ciao
Eros

ReneMiner
17-04-2020, 14:13
yes there is still the other one in thinAir\config. But i think one of them is only a row of hex for colors. I always wanted to try but i had no time. just to have some dropdown combobox where the setting can be chosen (background, foreground etc). a small label for evey setting to display the currently selected color. font & color-settings are common controls - since idispatch they are also available without UI.


Yes i tried the theme- colors still same but less time to wait for thinAir to respond. I have a certain file ( wmi-classnames - check help WMI - i saved as plain text but named it "wmi_classes.inc" so i can load and prepare it that it fits the code. This - not even script since no keywords nor anything else, 940 lines of text 25 kB, seems to trigger thinAir to get stuck and not responsive for sometimes 5 or more minutes. Especially when i edit it to bring
it in shape of an INI-file. I bettter use notepad++ for the pure text-editing , even for replacing double quotes i will not click 1800 times onto replace because "replace all" is disabled in thinAir.

And with that i've found a bug. I have a file with 1000 lines of text. I load it via
PARSE FILE sFilename, sList(), CRLF to have it available. If i use
ARRAY SORT sList(1) ASCEND then there are always a few items messed up after sorting. Usually after
i load i sort descend to have empty lines at the upper bound to simply reduce count of lines and redim.
( no need for collate ucase nor asFiles settings to check. I think this bug is old already but i always forgot to mention it. Currently the theme-settings are pretty ok i need to run a few more scripts and to type a bit...)

primo
17-04-2020, 14:14
Thanks Eros
i mean by printing to the Form like this:
10195

Not a Label, but on the Form or say a Window which contains the TextBox and the Button, and here it is created with DIALOG New Pixels ...

ErosOlmi
17-04-2020, 14:30
Something persistent through new tb release (like thinAir_Tools_Usr.ini ) ?

Yes persistent.
I didn't had time to work on thinAir options because I focused my development on other aspects so you are all suffering of not working thinAir option.
And I thank you very much to be here to test and report.

The idea is to have:

a default set of options coming from thinBasic setup that will be always overwritten during next installs.
a user file created by users when some options are changed. Successive thinBasic install will never overwrite user file


I need to close current development phase and then I will work on this

ReneMiner
18-04-2020, 07:33
Eros, sadly the crashing issue still not solved completely.
But it does not save anything in case it crashes.
When I restart it opens again as the previous session - before the crash- started. If saving files before script execution then thinAir should also secure the thinAir-settings as soon the last new file has a name that thinAir can add to recent file
Or is there a setting or directive for the process-window to dump


#process DumpMemory2HD "directory", {Interval|Manual|ByCmd}[,<seconds between saves>|<%VK-equates>]

directory - by default could be a subfolder of thinbasic-folder or the user can override by setting here
interval - is to save invoked by a timer every "few seconds" as the last parameter tells the seconds
manual - let me push a key to save manual, overrule default keys in last parameter
bycmd - in the script are certain comment-lines '[dump] (similar to '[breakpoint] ) that will cause automatic save. Perhaps add line-number of the '[dump] to the filename or allow a quoted string for special filenames or path. i gues if something like '[dumpmemory] it will not need a directive/preparsing statement but we have no direct influence compared to directive+manual dump.

Did you check your PM? I hope so before you dump that too...

Petr Schreiber
18-04-2020, 07:35
@Rene - you are very kind, but I am currently overloaded (still getting used to control myself when working home in "corona mode") and cannot dedicate time to new investigation at the moment.

I have experience with data paralelism (OpenCL), but I am not very confident in "classic" multithreading. Study of Rust and its mechanisms showed me it takes more than "spawn a thread" to bring a quality multithreading implementation in a language. Not speaking of impact on ThinBASIC SDK.

It is interesting topic, but as Eros says, maybe better to reopen this topic when preparing ThinBASIC 2.x. Thank you for understanding and thank you for your time preparing the post for us.

@Rene - could you please share the file with 1000 lines, so we can replicate the sorting issue, along with expectation of result? It would help us understand where the issue is.


Petr

DirectuX
18-04-2020, 20:32
Eros, I don't know if it would be long to fix, but while working on thinAir, could you get rid of this thinAir's Type error (https://www.thinbasic.com/community/project.php?issueid=560) please, it's not much but annoying.

ReneMiner
19-04-2020, 03:15
Eros, I don't know if it would be long to fix, but while working on thinAir, could you get rid of this thinAir's Type error (https://www.thinbasic.com/community/project.php?issueid=560) please, it's not much but annoying.

Try Setting at thinair\Window\Options

ReneMiner
19-04-2020, 09:47
Am experiencing crashes still. But: if there is a bug that is found previous execution started (missing EndIf or End Function instead of End Sub etc. it does not crash. It was like that before i changed the theme. It now does not even crash while the execution hits an undeclared variable or misses some expected variable (because optional parameters and no parenthesis.) Those bugs get noted and saved but thinAir will not jump to the correct line and show the token that caused the problem. If crashes the way that thinAir simply disappears there are no error-logs. So i still have a few from the last days that will tell what not leads to final crash of thinAir.
The first are a few days old when i had way more crashes on exit of a script, but they say "this cause for a crash can not be the reason." I remember days sometimes thinAir even vanished without an error-message before the crash when script execution had finished.


[Script]
Main=E:\thinBasic\Eigene_Scripts\TextBox.tBasic
Include=
[RunTimeError]
DateTime=09/04/2020 12:02:35
Code=30
Description=Variable not defined or misspelled Keyword
Line=241
LineCode=CONTROL SET TEXT HDLG, %ID_TEXTBOX5, LOAD_FILE(APP_SOURCENAME)
Token=HDLG
Additional=
------------------------------------------------------------------------------------------------
[Script]
Main=E:\thinBasic\UserScripts\NewUI\sortText.tbasic
Include=
[RunTimeError]
DateTime=15/04/2020 00:08:41
Code=32
Description=IF without END IF
Line=460
LineCode=END SELECT
Token=SELECT
Additional=
------------------------------------------------------------------------------------------------

[Script]
Main=E:\thinBasic\UserScripts\NewUI\wminfo.tbasic
Include=
[RunTimeError]
DateTime=19/04/2020 06:09:25
Code=400
Description=Subscript out of range in array or matrix
Line=136
LineCode=SGROUP(I) = HEAP_GET(PGROUP)
Token=I
Additional=Dimension 1 should be between 1 and 0. Current value: 1


------------------------------------------------------------------------------------------------
[Script]
Main=E:\thinBasic\Eigene_Scripts\htm_Viewer.tBasic
Include=
[RunTimeError]
DateTime=19/04/2020 07:23:32
Code=30
Description=Variable not defined or misspelled Keyword
Line=215
LineCode=INI_SETKEY(APP_INIFILE, "History","LastDoc", SDOC)
Token=SDOC
Additional=




and please look up the picture on my previous post. Pretty. All readable.
Could you do this too for thinBundle-window so i can read what i am up to do there?
And did bundle not have an option to include other files (databases, images, even zip-folders?) I can not find it. is it the unreadability or was it removed?

DirectuX
19-04-2020, 10:46
Try Setting at thinair\Window\Options

Thanks Rene.
However, it isn't that : it concern the right click on TAB \ indent code function. Petr is investigating.

DirectuX
19-04-2020, 10:47
And did bundle not have an option to include other files (databases, images, even zip-folders?) I can not find it. is it the unreadability or was it removed?

https://www.thinbasic.com/public/products/thinBasic/help/html/bundle_file.htm

DirectuX
19-04-2020, 13:11
Hi, just a feedback upon autocomplete feature :



Type MyPropertiesDefinition

userName as String

function _Create
me.userName = "Guest" ' autocomplete works (.userName)
end Function

end Type

dim myTestVar as MyPropertiesDefinition ' autocomplete works (MyPropertiesDefinition)

Reset myTe ' autocomplete does not work (myTestVar)




dim myFilename as String

myFilename = "Document.txt"

MsgBox 0, myF ' autocomplete does not work (myFilename)



is Dim keyword autocompletion different of Type to manage ?
Maybe a lead : in notepad++, that uses scintilla, there is such functionality : you type a word with 3 or more characters , then it is automatically added to the suggestion list for further use.

ErosOlmi
19-04-2020, 13:45
thinBasic 1.11.6.0 BETA TESTING update 2020/04/19

DOWNLOAD URL: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.11.6.0.zip

Added F12 or View/Maximize Edit menu to remove almost all thinAir distractions and remain focused on code editing
Removed unnecessary tabs in output window, now only process monitor and runtime errors are there. Next will come when ready
Fixed some theming problems
Improved process monitor stability giving time to web browser control to load all its dependencies (DOM engine, javascript engine, ...) before using it.
Petr documented WCon module
Petr new calltips for TBGL
fixed bug in TBGL which could cause crash in case of window dragging.
beautified runtime error reporting and process monitoring
button to minimize / maximize panel with Process / Runtime error
insert code block did not respect cursor position
unnecessary tabs removed, kept just Process / Runtime error
unnecessary redraws of UI
stability issues in thinAir
Other minor changes

https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_6_0.htm (https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?2020___version_history.htm)

ErosOlmi
19-04-2020, 13:49
Hi, just a feedback upon autocomplete feature :



Type MyPropertiesDefinition

userName as String

function _Create
me.userName = "Guest" ' autocomplete works (.userName)
end Function

end Type

dim myTestVar as MyPropertiesDefinition ' autocomplete works (MyPropertiesDefinition)

Reset myTe ' autocomplete does not work (myTestVar)




dim myFilename as String

myFilename = "Document.txt"

MsgBox 0, myF ' autocomplete does not work (myFilename)



is Dim keyword autocompletion different of Type to manage ?
Maybe a lead : in notepad++, that uses scintilla, there is such functionality : you type a word with 3 or more characters , then it is automatically added to the suggestion list for further use.

Actually thinAir is not scanning source code for COMPETE variable declarations and not all variables are inserted into autocompletion list.
But we will work on that, I want our thinAir experience as great as possible.

DirectuX
19-04-2020, 15:04
Actually thinAir is not scanning source code for COMPETE variable declarations and not all variables are inserted into autocompletion list.
But we will work on that, I want our thinAir experience as great as possible.

Thanks Eros,

Note in 1.11.6.0 : thinAir_ProcessMonitor.dll triggered Comodo AV as 'generic' , (I already reported as false alert.)

DirectuX
19-04-2020, 15:08
F12 and output windows is nice in this version !

On 2020/03/23 :

During programming, having too many Call Tips on the screen can be disturbing. For this reason, the "showlevel" attribute has been added to the "key" node within the "\ thinBasic \ Lib \ ThinAir \ Syntax \ thinBasic \ thinBasic_CallTips * .xml" files. This new attribute can have a value from 1 to 9 where 1 indicates the maximum importance level while 9 indicates the minimum importance level.



In this way, each user can set the level of importance of Call Tip he wants to work by hiding or showing the most appropriate level according to his needs



<Key Name = "Dim" showlevel = "3"></Key>

Where can the level be set in thinAir ?

ErosOlmi
19-04-2020, 15:29
Thanks Eros,

Note in 1.11.6.0 : thinAir_ProcessMonitor.dll triggered Comodo AV as 'generic' , (I already reported as false alert.)
Thanks a lot

DirectuX
19-04-2020, 15:34
Also,

in thinAir, in the code panel,
right click / "Editor syntax colors"

Does it do something or is it to remove ?

ErosOlmi
19-04-2020, 15:36
Nothing ... or weird :)
I will finish few items I was working on and then will work on thinAir options

DirectuX
19-04-2020, 16:05
Nothing ... or weird :)
I will finish few items I was working on and then will work on thinAir options

I understand that https://www.thinbasic.com/community/showthread.php?12949-thinBasic-1-11-x-x&p=95625&viewfull=1#post95625 is not implemented ? (it's ok)

about thinBasic_CallTips_Module... .xml , are they manually written or do you generates them from the help file ?

That's because I was looking for the possibility to add such definitions (sort of in-context)


<Key name = "ARRAY" showlevel = "5">
<Description>Array functions.</Description>
<Syntax><![CDATA[
ARRAY { EXTRACT | ASSIGN | FILL | SCAN | SHIFT | SHUFFLE | SORT | SUM | UNIQUE }
]]>
</Syntax>
<Parameters><![CDATA[
]]>
</Parameters>
<ReturnValue><![CDATA[
]]>
</ReturnValue>
<Remarks><![CDATA[]]></Remarks>
<Example><![CDATA[
]]>
</Example>
</Key>


and it works.

Same for
#DEFAULT { BOUNDCHECK | DECLARE | PARAMETERS }
COMBOBOX { DELETE | GET | RESET | SELECT }
COMBOBOX GET { SELECTED | TEXT }
CONTROL { ADD | APPEND | APPENDTOTOP | DISABLE | ENABLE | GET | HANDLE | KILL | POST | REDRAW | SEND | SET | SHOW | UNTHEME }
CONTROL GET { CHECK | CLIENT | LOC | SIZE | TEXT | USER }
CONTROL SET { CHECK | CLIENT | COLOR | FOCUS | LOC | OPTION | RESIZE | SIZE | TEXT | USER }
ITERATE { FOR | WHILE | DO }
USES { "CONSOLE" | "FILE" | "OS" | "MATH" }
(...)

DirectuX
19-04-2020, 17:53
Runtime error doesn't display line number correctly :

10198

It reminds me of this issue (code browser suggestion) : https://www.thinbasic.com/community/project.php?issueid=583

DirectuX
19-04-2020, 18:37
I don't know if it matters, but in the Process panel and Runtime Error panel 's html code source, there are mixed slash and backslash in paths strings, and sometimes even both at the same place " \/ " for the Runtime Error panel.


href="O:\thinBasic\thinAir\/ProcessMonitor/html/libs/uikit-2.27.5/css/uikit.almost-flat.min.css"

Petr Schreiber
19-04-2020, 19:32
Hi DirectuX,

thank you for reporting the #include line error & the mixed slashes. We will have a look :drink:


Petr

DirectuX
20-04-2020, 16:09
In the example below, the code browser doesn't display the include. Can't find why. The file exists. In the code panel, right click + open file opens the file.

10199

Petr Schreiber
20-04-2020, 18:40
Hi DirectuX,

if you can share the file, it would be perfect, but yes - I can get codebrowser to ignore #includes. Will have a look, thank you for reporting.


Petr

DirectuX
20-04-2020, 19:33
Hi DirectuX,

if you can share the file, it would be perfect, but yes - I can get codebrowser to ignore #includes. Will have a look, thank you for reporting.


Petr

Hi Petr,

this is TestFile1.tbasic from here : https://github.com/DirectuX/thinternational/tree/master/sample

DirectuX
22-04-2020, 11:38
Note in 1.11.6.0 : thinBasic_iNet.dll triggered Comodo AV as 'Heur.Packed' , (I already reported as false alert.)

ReneMiner
22-04-2020, 13:47
Hi, it's me- as usual.

I have not so good - good news. Am a bit grrr... i code an type for more than 3 hours this morning. I did since thinAir launched on new installed windows 10 not run the script yet. I was typing something where i needed to know a few things (thinAir\config\thinAir.ini + some theme i had opened in notepad++ to check for tokens etc. Then i wanted to open one of my scripts from HD because there i had already some functions that i wanted to copy into the current script.

So ii had again to go to thinAir-menu windows\options to set "Show only current items" to false because it
always resets itself to true, means it will not show any files in filebrowser that are not opened. In that case the filebrowser is pretty much useless and could be completely turned off. If it will not show scripts that are not open currently - it makes no sense to have a filebrowser. Whatever i clicked onto notepad++ to have it in front- it said something that a file (thinair.ini) had changed content- if i like to reload it, i click yes and thinAir in the background - poof- gone. And i typed maybe 3 hours. All gone. No save, nothing. why still no automatic timer-driven autosave at least for scripts that are dirty. Even if no name - it could make a backup named after date and the templates for new files could automatic give it different default-names as "untitled consolescript.4.15-2020.04.22.tBackup" seconds are not needed. We can still check for the file attributes. Only that it's possible to save more than once a day, even more than once per hour. By default 10 to 15 minutes... Or think about notepad++ approach- it backs every file up- if i change something and close notepad without saving- the next time i open it are still all changes there.
I don't care how it names the files but i always find a copy even not just if crash but also if i want to go back to an earlier stage of the script...

And another question. I want to create like a PlugIn - a toolwindow that should be like a snap-in possible to lock at thinAir to add another Tab next to codebrowser and explorer,
Is it possible with the current version to create popups in the thinAir_tools_usr.ini to group tools or to seperate multiple orders and settings and can they be checkable?

And one more: The tooltips (codetips) are not what is called a "control" so they do not have a windows-handle? Could thinAir optional send the codetip-content to an external process and not display the tooltips then? Very often i want to click a position of the script - but all of a sudden a code-tip appears and then opens helpfile...
But how to get in contact after thinAir has started it will not load any files but it could Log its process-id and a function-pointer that my file can read from hd then and then pass a pointer to some buffer or i could instanly pass a textbox-handle +dialog-handle. Also i miss a bit that if i type like "Array(keyword+space)" that it would suggest Sum Scan Shuffle etc. I think it appears while am typing only for functions of the current script. And for that : if the headline starts with Sub where is () at the end - no parameters - its of no help to display a codetip with the word "Syntax" only.


Sorry. Am typing too much already... See you

DirectuX
22-04-2020, 17:18
While checking changes related to thinternational (https://www.thinbasic.com/community/project.php?issueid=622) regarding the lasts tb alpha version,
I can report this :

10200

Unicode chars that display well in the code windows, is badly displayed in the Runtime Error panel.

A question : what's "constat equate" ?

A 2nd question : In this case, what's the sense of "Token found End of line" ?

ErosOlmi
22-04-2020, 20:48
Hi, it's me- as usual.

I have not so good - good news. Am a bit grrr... i code an type for more than 3 hours this morning. I did since thinAir launched on new installed windows 10 not run the script yet. I was typing something where i needed to know a few things (thinAir\config\thinAir.ini + some theme i had opened in notepad++ to check for tokens etc. Then i wanted to open one of my scripts from HD because there i had already some functions that i wanted to copy into the current script.

So ii had again to go to thinAir-menu windows\options to set "Show only current items" to false because it
always resets itself to true, means it will not show any files in filebrowser that are not opened. In that case the filebrowser is pretty much useless and could be completely turned off. If it will not show scripts that are not open currently - it makes no sense to have a filebrowser. Whatever i clicked onto notepad++ to have it in front- it said something that a file (thinair.ini) had changed content- if i like to reload it, i click yes and thinAir in the background - poof- gone. And i typed maybe 3 hours. All gone. No save, nothing. why still no automatic timer-driven autosave at least for scripts that are dirty. Even if no name - it could make a backup named after date and the templates for new files could automatic give it different default-names as "untitled consolescript.4.15-2020.04.22.tBackup" seconds are not needed. We can still check for the file attributes. Only that it's possible to save more than once a day, even more than once per hour. By default 10 to 15 minutes... Or think about notepad++ approach- it backs every file up- if i change something and close notepad without saving- the next time i open it are still all changes there.
I don't care how it names the files but i always find a copy even not just if crash but also if i want to go back to an earlier stage of the script...

And another question. I want to create like a PlugIn - a toolwindow that should be like a snap-in possible to lock at thinAir to add another Tab next to codebrowser and explorer,
Is it possible with the current version to create popups in the thinAir_tools_usr.ini to group tools or to seperate multiple orders and settings and can they be checkable?

And one more: The tooltips (codetips) are not what is called a "control" so they do not have a windows-handle? Could thinAir optional send the codetip-content to an external process and not display the tooltips then? Very often i want to click a position of the script - but all of a sudden a code-tip appears and then opens helpfile...
But how to get in contact after thinAir has started it will not load any files but it could Log its process-id and a function-pointer that my file can read from hd then and then pass a pointer to some buffer or i could instanly pass a textbox-handle +dialog-handle. Also i miss a bit that if i type like "Array(keyword+space)" that it would suggest Sum Scan Shuffle etc. I think it appears while am typing only for functions of the current script. And for that : if the headline starts with Sub where is () at the end - no parameters - its of no help to display a codetip with the word "Syntax" only.


Sorry. Am typing too much already... See you

Ciao Renč,

thinAir options are not working in this alpha/beta version or they are not working as expected.
They are still related to a thinAir version that is not anymore with us.
As I said in other posts, I will finish some few development phase and then I will work on thinAir options in order to reflects the many new features we added recently.
I think that if you need more stability, it is better to install a thinBasic version prior to 1.11.x

Regarding plug-ins in thinAir ... it is something on the list of the features I want to have.
So ... something to work this year and now that I'm collaborating with Petr in developing thinAir ... maybe it will be more close to reality.

CallTips (as they are called in Scintilla control) window is not something under my control.
Of course I can send them into another window both uniquely or in parallel but at the moment I want to concentrate to have it enough good

Ciao
Eros

ErosOlmi
22-04-2020, 20:53
While checking changes related to thinternational (https://www.thinbasic.com/community/project.php?issueid=622) regarding the lasts tb alpha version,
I can report this :

10200

Unicode chars that display well in the code windows, is badly displayed in the Runtime Error panel.

A question : what's "constat equate" ?

A 2nd question : In this case, what's the sense of "Token found End of line" ?

Oops, I forgot to add <meta charset="utf-8"/> statement in all .html template files so browser is not interpreting utf-8 output file correctly.
I will amend in next version.

Regarding "constat" is an error: constant

Regarding "token found" it depends on where the parsing pointer is located when runtime error occurs.
In some situation where I need to parse ahead in order to understand if statement is finished or not ... it can be in an incorrect location.

DirectuX
22-04-2020, 22:43
Thanks for the explanations !

DirectuX
24-04-2020, 07:29
10201

Maybe tooltip for types can show :
User defined type : instead of "Parameters :"
variables with variables types (as ...)
and not show "return value :" ?

primo
24-04-2020, 09:29
thinBasic 1.11.6.0 BETA TESTING

the hiding of a control may be broken, does not work
txtBox.Hide ' to hide
txtBox.Normalize ' to unHide
also
txtBox.ForeColor = rgb(255,0,0)
txtBox.backColor = rgb(0,255,0)
does not work as expected if they are used in this order or in this order
txtBox.backColor = rgb(0,255,0)
txtBox.ForeColor = rgb(255,0,0)

USES "UI"
'---Define a button and textBox ID
begin ControlID
%txtBox
%btnPush
end ControlID

dialog Font "Courier New", 14
DIALOG New Pixels , Name Form, 0, "tests",-1,-1, 640, 400,
%WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW
CONTROL ADD Textbox , Name txtBox , Form.Handle, %txtBox , "", 10, 30, 350, 350, %ES_AUTOHSCROLL | %WS_VSCROLL | %ES_AUTOVSCROLL | %ES_WANTRETURN | %ES_MULTILINE | %WS_TABSTOP ' | %ES_NUMBER
CONTROL ADD BUTTON , Name btnPush , Form.Handle, %btnPush , "Okay" , 400, 340, 200, 35, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP
control set Color Form.Handle , %txtBox, rgb(255,0,0), rgb(0,255,0)
DIALOG SHOW MODAL Form.Handle
'------------------------------------------------
CallBack Function Form_OnLoad() As Long
'------------------------------------------------
txtBox.ForeColor = rgb(255,0,0)
txtBox.backColor = rgb(0,255,0)
txtBox.Text = "OK" + $CRLF
'---Change name to Run me
btnPush.Text = "Hide the TextBox"

End Function
'------------------------------------------------
' Function fired when button is clicked
'------------------------------------------------
CallBack Function btnPush_OnClick() As Long
txtBox.Hide
'Control Hide Form.Handle, %txtBox ' output error
'txtBox.Normalize ' to UnHide the control
End Function

DirectuX
24-04-2020, 14:41
As developpment is focused on thinAir, i would like to highlight that this issue is still relevant for v1.11.60 : https://www.thinbasic.com/community/project.php?issueid=613 and add to the info that now with freebasic bundled, it is doubled.

DirectuX
24-04-2020, 18:47
Hi Primo,

where did you find the hide method for the textbox ?

primo
25-04-2020, 08:17
Hi DirectuX
it pops up when we write txtBox.hi like this
10202
i remember using this feature in VB6 in which we can hide any control, it is a fun feature
it is also in powerbasic functions
https://forum.powerbasic.com/forum/announcements-articles-and-support-faqs/pbwin-online-help-and-commentary/56973-control-hide-statement
CONTROL HIDE HDlg, ID&
Normalize is not yet added to the tips in thinbasic but it is accepted

the "Hide" is available for any control including Buttons.

ReneMiner
25-04-2020, 08:19
just for a Trackbar- maybe add in support-section, using any style causes the trackbar to stay invisible

for all dialogs & controls if added:

i think itis still possible to create indexed dialogs & controls but : same name must be same type of dialog or same type of control. I dont know but i think if you make "INDEX" a keyword it will break thousands of old scripts that use "Index" as a variable- but maybe there is another expression that could be used maybe "Indicator" that means its an Index-Expression of a Dialog or Control. Or you could call it "UI_Index"

If such an index is used alike
Control Add Button Name Superbutton(20), hDlg, %IDSuper20, "Click me",...
means to create this superbutton number 20 only.

it can not be to create this after creating another control named "superbutton" without an index and no other control with that same name can be created without an index. Also all named as "Superbutton" must be identical controls except the position, caption, image , check-state etc. and all must be 1-dimensional indexed.
It should be possible as well to create grids so to say 2D-Indexed

Control Add Textbox Name myCell(1,1), hDlg, %ID_Cell_1_1,...

I dont know where you will store "Indicators" but if you would find a few bytes to store this "indicators" then for the callback. The user has to write a cb-Function for an indexed control alike

Callback Function Superbutton.OnClick(ByVal Index As Long) As Long

so if used "Index" by the User here its just a local variable only he could write whatever he likes, mainly the callback needs a slot to put that value for the user to be available.
for 2D-indication , means

Callback Function myCell.OnClick(Byval Column As Long, Byval Row As Long) as Long
is the same as
Callback Function myCell.OnClick(Byval X As Long, Byval Y As Long) as Long
- if a controls name with 2D-Index has been created , the user must provide the correct number to receive them in callback and their order must be same as between parenthesis

If its just more than 2 dimensions will need more than the space of a quad to store the indexes except the range would get cut down to
1 dimension = range of 16 bytes (quad- but i think long is ok since the callbacks should use these as a parameter uniform)
2 dimensions = 2 * range of 8 bytes(long)

3 + 4 dimensions 4 * range of 4 bytes (integer)
but imo the User could make it from 2D to 4D himself using HI and LO- functions. UI mostly is a 2d-environment so its ok if provides 1D- & 2D-indications only

The content of the Index does not matter. Its not required to be in a continous row. Its up to the user. Only for the same name every index is available once. There can not be more than 1 object with same name and same indication.
He should be able to assign any numeric value in range of Long as an index to enable using the index instantly in a callback-

For example if the user creates a mediaplayer, he might have a play-button, a record-button and 4 (or more) position-buttons to select the position within the current song. LikeForward, FastForward,Backward and FastBackward and he can declare
%FWD = 1
%FFWD = 10
%BWD = -1
%FBWD = -10
Control Add Button Name ChangePos(%FWD)...
Control Add Button Name ChangePos(%FFWD)...
Control Add Button Name ChangePos(%BWD)...
Control Add Button Name ChangePos(%FBWD)...
then use the callback
Callback Function ChangePos.OnClick(Byval Amount As Long) As Long
' to make it short:
mySong.PositionChange(Amount)

Thats all. The rules, 16 Bytes (a Quad) for indicators per control or dialog, another internal bit or byte somewhere to know how many dimensions the quad contains and the callback must call_ifExist as currently, but pass the indicators additionally.

Alternative way
You could as well create a bunch of pseudo-variables alike CBHNDL, CBCTLMSG etc.
for diaogs
CBDLGINDEX Alias CBDLGINDEX ' for the one in CBHNDL
CBDLGINDEX2 - if 2D- but i think rarely used for dialogs, maybe mdi-childs...
and for controls
CBCTLINDEX Alias CBCTLINDEX1
CBCTLINDEX2
which will avoid errors that could be caused by wrong usage when the slots to receive the indicators are incorrect in count or vartype. That will happen once --- to every user. But it would encrypt the function for users that have become friends of the new, better readability of named controls & dialogs



i like the thought intend to finally create a dialog as


Begin Dialog MainWindow, hParent, sCaption, X, Y, W, H, Style, ExStyle

Apply Button BtnExit, "Exit", X,Y, W, H, Style, ExStyle
' "Apply" new keyword in Begin Dialog-End Dialog frame to substitute Control Add
' because parent etc. is obvious & names are mandatory here

for long i = 1 to 10
Apply Button BtnSelectRecent(i), sRecent$(i), 5, 5 + i * 25, 100, 20, style
next
Apply Viewport vptRightMain, "~unused but acceptable~", 110, 5, This.CW -115, This.CH-10
' "This" can be used for the object that is mentioned after "Begin Dialog" as "ME" in functions
' it would be created already in the first line and before applies any controls it would know client size
' the line after Begin Dialog could already be This.SetMinsize(..,..)
End Dialog
Dialog Show Modeless Mainwindow.handle
Repeat
DoEvents
Until Not IsWindow(MainWindow.handle)
'...
CallBack Function MainWindow.OnInit()

Begin Dialog insideRightMainVpt, vptRightMain.handle, "", 0, 0, vptRightMain.GetClientWidth, vptRightMain.GetClientHeight, %WS_CHILD
'...

DirectuX
26-04-2020, 17:15
Hi DirectuX
it pops up when we write txtBox.hi like this
10202
i remember using this feature in VB6 in which we can hide any control, it is a fun feature
it is also in powerbasic functions
https://forum.powerbasic.com/forum/announcements-articles-and-support-faqs/pbwin-online-help-and-commentary/56973-control-hide-statement
CONTROL HIDE HDlg, ID&
Normalize is not yet added to the tips in thinbasic but it is accepted

the "Hide" is available for any control including Buttons.

Eros will tell, but the popup is not context aware , try it by yourself you get the ".hide" suggestion for anything you type, plus hide is not referenced in the TB's help file.

ReneMiner
26-04-2020, 20:28
...is not referenced in the TB's help file.

:D :D :D
There are dozens undocumented functions- since maybe... Ages... Try Uses "File", Disk_Free("C:") or Disk_Size(app_path) or Tell me someone what is Try and Catch? Really i don't know how these work..

Eros, you know what is meant when i say thinBasic.CreateSyntax.AllModules.inc
There are few - obviously going to be deprecated or maybe replaced by new stuff. Ist IT only the commented ones or also the 4 below that you are still thinking If or If Not.
I think the commented ones ist absolutely correct decision. Never anyone asked to play online in TB-forum and Excel has changed a Lot since the Module was published.Also Fileline is Not reallIy needed. I can reproduce all Functions of it using core only. Just to mention Parse File or Load_File, Save_File. Anyway its better If calculation ist done in memory instead to write and overwrite and overwrite.
I would also suggest to completely Alias LL-module with LList- so this has made It from being a Module into the heart of core - its the best that can happen to a library - finally fully implemented. If you replace the LL-module-file with some dummyfile or some that contains a few Functions to Test before they will get implemented to core, IT should be No Problem. As Long all LL-Functions are covered by Alias LList . Also the LL could handle few things that give their Name a meaning. It could for example Link User-Data in memory with a Listview or treeview Control. A Listview currently only can be filled wth a 2d-matrix - thats an Array(x,y) but means all Elements must BE same and filled to the array to upfate all cells. If we had a straight udt-array and want to list certain subelements in a certain column of the Listview then IT needs the linked list - best If we're a class that can invoke its own callback using a Timer to stay "Up-to-data". If using udt_elementOffset and let IT link a column then IT still must know how much data in what shape or AS which subtype of the ist. Udt_Elementoffset can not Transfer the information easily and it causes to write many many ines of Code. If the linked list would understand thats ist duty to check repeatedly the subelements of an array to update row by row . And probably IT would be nice to LL_LinkUdt2Listview(hDlg, %ID_lvw, myudt(Startindex) using.Keyword, .Module, .Group, .Returns, .Syntax,.Parameter(1),. Parameter (2),. Parameter (3),. Parameter (4)...
So the LList will regularily update these subelements of myUdt. So it should store Type of and which subelements in memory. The order how i place the subelements ist the one to be used for the Listview or grid. IT can be - IT will dir Sure bei, that Not all of the udts subelements should be displayed that into the columns. And IT might depend If 5 or 25 columns to fill the list might make a difference and If the User would every Seconds have to wait for the PC to respond again... better transfer 50 values and let the system do Events until the next timer-up- event. Then Transfer again and If all the way down start in top again.Or might IT be faster to Monitor the udt for Changes- let it constantly compare a stored Copy ... and there is certainly more possible If linked list have learned to keep constantly a connection.
And what i discovered- , moduleTokenExporter has probably a Bug - or its the sorting-bug. Finally all end Up in "moduleTokens.ini" where is 1 row of Keywords for each Module. To See, scroll very far right, for example to the end of GDI+ Module, and its in a few more places the class attached to the previous udt means somewhere ist Missing that delimiting comma. Guess at Front when classes are exported should be a comma. to place comma at the end of listed types makes Not much Sense since its Not that many classes. But If you look and Check cDateTime is a core-class. How did IT get in there? And multiple times...i expect Array sort to Start with Element(1) If i do Not specify. But If i do Not specify Startindex IT will create some data-mess-up, some items get additional cryptic chars, some disappear and some jump around anywhere in memory and Mix with other Data. Either say :Error, Startindex required or let IT Default sort all the Array.

DirectuX
26-04-2020, 21:35
Feedback:
Type variables autocomplete fail in this case:


Type tXY
x as DWord
y as DWord
End Type

Dim myVar as tXY

myVar.x = 1 ' autosuggestion of x works
myVar.y=myVar.x ' autosuggestion of x does not work because of lack of space


Also as idea, can we improve the 'auto indent' feature to some code beautifier ? → add spaces where forgotten, remove useless white spaces, format comments, add/remove empty lines, ...

Petr Schreiber
26-04-2020, 22:11
Thanks everyone a lot for reporting the issues, we are looking into it :)

@Rene - if I may. I value very much your feedback, but I would appreciate if you could report each issue/idea separately.

If you do it like DirectuX - one issue per post, it is perfectly clear, the best would be to open issue in the Bug tracking/Project support section and then post here just links to the issues.
You are great issue detector, Rene, but it is a bit hard for us to parse huge paragraphs. Keeping stuff structured would help & raises the chance we don't miss your idea in a huge sea of words. Thanks a lot :drink:

@DirectuX - thanks again for the reports, the demonstration how to reproduce is very useful.

Having code formatter would be fantastic - we had it 10+ years ago, but then it got unmaintained. I am sure this great tool will re-emerge one day.


Petr

DirectuX
26-04-2020, 23:03
Runtime error panel feedback

When an error is detected, one can not access the values of others variable, it could be handy to inspect variables values.

DirectuX
26-04-2020, 23:23
Runtime error panel feedback #2

Panel content is not cleared in some case :

Steps :

1 - Run a script by 'F8'
2 - Stop it → there is a message in the panel
3 - Run again the script (F5) → the panel still show the error message

DirectuX
26-04-2020, 23:37
in v1.11.6.0 thinDebug's RUN button seems not working any more. F5 neither. F6 still do.

DirectuX
27-04-2020, 08:20
Hi everybody,


Currently, clicking on a tooltip will open the help file. Here I already mis-clicked a few times. Plus there's no cancel while help is loading.

I feel that annoying, there's already the F1 key for that. I would prefer to disable this feature.


What do you think about that ?

primo
27-04-2020, 14:40
DirectuX, where is the toolTip ? i don't find but calltips from the Window->options
my 1.11.6.0 in windows XP looks like this:
10203
there is no these buttons including (F5) but i understand this since it is using the (Modern) windows facilities GDI+++ and related.
in the Default.theme file there is only callTip

DirectuX
27-04-2020, 15:42
DirectuX, where is the toolTip ? i don't find but calltips from the Window->options
my 1.11.6.0 in windows XP looks like this:
10203
there is no these buttons including (F5) but i understand this since it is using the (Modern) windows facilities GDI+++ and related.
in the Default.theme file there is only callTip

Hi Primo,

by default in thinBasic v1.11.6.0 Alpha, if you let your mouse cursor on a keyword, it shows you a description plus a hint about the syntax. Further, if you click on this description , it opens the help file. (look at 2020/03/22 here : https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_6_0.htm

On your screenshot I can't see the toolbar normally present between the menu and the tabs. Nota bene : The F5 I talked in my previous post is about thinDebug.

primo
27-04-2020, 16:34
yes it works (clicking on description will open the help file.)
i prefer using F1 to call help.
regarding the toolbar, yes it does not appear (for tb 1.11.6.0) in windows XP. it only appears in windows 7 and above. but i don't complain .

ReneMiner
29-04-2020, 06:31
We have those annotations hat are meant
- for thinAir to display them in the codetree as notes
or
- for thindebug to temporary stop execution.

these for example:



'[]
'[!]
'
'[breakpoint]
'...etc.


i would like to add another one that will not just prevent the with thinBasic-installation shipped examples from being ruined by experiments while users study.



'[Filename] "thisIstheName.tBasicU"


and if thinAir finds this line it will suggest this
'[filename] "<defaultname>" if the file was not saved yet.
Only filename without a path. thinAir should know what path to use for new files. If the user enters another name thinAir could instantly - and only once after saving with another name correct that annotation and replace it with the in reality used name. (the saved script still has the previous annotation then)

It could be to have such line [B]added in every script-template according to type of template when we create a new script.


'[Filename] "consoleScript_" & OS_GETUSERNAME & "_" & DATE$ & ".tBasicC"
or
'[Filename] "DialogWithButton_" & OS_GETUSERNAME & "_" & DATE$ & ".tBasic"

And it makes sense to add a timer to thinAir that the user can configure within thinAir-settings (timer should not keep running during script-execution) that will invoke Autosave every x minutes. Then it does not need to ask a filename and we know from the name
"Autosave_DialogWithButton..." what is that on the harddrive. ThinAir should have its own "Autosave"-folder and could even offer to return to a previous stage of the script if same filename is available there. But do not return to previous stage without to backup the current.

And on the problem in reality - if user loads one of the script samples that are shipped with thinBasic-installation and experiment and try some different settings or parameters - it currently automatically overwrites the shipped sample - so we do not have them in original condition if we want to look for something how to do.

If all the shipped samples have the line '[filename] "<valid filename expression>" like


'[filename]*"Listview_with_Checkboxes_Test.tBasic"

'but the real scripts filenames in the shipped package STAY AS IS currently)
'"Listview_with_Checkboxes.tBasic"

then thinAir would not overwrite the example but create a new file when testing an example. (It's a few-line function only to insert this line to every sample script.
I attached it already as download to insert into all shipped samples some additional line or lines. "But i took the ammunition out of the gun" - the hot
lines are commented and camouflaged but it runs simulation to show what it would do.

And to save on the question "overwrite the existing file" either add a setting to configure thinAir behaviour {and|or} add a switch to the filename-line that will give thinAir explicite permission to overwrite the existing script without to ask.( User might try out the example multiple times and exchange some parameters.) Especially new Users should focus on study - not to be annoyed an disturbed while learning new things and to have impression of a smart environment that supports him.
If thinAir finds permisson to overwrite it would not ask
[code]
'[filename] "Listview_with_Checkboxes_Test.tBasic", PermissionToOverwriteGranted
' or just
'[filename] * "Listview_with_Checkboxes_Test.tBasic"


can you see that * on the second line - could have a ? also
meaning thinAir shall always ask ...

Because i had a lot more to say - especially my very disappointing first wCon-Experience - read comments inside the attached script

Petr Schreiber
29-04-2020, 07:46
@DirectuX, @primo - displaying help on call tip will be disabled in v1.11.7.0

@Rene - thank you for the idea, I also consider preservation of SampleScripts handy


Petr

DirectuX
29-04-2020, 08:48
@DirectuX, @primo - displaying help on call tip will be disabled in v1.11.7.0

Thank you Petr


@Rene - thank you for the idea, I also consider preservation of SampleScripts handy


@Petr @Rene

I like too the ideas from you, Rene, though it needs to update all the samples, or scripts you don't want to change just because you just want to try another value for a variable. In this case, I would prefer that thinAir choose whatever a temporary name it wants in the temp folder, then after execution ends, remove it alone while the modified script remain in thinAir's code panel. At this point the user can choose to save or reload the script.
This issue (https://www.thinbasic.com/community/project.php?issueid=588)is related. I opened it mainly (but not only) because of SampleScripts preservation.
I find this above solution straighter than the comment-solution. And, I wish to hear what you think about it Rene. Note that your suggested auto-save feature is something else and it's not incompatible with this.

DirectuX
29-04-2020, 08:53
We have those annotations hat are meant
- for thinAir to display them in the codetree as notes
or
- for thindebug to temporary stop execution.

these for example:



'[]
'[!]
'[book]
'[breakpoint]
'...etc.


i would like to add another one


As the annotations subject is opened, this feature (https://www.thinbasic.com/community/project.php?issueid=624) is related :)

ReneMiner
29-04-2020, 16:55
I have a few to Report - i try to keep it short- promised.1. The Most annoyingOne-line-loops make thinAir show Error
While isWindow(hDlg): DoEvents: WendI guess thincore has Not forgotten the possible Loop in one line, but thinAir has Not learned it.2.Comments:2.1. Well, The apostrophe ist the only Comment that visually Works correct, nevertheless it should Highlight the annotations that are described above.2.2.The Rem itself is a Keyword and should get syntax-colors as any other Keyword. The comment actually must start in the 5. Column after Rem it must follow a char from space-group (space, Tab) or ( endline- newline) which includes according to the Rules : the colon. After Rem follows comment until end of Line. We have No escape-char from any Comment.
2.3.*/ This should be a Multi-Line-comment and its The only one which could end at Another Position than EOL/*2.4// Same as apostrophe. But apostrophe Works// While this does Not. At least Not visually2.5.Comment: AS far AS i know comment was added to keep comments available when importing - i guess its Keyword from AHK, Auto-It or winbatch. IT shows correct Highlights incl. The colon but the comment itself is Not highlighted.3.two Things about multiline-codelines, important First since IT Breaks Up the Programm execution.
3.1.I will Not fill a complete Line... AS String = "Just" & Crlf & "to locate the Problem.."First Line ends with a delimiter or Operator Symbol that tells as opening Parenthesis do: Something will follow - If Not on this row then in the row below. The Problem that occurs ist visible in the error-message. After the &-sign a space must follow in the upper Line or after indent on the next Line. The setting to truncate Trailing spaces will make a Well running Script to Something where your eyes can Not find a Bug. Yesterday IT was running, you did Not Change anything but now IT will Not start. Because of a Missing space that you can Not See.In any Case its required to have a space between & and $CrLf in this example. Else IT will join those and &CrLf is not a valid Keyword.3.2.No Problem If next Line Starts with " -doublequote- can be attached to anything. No Problem with comma nor Parenthesis. They can happily live with any neighbour because they are in 1 Group only and they are the leaders of it while a concatenation-sign has Problems to live next to others than b and h where & becomes a completely different meaning. They build a prefix together to sign these AS a Special Kind of number. IT was a good decision to introduce 0x - prefix because IT Starts with a numeral. Thats a helpful fact when IT comes to octal 0o00 or binary 0b00 should be Case sensitive so only lieber Case char will Not make AS Hex did and grouped a to f in upper and lower case to the numbers with an Operator "&" as leader.The solution might be to recognize the Operator/delimiter in front that makes the following Expression crlf not to be recognized by the Parser since "&" is member of the chars-group, of the Numbers groups (bin & Hex) and of the Operators Group to concetanate strings with quoted, or with equates The Parser has to remove the sunglasses when a Line end comes next remember the Last one AS what He reallIy is - a delimiter - and as you know it was this one >> & you know what Error to expect in the next Line, First token and you could drop a virtual space-char at the end of the crlf-tunnel-at end of Line leading onto the new line before the slowly following" & " gets dragged from the parsers Speed into the CrLf-equate that might be waiting there and cause a Problem.In simple word's: teach the Parser to Bring a space-char when the Last before eol was some Problem-causing delimiter and Put the space between the First and second Position of the First - unreadable token - this was already tokenizerd at te end of the previous Line and IT will Not Matter when your space rammed behind IT will let IT drop Out of the current line.only distance from 0x0a- char should stay AS IT was before. Then the tokenizer should learn Not to call Error again on this Problem but know: If Error on First token after newline while in the previous Line the Last token before eol was this Guy >> & Help myself and so Not disturb Humans for that. Since WE have those multiple-group Tokens WE can Not garbage instantly every usage but IT will Help a Lot If voluntary the Users will avoid to use oldfashioned prefixing and Check for alternatives to provide Logic appearing cool and well thought solutions so this Guy >>& can finally do his real purpose and Mark chars within Double quoted Strings AS hotkey, :D4.Thinair itself has few Problems to Parse multiline-code but thincore handles it as always - reliable and quick. 4.1.Not the multiline-codelines but 2 level while deep + together inside for-next- Loop and inbetween 4 to 5 Level If bring it sometimes out of Control. In any Case almost the Same construct Works very smooth If we exchange while-Wend and replace it Using Repeat-Until. Sadly repeat until in thinBasic Provides No Iteration Nor early Exit. So its quite difficult to Decide which loops to Exchange. Do-loop ist No Option to recommend, it behaves Same as multiple while If Mixed with them.4.4. for Repeat - until i know Bit different from Purebasic. (?) It had multiple constructs Repeat ... Forever : a simple Loop with No Exit because No conditions and only "Skip Iteration" that can jump over the code down to the Forever-part where it Returns up to the repeat-keyword .Iterations Starts counting with 1 Always. When Iterations Returns 0 then IT IS Not running. Starts with 1 in the First cycle and its a read-only- a Bit as cbctl or cbhndl. Iteration (Singular) the current and Iterations (Plural) the Count. Not cheateble, Not changeable. You can Not poke them Nor Pass them byref
Repeat [Forever]|[ {Number} Iterations] [ When condition] .... until | Forever [ {Number} Iterations][When condition]....Repeat will Always be the Initial Keyword .Until can never be in the top row but until can get replaced with "Forever"Forever allows No condition in the Same Line5.Sorry.its the mobiles fault . I only See a very small Part of the Text and i fear i forgot Something important

ReneMiner
29-04-2020, 21:40
Petr, as it looks like no one checked on my script. That I tried to write for wCon but wCon functions cover only half of the minimum required functions and the other half does not work at all. Good we still have the good old one . Less colors but functioning and configurable...

Petr Schreiber
30-04-2020, 19:36
Hi Rene,

could you be more specific? Could you point me to the exact script? Thank you. We are a bit flooded with Eros at work, so we take the issue one by one in our free evenings (once "free evening" appears).

In the meantime - I looked into some issues in this thread. I have to admit I am not able to replicate :cry::https://www.thinbasic.com/community/showthread.php?12949-thinBasic-1-11-x-x&p=95668&viewfull=1#post95668
https://www.thinbasic.com/community/showthread.php?12949-thinBasic-1-11-x-x&p=95669&viewfull=1#post95669


Petr

P.S. Rene - you are a spring of ideas, and I appreciate them - but - my eyes are loosing lines in the massive texts. I suspect you might see it different on your device, but I see text from "First Line" to "Pass them byref" as one text monolith and it is really difficult to not loose the line. If you could split it to paragraphs, it will be easier to follow. Do you think it is possible? Adding two ENTERs before each paragraph should do :read:

ReneMiner
01-05-2020, 06:03
Hi Rene,

could you be more specific? Could you point me to the exact script? Thank you. We are a bit flooded with Eros at work, so we take the issue one by one in our free evenings (once "free evening" appears)....
Petr


i appended script again.

It was the one that will insert a line (or more) to all samplescripts. Easy to exchange the equates at start to use it for any other serial insertion to a bunch of files that match a pattern in all subdirs of a specified folder.

But the real issue- you will read in the script-comments. Guess more easy to read than big paragfraphsaf - and its - i wanted to use wcon... but impossible. What functions work at wcon ? the open window-... maybe wcon_printl if you dont want colored
And wcon_ANY INPUT ??? nope I already had 2 functions (wait- which is to prompt the user to press any key - any key. And instead to write 3 lines where we only wait that the user pressed the ANY-key and no other :D
no one cares what key was pressed


Printl CRLF & separatorLine(Console_sizeX,"-") In %ccOlor_fGray ' alias Repeat$(X,"-")
Printl "Press any key to continue" , Align Right, In %CColor_FLightGreen
WaitKey

'============================================================

that could be:

Wait("Press any key to continue" [RGB(192,192,0), "-", RGB(128,128,128), Align Right])

'default separator + default color = one time setup
'and from now only

Wait()


' alway uniform until program ended
' as my final were

Wait("Press any key to end")

'it will get drawn with the same yellow and a gray separator consist of "-" as the very first


And wcon should have a CHOICE (similar to cmd-Choice) for thinbasic - a usage for making variadic parameters easier to understand how easy it is to use them.
For detail see inside the script

wCon_Choice--- If we had a choice...



UserSelect = wCon_Choice ("What would you like to do?" ,
("Go to Hotel", "Get a beer", "Have fun with that blonde over there", "Keep on Coding"),
"[H][B][F]" )

UserSelect = "[any other key]" ' that was "Keep on Coding"


Easy isn't it ?

One more choice than keys passed = any other key for the last choice
equal count of choices and count of passed acceptable keys = modal decision

Text-adventure friends- you get a new toy with 256 colors!
Ain't that reminding you...?

Petr Schreiber
01-05-2020, 09:15
Rene,

I cannot replicate the issues you describe, could you please post screenshot from this script?


uses "wcon"


WCon_Window "Hi Rene", 100, 100, 80, 25


wcon_printl "Ciao" in 10, 0 at 2, 2
wcon_printl "Rene" in 11, 0 at 3, 3


wcon_printl "Good bye" in 12, 0 at 70, 23
wcon_printl "Rene" in 13, 0 at 75, 24


WCon_Inkey$


I am sorry to hear you experience trouble on your setup, let me know.

Could you let us know version of thinBASIC + your PC setup? (version of Windows and build).

I think you have old thinBASIC, because 1.11.6.0 states in / at support in the help file:
https://www.thinbasic.com/public/products/thinBasic/help/html/wcon_printl.htm?zoom_highlightsub=wcon_printl

To download, please try: http://thinbasic.biz/projects/thinbasic/thinBasic_1.11.6.0.zip

Also - Rene - please understand WCON is in Alpha development - open for suggestions, at the start of the path.
I also do not remember there was a plan to make it 1:1 with Console module - it is simply different take on similar task, an experiment.

There will be always tasks for which Console will be better, and there will be others where WCON is of advantage (fancy colors).


Petr

ReneMiner
01-05-2020, 12:47
why ...In 10 or In 12? Thats not RGB-Function... you wrote in Help use RGB to set colors. Thats the first i saw.
I have running the latest tB 1.11.6 already since it was published.
(Still once in a while crashes of thinair but less than before since i avoid to have config or ini files of thinAir loaded in Notepad++)

But sometimes after maybe an hour or two of coding starting the script-as usual the end if or select case , missing parenthesis that ihave overseen -bugs -bugs but no problem , thinair even shows the right line then- and does not crash that much as with 1.11.5

Sometimes after 3 to 5 tests it stops the execution (thank Eros we have that button and can even test windows without any caption if our stopbutton-callback works) but then thinAir seems not want to return - the window becomes white and hangs (not responding it says) maybe 5 to 10 minutes, i had it 20 minutes already.

Could it internally count how many starts of scripts it has done in the current session- then it could make it like i started 8 times some script in that session i press F5 or F8 and thinAir will restart itsef? Like it writes a small script sends that to thincore "Hey wake me up again instantly when i vanished from process-list! I will have to run script xy.tBasic after that" thinair ends and thincore loops until thinair ended and not in the list of running processes. Then core will start thinAir or even a timer that shells a shortcut to start thinAir as Admin and either thinAir wrote into its config-file that it has to run that script or one of his buddys of bits and bytes tells him- so that maybe 20 seconds and thinair refreshed and resorted memory will shell the script then. It could help. You know us users we always want to test instantly and no- we would not voluntary restart before that test-run. And also not after- because we have things in mind what to change ... Could be configurable either by time - if thinair runs more than 1 hour could ask if to restart before execution to make sure memory is clean- or after 5...15 executions - configurable too. Anyway Autosave automatic once per hour at least...


I am running Windows 10 Enterprise 1909 developer preview version- dont say anything the official release of 1909 it is not that stable and is endangered of suicide because edge will lead to stack overflow permanently and that seems to disturb the hard drive controller who gets the "hickups" and saves the correct lenght of whatever but no bytes. Config-files are overwritten with 00 00 00 ... and all other data too. when you have enabled this drive-watch-thing that actually is to maintain system files integrity then you will find one day some by defrag automatically new located folder with your preciouss holiday pictures: All 00 00 00 -that's wow! Very clean... i dont need it. So edge must be put to sleep until the year 2999 before windows boots the first time and therefor i have some other versions. See signature

Petr Schreiber
01-05-2020, 19:18
Hi Rene,


Colors/
I think you may got slightly confused by the palette system. As the linked help file mentions, foreground and background colors are color code in range 0..255.

They have some default values, and you can override these default values via wcon_setPaletterColor, which assigns RGB value to color code.

We will think how to describe it better. So - this one works, but got misunderstood.

Stability/
ThinAIR in the BETA/ALPHAs is under heavy rewrite, which significantly changes the way it operates. I don't know if you remember, but using thinAir once script was executed was s.l.o.w.

Thanks to rewrite to threads, everything is non-blocking and allows us to do more tricks. But it introduced some issues indeed.

The approach you propose is reasonable as workaround for tool you have no control over, but as we have thinAir source, we will debug & solve root cause.


Petr

ReneMiner
02-05-2020, 21:43
In the help (what's new) says have new keyword PTRSafe , so i am up to declare a bunch of DLLs that did not work on 64bit but the syntax higlight does not have that keyword. And the keywords.ini is made from output of the modules + core from the App_List...-functions output. So was no new file made (LONGLONG was introduced together with PtrSafe and is listed) or something forgotten to make PTRSAFE an active keyword?

And did I miss something? I Declare Function XYZ as this and that- ThinAir asking End Function now?
Do i have to completely wrap the declared functions into a thinBasic-functions or is it if loadLibrary only? Or is there a directive thati have overseen?

primo
05-05-2020, 10:10
i swear that i have read in the new features that there is an additional name for the Numeric variable Extended (Ext) type, something like 'Huge' but can't find anywhere. it is either a corona syndrome or a dream or a memory from a parallel cosmos in which the thinbasic there is like this thinbasic exactly except it has Goto function.

DirectuX
05-05-2020, 17:31
i swear that i have read in the new features that there is an additional name for the Numeric variable Extended (Ext) type, something like 'Huge' but can't find anywhere. it is either a corona syndrome or a dream or a memory from a parallel cosmos in which the thinbasic there is like this thinbasic exactly except it has Goto function.

:evil5: HERE (https://www.thinbasic.com/public/products/thinBasic/help/html/version_1_11_3_0_version_1_11_6_0.htm), look at 2020/02/06

primo
06-05-2020, 06:27
Thanks DirectuX , now i feel better that my memory was correct in having something about big numbers, yes now i remember that i read: LARGE_INTEGER data type.

DirectuX
06-05-2020, 08:43
Thanks DirectuX , now i feel better that my memory was correct in having something about big numbers, yes now i remember that i read: LARGE_INTEGER data type.

long long / large integer : https://docs.microsoft.com/en-gb/cpp/cpp/data-type-ranges?view=vs-2019
I'm still wondering why unsigned int64 can't be in thinbasic.

jack
06-05-2020, 14:02
long long / large integer : https://docs.microsoft.com/en-gb/cpp/cpp/data-type-ranges?view=vs-2019
I'm still wondering why unsigned int64 can't be in thinbasic.
yes, thinbasic already has unsigned integer -> word and unsigned long -> dword, so naturally we need a new data type unsigned quad -> qword

Petr Schreiber
14-05-2020, 21:33
I understand it would be nice for symmetry :)

Is there any particular use you would need unsigned 64 bit integer for now? The maximum value it can hold is 18446744073709551610 - is it sufficient for your use?

Maybe better to use some 3rd party library for handling large integers / arbitrary precision arithmetics.

I am sure it would be possible to add Uint64, but on the other side, as PowerBASIC, used for thinBasic Core development, does not have it, it would mean some extra work.


Petr