PDA

View Full Version : What are the main news in thinBasic 1.7.0.0



ErosOlmi
31-08-2008, 22:52
Here the list of changes so far: http://www.thinbasic.org/public/applications/thinbasic/onlyforyoureyes/HTML/version_1_7_0_0.htm

But among others, I think there are 4 important changes in 1.7.0.0

callback fucntions
TBMain main function introduction
TBGL working in a window control
some new interface functions
UDT in modules


callback fucntions
We will talk a lot about callback function. I suppose many of you already have used in other languages. In thinBasic callbacks a re limited to windows and controls. For this first pre-release, callbacks are limited to the following controls: LABEL, BUTTON, TEXTBOX. I'm adding callback usage to all controls. I'm sure to be able to have for all controls before final release.

Using callbacks to handle windows and control events will make thinBasic programs much easier to be written and managed. Especially for complex applications this will allow to modularize sources in a more convenient way. Callbacks will also allow more precise control over your controls because a lot of more sophisticated messages will reach your code without the filter of thinBasic engine. You will drive you application.

TBMain main function introduction
TBMain is in my opinion a great step forward in source code handling. Having a main function be executed automatically and having the idea of a main process will increase the idea of professionalism in thinBasic.

TBGL working in a window control
Well, Petr will talk in future posts about this. Here I just want to get the idea of the power of TBGL from inside a window managed by callbacks. TBGL applications having a user interface set of controls reacting in real time will increase the kind of applications you will be able to make.

some new interface functions
Well, I think I've added a couple of nice new interfaces. Here I will just talk about one. I will leave the other to future posts.
Here the declare syntax


Declare Function thinBasic_AddUdt _
LIB "thinCore.DLL" _
Alias "thinBasic_AddUdt" _
( _
ByVal sUDT_Code As String _
) As Long

This interface function will let you add predefined UDT structures from inside your modules letting new variable types be present in scripts at run-time without the need to define them in scripts.
Current UI module already implements some often used standard UDT. See for example help at
http://www.thinbasic.org/public/applications/thinbasic/onlyforyoureyes/HTML/pointapi.htm
http://www.thinbasic.org/public/applications/thinbasic/onlyforyoureyes/HTML/rect.htm
http://www.thinbasic.org/public/applications/thinbasic/onlyforyoureyes/HTML/nmhdr.htm
There will be more in future.

But how to use thinBasic_AddUdt in your modules? See next.

UDT in modules
Yes, UDT in modules means you will be able to pre-define any UDT you need in your modules when module loads. Inside your LoadLocalSymbols do something like:


thinBasic_AddUdt( _
"Type RECT " & $CrLf & _
" nLeft As Long" & $CrLf & _
" nTop As Long" & $CrLf & _
" nRight As Long" & $CrLf & _
" nBottom As Long" & $CrLf & _
"End Type " & $CrLf & _
"" )


or



thinBasic_AddUdt( _
"Type PAINTSTRUCT " & $CrLf & _
" hDC As Dword" & $CrLf & _
" fErase As Long " & $CrLf & _
" rcPaint As RECT " & $CrLf & _
" fRestore As Long " & $CrLf & _
" fIncUpdate As Long " & $CrLf & _
" rgbReserved(32) As Byte " & $CrLf & _
"End Type " & $CrLf & _
"" )

So define your UDT exactly like you would do in a script.
When module will be in the loading phase, thinBasic will load and parse you UDT code on the fly.
Inside the script users will be able to do something like:

DIM MyRC as RECT
without the need to define RECT, it will be already defined.

_________________________________________________
That's all for the moment.
Eros