View Full Version : [Beta] thinBasic 1.10.7.x
ErosOlmi
30-06-2017, 15:29
thinBASIC 1.10.7.x
Download from: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.7.0.zip
Are you curious about what
we are working on:
CHECK HERE (https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?whatsnew.htm)
2019.05.26 10:30 (CET Time) updated to 1.10.7.0
Version mainly concentrated on thinAir improvements ...
thinAir: Improved Find/Replace dialog
thinAir: added "Select all occurrences" of a given selection of word allowing in place editing of all of the occurrences
thinAir: working on improving Code Browser to better and faster parse source code
thinAir: autocompletion will now shows UDTs, functions and subs present in your script
added new module I18N working on internationalization but still to be finished.
few other improvements in Core, MSXML2, ADODB
New TBGL version from Petr
See offline or online help for details: https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_10_5_0.htm
2019.01.19 14:00 (CET Time) updated to 1.10.6.0
Some fixes and new features.
See list here: https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_10_6_0.htm
Updated Petr Schreiber TBGL module with all the recent features and fix. Source code can be seen at Github at https://github.com/ThinBASIC/thinBasic_TBGL
2018.10.15 20:58 (CET Time) updated to 1.10.5.0
Here we are again with a new beta after more than one year.
Sorry for this big delay, I will never let pass so much time for an update but this version is a HUGE version
I do not know where to start to describe, maybe with a link to the list of changes is the best place:
https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_10_5_0.htm
I will mention only few here, just the most important one, because some of them are still under development and to document:
if you read list of changes from the bottom of the above link, you will see I started to add events and properties to user interface elements, from windows to controls. It is just a beginning of a new way to handle thinBasic user interface.
See example: \thinBasic\SampleScripts\UI\NamedControls
New ACTIVEX control added. This control let you host an activex objects, get their automation idispatch and interact with them.
See example at: \thinBasic\SampleScripts\UI\ActiveX\ActiveX_WebBrowserCharts
New RICHEDIT control
New IMAGE control that will use GDI+ to load images of all types supported by GDI+
Added FAST ... SUPER FAST versions of some of the common used string function handling. Same name but with F: MIDF$, LEFTF$, RIGHF$, LENF, GRABF$, PARSEF$, PARSECOUNTF.
They work using direct access to passed dynamic string without generating an internal copy of the string. You will see that they will be thousands of times faster!!
See help for how to use them and limitations. The only limitation is that you need to pass a dynamic string instead of a string expression.
Introduced System pseudo variable to collect system information
Improved App pseudo variable
Improved COMM module
thinAir can now have themes, handled very easily with XML format.
Right click on any edit window of thinAir and at the bottom of the menu you will see "Themes" menu.
Just open Theme directory to see how a thinAir theme is handled, duplicate a theme and make your preferred theme.
And share it with us.
I will create a dedicated forum to talk about themes and share them
UDT elements names can now be indicated dynamically using a string expression between (). In below example filed name is calculated at run time:
string sFieldName = "MyString"
MyType.(sFieldName) = "ABCD"
AnyType pseudo type can be used in function declaration to say you do not know the type of the UDT and it will be determined at run time. Example:
Function AnyUdt_QSort(ByRef T1() As AnyType, ...)
This with the element name composed at run time will open many possibilities.
thinAir source code will be saved as UTF-8 BOM file: https://docs.microsoft.com/it-it/windows/desktop/Intl/using-byte-order-marks
CODEPTR ... this is huge for a scripting language. It will open an enormous set of possibilities. With this function you will be able to create a real SDK Windows application like you would do using compiled languages.
See examples in:
\thinBasic\SampleScripts\IUP\
\thinBasic\\SampleScripts\UI\SDK\
Introduced WSTRING and WSTRINGZ data types ONLY in DECLARE statement when declaring external DLLs functions.
When thinBasic will see this new data types, it will automatically convert script UTF-8 strings into UNICODE strings.
Example in \SampleScripts\UI\SDK\DIALOG_UNICODE.tbasic and \SampleScripts\UI\SDK\sdk_msgbox.tbasic
In future thinBasic versions I will add native data type to be used in scripts for variable declarations.
static numeric and dynamic elements inside an UDT can now be initialized to a value. Still to work on UDT Extends
And last ... a new module called AppConfig that will let you load script parameters dynamically at run time from an specifically formatted XML file.
More info at https://www.thinbasic.com/public/products/thinBasic/help/html/index.html?cappconfigclassusageexample.htm
It will be so easy to store and load data in this way
What to say more ... have a try and let us know.
2017.09.29 13:00 (CET Time) updated to 1.10.4.0
New quick update version just for adding a quicker way to declare and initialize iDispatch variables.
It is now possible to declare and instantiate an iDispatch variable on the same statement. Examples of valid statements:
iDispatch objFSO = NewCom("Scripting.FileSystemObject")
dim objFSO as iDispatch = NewCom("Scripting.FileSystemObject")
Also added few new examples in \thinBasic\SampleScripts\iDispatch\
2017.09.22 20:37 (CET Time) updated to 1.10.3.0
Here we are again with a new beta.
I would like to call this beta a WOW beta for the new features it brings inside regarding interfacing with COM object using the new variable type: iDispatch
I already gave some hints on COM here: http://www.thinbasic.com/community/showthread.php?12778-thinBasic-1-10-x&p=93751&viewfull=1#post93751
Just to say that we are only at the very beginning, there are still many limitations (for example not possible to write compound multiple objects with dotted notation) but I'm working to give programmers the best experience I can using COM.
To have a look at new iDispatch variable type usage, please check examples in \thinBasic\SampleScripts\iDispatch\ directory
Plus:
Some fixes
added new data structure linked list with a lot of features and more will come in next beta
fix thinAir autocompletion, if not visible activate it in thinAir options
Full list of changes: http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_10_3_0.htm
And, as usual, all is documented in thinBasic .chm offline help file.
2017.08.02 11:30 (CET Time) updated to 1.10.2.0
Here we are again with a new beta:
Some fixes
fully documented cJSON module
Examples in \thinBasic\SampleScripts\cJSON\
added new functions to cJSON module
fully documented StringBuilder module
added a new experimental module working with SQLite data. For the moment very basic commands.
Example with SQL DB in \thinBasic\SampleScripts\SQLite\
Full list of changes in help file or online at http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_10_2_0.htm
2017.07.23 19:30 (CET Time) updated to 1.10.1.0
Here we are again with a new beta: finished to document MSXML2 module, added a new module CJSON still under development and make some fixes.
Scintilla editor: fixed possibility to loose source code when switching from Codemax to Scintilla editor
Scintilla editor: now font name and size is taken from thinAir options
Scintilla editor: added zooming in editor right click
Scintilla editor: changed some file saving strategy
completed documentation and added some script examples for new module MSXML2. This module is great for connecting to remote http server to get back data. Example usage: REST API. See examples in \thinBasic\SampleScripts\MSXML2\ directory
added a new experimental module: CJSON.
ATTENTION: this module need VCRUNTIME140.DLL installed in order to work. It can be downloaded from Microsoft
Will be documented in next versions but you can already have an idea looking at \thinBasic\SampleScripts\CJSON\ directory
2017.06.30 21:50 (CET Time) updated again 1.10.0.0
Added missing file used for scintilla auto-completion: suggestion listbox while typing
Updated TBGL
It is time to open a new Beta phase to show ongoing new features that will be present in next stable release.
This version will be an ongoing development version for some time.
Among other changes, this version introduced 3 big changes:
introduced Scintilla control editor as an optional control editor in thinAir.
To test Scintilla Code Editor goto [thinAir options\Editor\Editor Type] then choose SCINTILLA, then close/open thinAir.
We are just at the beginning, Scintilla has a huge number of features and I will need time to study and take advantages of them
See images for example of some of the new features
Scintilla will now open the option to have UTF-8 in scripts. A lot of work is still to be done on that side but at least we have opened the door.
See image and example in \SampleScrips\Unicode\
ADODB module officially added as stable module. Quite completely documented all new features.
Still some work to do (like adding Command class) but a lot is already in there.
See examples into \SampleScripts\ADODB\
See help (online and offline) for details of all new features introduced in this version: http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?whatsnew.htm
More detailed info, features and examples will come next weeks.
Previous 1.9.16.x beta versions (in case of any needs):
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.0.0.zip
big thanks Eros. i am testing ...
1- scintella editor properties: Font face courier New Font size 16
the font size stay as it is and does not change
2- the ASC for the unicode char seems 2 numbers
as an example:
String helloworld = "бумага бумага"
printl asc(helloworld,1)
output 208
printl asc(helloworld,2)
Output 177
printl asc(helloworld,13)
Output 32 (space asc)
there is a lot of fuzz about unicode in the web, so who know how to interpret the 208, 177 for the first russian char in "бумага"
catventure
30-06-2017, 16:41
Thank you for new beta release. :)
No problems installing. TAB seems running OK too. :)
Regards,
catventure.
Petr Schreiber
30-06-2017, 19:00
Hi Primo,
yes, special characters get two bytes - one could not simply fit all the special characters to one byte (256 values), while two allow 65536 options.
Scintilla tip: Eros will correct me, if I am wrong, but the settings from options dialog are not reflected in Scintilla mode in this beta release.
Scintilla tip: While the search dialog is not implemented yet, you may mark some text and press F3.
Petr
ErosOlmi
30-06-2017, 21:14
Yes Petr is right on all.
I'm in early phase of introducing Scintilla that is quite complex.
thinAir editor options are not reflected in Scintilla code editor so far but I will work on that in next updates
Search is not yet developed in Scintilla. Only way to search for something at the moment: select a text and press F3
Unicode is only at the beginning. For many thinBasic functions I will need to develop unicode aware version of them like I developed MsgboxW
In few minutes an updated 1.10.0.0: I forgot to add a file that will permit codetips while typing
ErosOlmi
30-06-2017, 21:16
Thank you for new beta release. :)
No problems installing. TAB seems running OK too. :)
Regards,
catventure.
Great cat: I think TAB is the biggest thinBasic script ever developed in thinBasic :)
ErosOlmi
30-06-2017, 21:55
updated again 1.10.0.0. See first post of this thread
Added missing file used for scintilla auto-completion: suggestion listbox while typing
Updated TBGL
Petr Schreiber
30-06-2017, 22:01
In TBGL: TBGL_SpriteExists could GPF when supplied with parameter which was outta bounds of internal buffer AND/OR in case the function was called before first sprite was created. Now fixed in 1.10.
Petr
Hi, Thanks for the updates. But i have hard time to see my native language in ThinBasic. See this image.
Petr Schreiber
30-06-2017, 22:47
Hi,
did you used keyboard to type your characters or did you pasted it from clipboard?
Clipboard pasting does not work in this release, issue could be related to font as well.
Let us know ;)
Petr
a far guess that the kcvinu problem is that his system needs to enable the support to east asian languages, in the case of windows xp it is in control panel like this: and it needs the windows xp CD, havn't tested it in win7 or more.
9723
the Malayalam is displayed correctly on my english system with east language support using thinbasic scintilla editor, but the font size is very very small look the picture:
9724
Hi Petr,
Thanks for your reply. I have typed those letters to editor. I am using an input method editor whih uses low level keyboard hook to convert English letters to Malayalam. More over, I have no problem in typing Malayalam in Scintilla editor of AutoIt and AutoHotkey.
@primo,
Thanks but that is not my problem. I can type Malayalam anywhere except thinbasic IDE.
kcvinu, , there is an old but nice scintilla editor for thinbasic from José Roca, download it from here:
http://www.thinbasic.com/community/showthread.php?10007-Alternative-IDE-thinSED&p=84201&viewfull=1#post84201
just run thinSed.exe and by default it deals with c:\thinbasic
in fact i can't paste unicode chars in it, but try it after inspecting Options-> colors and fonts. or tools ...
there is also Edit-> Paste and Paste from internet explorer
and other features.
@primo,
ThinSed is not displaying Malayalam correctly. Same as ThinAir. But miraculously, thinAir support Malayalam when we paste text in Malayalam. It displays correct Malayalam and compiled it. See the result in this attachment.
@Eros, Plsease set an option for user to set the encoding of the file to utf-8 or ASCII . I think it can be set like "code.page=65001".
ErosOlmi
23-07-2017, 21:11
Updated to version 1.10.1.0
See first post of this thread for details.
Next update I will work more on Scitilla editor (integration with thinAir options) and some UTF-8 improvements, I still have to study a lot on this last point.
Hi Eros,
Thanks for this update. Is there any change log files ?
Petr Schreiber
23-07-2017, 22:32
Few things not mentioned in help file, but added:
TBGL can now load textures from UNC paths
StringBuilder can be correctly initialized via string
Scintilla can be zoomed by holding Ctrl + mouse wheel
Changelog available here: http://www.thinbasic.com/public/products/thinBasic/help/html/version_1_10_1_0.htm
Petr
Hi Petr,
Thanks. :)
One question. Do i need to uninstall old TB to install this beta ?
ErosOlmi
23-07-2017, 23:33
Hi Eros,
Thanks for this update. Is there any change log files ?
Yes, all changes are always detailed in help file both offline and online:
http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_underdevelopment.htm
To install thinBasic just run setup over previous versions, no need to uninstall.
Files will be replaced with new ones.
Just pay attention: if you did some change in official script examples, you will lost them.
Thanks Eros for the Update.
ErosOlmi
02-08-2017, 11:33
Updated to version 1.10.2.0
See first post of this thread for details.
Hi Eros,
Thanks for the updates. I happy to see the UI fix. I have tested a gui with unicode text as button caption but it is not showing my language correctly. I think i am doing something wrong. Pls see the attached image.
ErosOlmi
02-08-2017, 12:33
No, you are not wrong.
It is me still studying how to implement Unicode in UI module :oops:
So, please have still some patience.
Hi Eros,
Ok. Take your own time. I will wait for the updates
Thanks. :)
ErosOlmi
02-08-2017, 16:47
If I will have something "experimental" to test, I will sent you preliminary UI module.
Hi Eros,
Ok, that's a honor for me. I am happy to do that for thinBasic. For a complete unicode support, Visual designer should support unicode text. Now, if we type unicode as caption in visual designer, it will display some question marks.
Thanks for the Update, i have tested json for the first time, it is a nice addition, and there is a lot of tutorials and books in the web about it. it runs okay on windows 7, but it fails in windows xp with error msg:
https://s2.postimg.org/3u4h0nde1/error.png
ErosOlmi
02-08-2017, 19:31
Ciao primo
cJSON has a strong prerequisite. You need Visual C Runtime 2015.
Please check here: http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?cjson.htm
I've linked a page where to find runtime.
Let me know if you succede because I didn't test on XP and also it is not sure you automatically have that runtime on W7, it depends if other application have installed it.
Thank you Eros, you are right, after installing the vc2015 x86 runtime on windows xp the thinbasic cJSON module works like charm.
Thanks
Charles Pegge
04-08-2017, 03:05
Hi Eros,
I love the way you shrunk oxygen.dll to less than 1/3 of its original size (my universe in 150k!). Is it UPX? I could adopt the compression as standard :)
ErosOlmi
04-08-2017, 08:17
Ciao Charles,
Yes it is UPX with option: "--ultra-brute"
This option try to compress with 72 different compression methods and at the end it chooses the best
Option "--brute" is faster because it try only 32 methods and is quite good too in compressing.
I use UPX for all thinBasic modules DLLs, all EXEs, all bundled EXEs.
Without UPX thinBasic setup would be more than 35Mb instead of just 16Mb
Reference: https://upx.github.io/
Eros
Charles Pegge
07-08-2017, 21:50
I have been testing UPX compression on all my binaries, without any problems or noticible delays. So I would like to distribute all OxygenBasic binaries UPX-compressed. We will just see if anyone has any major objections on the forum.
With oxygen.dll 530kb:
--best 156kb
--brute 140 kb
--ultra-brute 140kb
ErosOlmi
08-09-2017, 12:53
Quite ready to release new thinBasic 1.10.3 Beta version
In the next version there will be just a new feature but ... a great one: new variable type called iDispatch.
iDispatch variables will let users to interact with COM components that implements Dispatch interfaces like they would be native thinBasic objects.
It is just a start, many features will be missed (like full dotted notation, COM object events, ForEach <object> in <objectcollection>, ...) but in any case it is a nice start.
This new feature, when better implemented, will definitely substitute COM module that has never jumped in the direction I wanted.
Few examples are better then many words.
Stay tuned ... :D
Read and parse and XML file printing child nodes
uses "Console"
%ELEMENT_NODE = 1
%ATTRIBUTE_NODE = 2
%TEXT_NODE = 3
%CDATA_SECTION_NODE = 4
%ENTITY_REFERENCE_NODE = 5
%ENTITY_NODE = 6
%PROCESSING_INSTRUCTION_NODE = 7
%COMMENT_NODE = 8
%DOCUMENT_NODE = 9
%DOCUMENT_TYPE_NODE = 10
%DOCUMENT_FRAGMENT_NODE = 11
%NOTATION_NODE = 12
function TBMain()
Dim xDoc as idispatch
dim xChildNodes as iDispatch
xDoc = NewCom("MSXML.DOMDocument")
if IsComObject(xDoc) Then
xDoc.validateOnParse = False
xDoc.async = False
If xDoc.Load("https://www.w3schools.com/xml/plant_catalog.xml") Then
PrintL "Your XML Document loaded successfully."
'---Now do something intersting.
'---Traverse the parsed Document
xChildNodes = xDoc.childNodes
DisplayNode(xchildNodes, 0)
xDoc = Nothing
Else
' The document failed to load.
Dim xPE as iDispatch
' Obtain the ParseError object
xPE = xDoc.parseError
PrintL "Your XML Document failed to load due the following error."
printl "Error #.........:", xPE.errorCode
printl "Reason..........:", xPE.reason
printl "Line #..........:", xPE.Line
printl "Line Position...:", xPE.linepos
printl "Position In File:", xPE.filepos
printl "Source Text.....:", xPE.srcText
printl "Document URL....:", xPE.url
xPE = Nothing
End If
Else
printl "It was not possible to create MSXML.DOMDocument object"
end If
printl "---Press a key to end---"
WaitKey
End Function
'------------------------------------------------------------------------
' Traverse a DOM node collection of nodes
'------------------------------------------------------------------------
Function DisplayNode(ByRef xNodes As idispatch, ByVal Indent As Integer)
Dim xNode as iDispatch
Dim xParentNode as iDispatch
dim xChildNodes as iDispatch
dim lNode as Long
Indent = Indent + 2
for lNode = 0 to xNodes.Length - 1
xNode = xNodes.Item(lNode)
If xNode.nodeType = %TEXT_NODE Then
xParentNode = xNode.parentNode
PrintL $SPC(Indent) & xParentNode.nodeName & ":", xNode.nodeValue
End If
'
If xNode.hasChildNodes Then
xChildNodes = xNode.childNodes
DisplayNode(xChildNodes, Indent)
End If
xChildNodes = Nothing
Next
xNode = Nothing
End Function
Get information about drive C:
uses "Console"
dim oFSO as idispatch
dim oDrives as iDispatch
dim oDrive as iDispatch
oFSO = NewCom("Scripting.FileSystemObject")
printl "Creating Scripting.FileSystemObject object ..."
if isComObject(oFSO) then
printl "creation was ok." in %CCOLOR_FLIGHTGREEN
PrintL
oDrives = oFSO.Drives
if IsComObject(oDrives) Then
printl "Number of drives:", oDrives.Count
printl
printl "Get info of Drive C"
oDrive = oDrives.Item("C")
if IsComObject(oDrive) Then
printl "VolumeName.......", oDrive.VolumeName
printl "DriveType........", oDrive.DriveType
printl "DriveLetter......", oDrive.DriveLetter
printl "TotalSize........", oDrive.TotalSize
printl "AvailableSpace,,,", oDrive.AvailableSpace
PrintL
end If
end If
Else
printl "Creating Scripting.FileSystemObject failed" in %CCOLOR_FLIGHTRED
end if
printl "All done. Press a key"
waitkey
Read database data using ADODB COM object
uses "Console"
dim oCon as iDispatch
dim oRec as iDispatch
dim oFields as iDispatch
dim oField as iDispatch
dim lCount as Long
oCon = NewCom("ADODB.Connection")
if IsComObject(oCon) then
oCon.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & APP_Path & "SampleScripts\ADODB\biblio.mdb")
if oCon.State = 1 then
printl "State...............:", oCon.State
printl "Version.............:", oCon.Version
printl "ConnectionString....:", oCon.ConnectionString
printl "Provider............:", oCon.Provider
oRec = NewCom("ADODB.Recordset") 'adOpenKeyset=1
string ADO_SQL_Query = "Select * FROM Authors" 'adOpenForwardOnly=0 adLockReadOnly=1 adCmdText=1
oRec.Open(ADO_SQL_Query, oCon, 1, 1, 1)
printl "Recordset state:", oRec.State
'---If state is open then
if oRec.State Then
oRec.MoveLast
oRec.MoveFirst
printl "Recordcount:", oRec.Recordcount in %CCOLOR_FLIGHTRED
PrintL
'---List fields present in recordset
oFields = oRec.Fields
if IsComObject(oFields) Then
printl "Print all fields in ", iTypeInfo_typename(oFields), "collection:"
for lCount = 1 to oFields.Count
oField = oFields.Item(lCount-1)
printl lCount, ") ", oField.Name, oField.Type
Next
end If
'---Print data
PrintL
printl "Now print out some data:"
lCount = 1
while not oRec.EOF
'---Do something
print lCount, ") " in %CCOLOR_FLIGHTGREEN
printl oRec.Collect("Author"), oRec.Collect("Year Born")
incr lCount
oRec.MoveNext
Wend
oRec.Close
end If
oCon.Close
else
printl "Connection not opened" in %ccolor_flightred
end if
oRec = nothing
oCon = nothing
else
printl "An error occurred creating ADODB.Connection object" in %ccolor_flightred
end if
printl "---Press a key to end---" in %ccolor_fYellow
waitkey
Show running process and get few info
uses "Console"
'------------------------------------------------
' List running process
'------------------------------------------------
Dim objWMIService as iDispatch
dim objItem as iDispatch
dim colItems as iDispatch
dim strComputer as String
strComputer = "."
'---WMI connection to Root CIM
objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
if IsComObject(objWMIService) then
'---Collection of items
colItems = objWMIService.ExecQuery("Select * from Win32_Process")
if IsComObject(colItems) then
'---Number of items in a collection is always found using .Count property
for nItems as long = 1 To colItems.Count
'---Use .ItemIndex with index from 0 to get an item from the collection
'---Item will be of SWbemObjectSet type
objItem = colItems.ItemIndex(nItems - 1)
if IsComObject(objItem) then
'https://msdn.microsoft.com/en-us/library/aa394372(v=vs.85).aspx
Print "Process:", nItems in %ccolor_fyellow
print "", objItem.Name in %ccolor_flightred
print "", objItem.ProcessId in %ccolor_flightcyan
print "", tstr$(objItem.WorkingSetSize/1024) & " kb" in %CCOLOR_FLIGHTRED
print "", objItem.ExecutablePath 'CommandLine
printl
objItem = Nothing
end if
Next
colItems = Nothing
Else
printl "ExecQuery failed" in %CCOLOR_FLIGHTRED
end If
objWMIService = Nothing
Else
printl "GetObject failed" in %CCOLOR_FLIGHTRED
end if
waitkey
Quite ready to release new thinBasic 1.10.3 Beta version
Hi Eros
we are waiting
https://www.youtube.com/watch?v=zSf9edxVi5w
Thanks
ErosOlmi
12-09-2017, 17:17
:D:onthequiet:
I'm fixing last minute bugs and completing help but if you are so brave ...
point your mouse at the below link and have a look at \thinBasic\SampleScrips\iDispatch\
|
|
|
|
|
|
\/
:rolleyes:
|
|
|
|
|
|
:cool:
|
|
|
|
|
|
\/
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.3.0.zip
PS: this new feature is only at the very first stage. I'm still studying how to browse iDispatch iTypeLib interface and be able to determine at runtime features exposed by objects.
If you develop some nice example I will be happy to publish in official thinbasic setup, if you like.
so we don't need Com, or "VBREGEXP" modules when we use iDispatch
but for some dlls we still need to register it by regsvr32 dllname.dll
i like mostly the syntax of the new usage of the vbscript regexp. as an example instead of the extremely complex code using "VBREGEXP" module http://www.thinbasic.com/community/showthread.php?11120-regular-expressions-usage&p=83112&viewfull=1#post83112
here is a very short equivalent using the iDispatch as in the example iDispatch_vbscript.regexp
don't use numbers (line 6) more than 5 digits to test its primality with regular expressions
the example appears tall because the many empty lines and many comments
uses "Console"
'-----------------------------------------------------------------
'Checks whether or not the user entered a number is prime or not
'-----------------------------------------------------------------
Long yourNumber = 97 '123457
String sNumber = String$(yourNumber, "1")
Dim oReg as iDispatch
printl "Creating vbscript.regexp object"
oReg = NewCom("vbscript.regexp")
If IsComObject(oReg) then
printl "Creation was ok."
printl "
'-----------------------------------------------------------------
'Checks whether or not a number is prime
'-----------------------------------------------------------------
"
'printl expand$("email to check is $sNumber")
PrintL
oReg.Pattern = "^1?$|^(11+?)\1+$"
oReg.IgnoreCase = %FALSE
oReg.Global = %FALSE
PrintL "Cheking pattern is:", oReg.Pattern
' Test method returns false if a match is found
If oReg.Test(sNumber) Then
PrintL "not prime sorry"
Else
PrintL "prime number"
End If
oReg = nothing
Else
printl "Creating vbscript.regexp failed" in %CCOLOR_FLIGHTRED
end if
printl "All done. Press a key"
waitkey
certainly you have done a big job Eros in the dark era in which every one are clicking continuously on his smartPhone which is just wasting the people time and sucking their money.
i will check the other iDispatch examples
ErosOlmi
12-09-2017, 23:13
Thanks primo,
Yes, I like programming instead of loosing time on pure socials.
COM module will be deprecated in future thinBasic version. I already set a note in help file. It was a very rudimentary way to wrap object iDispatch interface.
VBREGEXP module is too completely deprecated as it was just a wrapper of vbscript.regexp COM object
Well, the idea is to have the option to interact with any registered COM objects and even on COM objects inside DLL or other kind of files.
In any case we are just at the very beginning. All started from some code I get from José Roca in PowerBasic forum where José developed a CallByName function that inspired me: https://forum.powerbasic.com/forum/user-to-user-discussions/source-code/24964-com-callbyname
I'm also developing some functions able to interact with iTypeLib interface that will let users inspect object.
Future, future ... I need to stay committed with iDispatch because I've too many ideas in my mind and I must remain committed with my plan :D
Hi Eros
the new dictionay with iDispatch is easy to understand and remember, how to know the available list of the available methods for the new dictionary
i have tested example iDispatch_Scripting_Dictionary
is there a dict.Find ?
dict.Count works and gives 4 correctly
but dict.find turns nothing
other question: why you have named the new creation as "iDispatch" ?
uses "Console"
Dim dict as iDispatch
printl "Creating dictionary dict ..."
dict = NewCom("Scripting.Dictionary")
if IsComObject(dict) then
printl "Dictionary created."
dict.CompareMode = 1 '---1 = vbTextCompare - textual comparison. Keys are not case sensitive
printl "Inserting some keys in dictionary ..."
dict.Add("re","Red")
dict.Add("gr","Green")
dict.Add("bl","Blue")
dict.Add("pi","Pink")
printl "Done. Number of keys present in dictionary:", dict.Count
printl "The value of key gr is:", dict.Item("gr")
String st
PrintL dict.Count
st = dict.Find("gr")
PrintL st
dict = nothing
else
printl "An error occurred creating Scripting.Dictionary object" in %ccolor_flightred
end if
printl "---Press a key to end---" in %ccolor_fYellow
waitkey
thanks for all your efforts
Petr Schreiber
13-09-2017, 21:32
Hi Primo,
the methods are documented here:
https://msdn.microsoft.com/en-us/library/x4k5wbx4(v=vs.84).aspx
The work Eros has done in COM is equivalent of discovering America. It opens whole new world of possibilities, with friendly syntax.
Petr
ErosOlmi
13-09-2017, 21:50
Ciao primo,
I will start from the bottom.
If you press F1 in thinAir while cursor is over iDispatch term, you will get some help I've written.
Anyway iDispatch is standard interface developed over COM.
COM stands for "Component Object Model". In a few words you can think about it as a common interface to be able to talk with binary objects without having any info about that objects.
It is the Microsoft way to interconnect software using a common interface. These interfaces are defined in a COM Object.
If you want to use some function that are inside a DLL, you need to know exactly function name, function return type, number of function parameters, their type, their passing way (byref or byval), ... you need to know everything before being able to call that function. With a COM object you do not need anything, just the registered name of the object is enough because the object is able to describe itself using a common binary interface.
There are many sources on the web you can find talking about ActiveX, COM, iUnknown, iDIspatch, iTypeLib, ... you can stay one year studying about it and still you will have something new to learn for other years :)
As an introduction, have a look at http://pubs.opengroup.org/onlinepubs/009899899/
A great book can be "Inside COM" from Don Box: https://www.amazon.com/Essential-COM-Don-Box/dp/0201634465/ref=pd_sim_14_1?_encoding=UTF8&psc=1&refRID=6FPS5CBBBNRXCVCB1EGW
That said, back to your first question: how to know what a COM object interface instantiated inside an iDispacth variable exposes to the programmer?
Answer is easy and complicated at the same time.
In general any component developed by Microsoft like Scripting.Dictionary is documented by Microsoft.
For example Scripting component is documented at https://msdn.microsoft.com/en-us/library/bstcxhf7(v=vs.84).aspx
In that page you will find that Scripting implements some objects and one of those is Dictionary interface: https://msdn.microsoft.com/en-us/library/x4k5wbx4(v=vs.84).aspx
And there you will find what Properties and Methods that interface implements.
Here https://msdn.microsoft.com/en-us/library/57hdf10z(v=vs.84).aspx your question: Exists method
So, first reply is: search on the web inside developer of the COM object you are using.
.
Another option is to use a COM Object Browser.
A COM Browser is an application that can be used to browse all registered COM objects, and all objects that support Ole Automation interface.
Have a look at this page https://www.autoitscript.com/autoit3/docs/intro/ComRef.htm and check "OLE/COM Object Viewer" chapter
.
I'm finishing to adapt to thinBasic a COM Browser developed by José Roca and generously released as Freeware: see image
With this browser you will be able to get information about installed COM components and what automation interfaces they implements and for each of them what properties and method they have. And for each of them what parameters they need ...
Hope to have answered to some of your needs.
I just started to study this development area and at every turn I discover a complete new world.
Ciao
Eros
José Roca
14-09-2017, 04:55
I'm finishing to adapt to thinBasic a COM Browser developed by José Roca and generously released as open source
One small precission: I never have released anything as open source, but as freeware, allowing to use it for your own purposes, even in commercial applications, without paying a fee, but not to make derivative works from, sell or redistribute without permission.
You have asked permission to adapt it for use with thinBasic and I have granted it to you, but this does not make the original or the derivative work(s) open source, but freeware.
Freeware (not to be confused with "Free Software"):
https://en.wikipedia.org/wiki/Freeware
ErosOlmi
14-09-2017, 08:43
Ciao José,
correct. Sorry for the confusion in writing.
I've changed my post removing "open source" indication.
Thanks
Eros
ErosOlmi
22-09-2017, 20:52
Just released thinBasic 1.10.3
See first post of this threat and have fun
http://www.thinbasic.com/community/showthread.php?12778-thinBasic-1-10-x
Thanks Eros for the nicest thinbasic release full of golden innovations
i have noticed there is a new Linked list LList in addition to the previous LL
i will read and experiment with the new features, i am waiting my dental pain to stop
best wishes
ErosOlmi
29-09-2017, 13:05
Just released thinBasic 1.10.4
See first post of this threat and have fun
http://www.thinbasic.com/community/showthread.php?12778-thinBasic-1-10-x
Petr Schreiber
01-10-2017, 20:11
Eros,
the COM is really powerful, I am amazed more and more how much new possibilities open with this.
Thank you so much for this new toy :drink:
I discovered few minor things to look into, once you have a minute:
In SampleScripts
iDispatch_Scripting.FileSystemObject_WMI_InstalledSoftware.tbasic
Line 43 triggers run time error
iDispatch_System.Net.WebClient.tbasic
In case the COM is not created, it could write the hint listed in comment
In help file:
Links to IsCOMNothing in See also section point incorrectly to IsNothing from Excel.
In the topic "Nothing", there is "It is always necessary to release an iDispatch variable if it is referencing to an object."
I think the object release is done once it runs out of scope now
ComObjPtr is not documented yet
In editor:
Codemax does not correctly highlight lines commented via //
I know Scintilla is the way for the future, but it is not 100% ready yet
With Scintilla
Ctrl+F does not display find dialog, but strange edit box
Ctrl+R does not allow replacing yet
Ctrl+G does not work yet, would be handy
Petr
Michael Hartlef
01-10-2017, 22:44
Where is the TB file hosted? I have about 95 MBit download speed and it takes TB about 5 minutes to download.
ErosOlmi
01-10-2017, 22:51
Web site and forum in Italy.
.biz is in the US Los Angeles
Michael Hartlef
01-10-2017, 22:51
I guess TB is not for me anymore. Before it was the Oxygen part that let my virus checker always act up, now it is thinAir.
ErosOlmi
01-10-2017, 23:20
Every time an AV software says it found a "*pack GEN" virus it means it found something just compressed and in the doubt it mark as virus.
There are no virus at all in thinAir and all other thinBasic executable or DLLs. All executable and DLL are produced by me from source code and I'm not a virus spreader.
They are just packed with UPX and this simple fact let some AV to mark them as possible virus.
I use Trend Micro Enterprise AV in all my computers.
I can guarantee it is one of the best.
Anyway, I've just submitted a false positive to Avira sending them 1.10.4 setup.
Will see
Ciao
Eros
ErosOlmi
01-10-2017, 23:37
I discovered few minor things to look into, once you have a minute:
In SampleScripts
iDispatch_Scripting.FileSystemObject_WMI_InstalledSoftware.tbasic
Line 43 triggers run time error
iDispatch_System.Net.WebClient.tbasic
In case the COM is not created, it could write the hint listed in comment
Fixed in ... next release
In help file:
Links to IsCOMNothing in See also section point incorrectly to IsNothing from Excel.
In the topic "Nothing", there is "It is always necessary to release an iDispatch variable if it is referencing to an object."
I think the object release is done once it runs out of scope now
ComObjPtr is not documented yet
Fixed in ... next release
In editor:
Codemax does not correctly highlight lines commented via //
I know Scintilla is the way for the future, but it is not 100% ready yet
With Scintilla
Ctrl+F does not display find dialog, but strange edit box
Ctrl+R does not allow replacing yet
Ctrl+G does not work yet, would be handy
Will not work on this because I will develop search/replace in Scintilla and then I will definitely remove CODEMAX
Thanks Petr
Petr Schreiber
02-10-2017, 07:51
Thanks a lot, Eros :)
@Mike - Avira is not a bad Antivirus, but in case such as this, it is common to notify the AV vendor that you think it is false positive and let them examine "manually".
Avast does this in few hours, I am sure Avira has similar mechanism.
P
ErosOlmi
02-10-2017, 19:59
I guess TB is not for me anymore. Before it was the Oxygen part that let my virus checker always act up, now it is thinAir.
Submitted the whole thinBasic setup 1.10.4
Here the result.
Ciao
Eros
9738
Michael Hartlef
03-10-2017, 10:10
Thanks for the info!
Petr Schreiber
09-10-2017, 18:25
Eros is too humble,
he did not even mention one very important thing he added to thinBASIC 1.10.4: it does not matter, what kind of line endings you use now ;)
CRLF or LF... thinBASIC handles this automagically now, which reduces headaches with Unix based version control systems (such as git).
Petr
ErosOlmi
09-10-2017, 19:53
I think I amended it in 1.9.16.17 when I introduced the possibility to #INCLUDE from HTTP/HTTPS like the following:
#INCLUDE ONCE "https://raw.githubusercontent.com/petrSchreiber/uniTest/master/uniTest.tbasicu"
I discovered that Github sometimes change standard $CRLF line terminator into something different.
That is nice to know. Redownloading TB as I managed to completely bork it last night.
ErosOlmi
31-10-2017, 22:18
I'm very close to release thinBasic Beta 1.10.5
New version will be focused on improving message handling in User Interface module.
Mainly I'm expanding the possibility to give a name to every controls (so far only available for Label, Textbox, Button and TreeView) and using that name plus the even name in callback functions it will be possible to trap specific events without the need to have big main window Select/End select cases for events.
In below example there are no callback declared in DIALOG NEW ... or CONTROL ADD ... but both Dialog and Controls has been declared with ... Name "..." ... clause that gives a name to the object like: "MyWindow", "txtFind", "CloseMe", ...
Creating a Callback function having function name equal to the Dialog or Control name followed by the event you want to handle is the only thing you need to add to do in order to trap a specific event ad act according to your needs.
I'm trying to add the most common events. Done that I will add more uncommon events.
More or less it will be like old VB6 events.
An example can show you what I mean. Also attached a Bundled example.
USES "UI"
uses "console"
'---Define a button ID
begin ControlID
%ButtonClose
%ButtonNew
%lblFind
%txtFind
%lblReplace
%txtReplace
end ControlID
Dim hDlg As DWORD
DIALOG New Pixels, Name "MyWindow", 0, "Dialog to show automatic events handling",-1,-1, 640, 480,
%WS_DLGFRAME Or %DS_CENTER Or %WS_CAPTION Or %WS_SYSMENU Or %WS_OVERLAPPEDWINDOW,
0 To hDlg
CONTROL ADD Label Name "lblFind" , hDlg, %lblFind , "Find" , 10, 15, 350, 20, %SS_NOTIFY
CONTROL ADD Textbox Name "txtFind" , hDlg, %txtFind , "" , 10, 30, 350, 25, %ES_AUTOHSCROLL | %ES_LEFT | %WS_BORDER | %WS_TABSTOP
CONTROL ADD Label Name "lblReplace" , hDlg, %lblReplace , "Replace" , 10, 55, 350, 20, %SS_NOTIFY
CONTROL ADD Textbox Name "txtReplace" , hDlg, %txtReplace , "" , 10, 70, 350, 25, %ES_AUTOHSCROLL | %ES_LEFT | %WS_BORDER | %WS_TABSTOP
CONTROL ADD BUTTON Name "New" , hDlg, %ButtonNew , "New" , 480, 10, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP
CONTROL ADD BUTTON Name "CloseMe" , hDlg, %ButtonClose , "Close" , 480, 40, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP
DIALOG SHOW MODAL hDlg
'------------------------------------------------
' Callback function used to handle dialog events
' not handled by specific event functions
'------------------------------------------------
CallBack Function MyWindow_OnCallBack() As Long
'------------------------------------------------
printl Timer, Function_Name, CBMSG, "DIALOG message not handled by specific event function"
End Function
'------------------------------------------------
CallBack Function MyWindow_OnInit() As Long
'------------------------------------------------
printl Timer, Function_Name
control set Resize CBHNDL, %ButtonNew , 0, 1, 0, 0
control set Resize CBHNDL, %ButtonClose , 0, 1, 0, 0
End Function
'------------------------------------------------
CallBack Function MyWindow_OnSize() As Long
'------------------------------------------------
printl Timer, Function_Name, CBWPARAM, HIWRD(CBLPARAM), LOWRD(CBLPARAM)
End Function
'------------------------------------------------
CallBack Function MyWindow_OnMove() As Long
'------------------------------------------------
printl Timer, Function_Name, CBWPARAM, HIWRD(CBLPARAM), LOWRD(CBLPARAM)
End Function
'------------------------------------------------
CallBack Function MyWindow_OnMoving() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnMouseMove() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnNCHITTEST() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnSETCURSOR() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnLBUTTONDOWN() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnLBUTTONUP() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnLBUTTONDBLCLK() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnNCMOUSEMOVE() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnNCMOUSELEAVE() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnCommand() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnClose() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnSHOWWINDOW() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function MyWindow_OnDestroy() As Long
'------------------------------------------------
printl Timer, Function_Name
PrintL "Window just destroyed. Press a key to end" in %CCOLOR_FLIGHTRED
WaitKey
End Function
'------------------------------------------------------------------------------
' BUTTON EVENT
'------------------------------------------------------------------------------
'------------------------------------------------
CallBack Function CloseMe_OnClick() As Long
'------------------------------------------------
printl Timer, Function_Name
DIALOG End CBHNDL
End Function
'------------------------------------------------
CallBack Function CloseMe_OnSetFocus() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function CloseMe_OnKillFocus() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function New_OnClick() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'CallBack Function CloseMe_OnCallBack() As Long
''------------------------------------------------
'
' printl Timer, Function_Name, CBMSG, "BUTTON message not handled by specific event function"
'
'End Function
'------------------------------------------------------------------------------
' LABEL EVENT
'------------------------------------------------------------------------------
'------------------------------------------------
CallBack Function lblFind_OnClick() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function lblFind_OnDblClk() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function lblFind_OnDisable() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function lblFind_OnEnable() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------------------------------------
' TEXTBOX EVENT
'------------------------------------------------------------------------------
'------------------------------------------------
CallBack Function txtFind_OnCallback() As Long
'------------------------------------------------
printl Timer, Function_Name, CBCTLMSG
Function = %TRUE
End Function
'------------------------------------------------
CallBack Function txtFind_OnChange() As Long
'------------------------------------------------
printl Timer, Function_Name, "text changed to", Control_GetText(CBHNDL, CBCTL)
Function = %TRUE
End Function
'------------------------------------------------
CallBack Function txtFind_OnUpdate() As Long
'------------------------------------------------
printl Timer, Function_Name
Function = %TRUE
End Function
'------------------------------------------------
CallBack Function txtFind_OnSetFocus() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function txtFind_OnKillFocus() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function txtReplace_OnChange() As Long
'------------------------------------------------
printl Timer, Function_Name, "text changed to", Control_GetText(CBHNDL, CBCTL)
Function = %TRUE
End Function
'------------------------------------------------
CallBack Function txtReplace_OnUpdate() As Long
'------------------------------------------------
printl Timer, Function_Name
Function = %TRUE
End Function
'------------------------------------------------
CallBack Function txtReplace_OnSetFocus() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
'------------------------------------------------
CallBack Function txtReplace_OnKillFocus() As Long
'------------------------------------------------
printl Timer, Function_Name
End Function
Petr Schreiber
31-10-2017, 22:58
Do like,
I never enjoyed those huge SELECT CASE monuments for filtering API messages :)
Petr
if you want you can make a thinbasic experimental version completely like VB6. you can host it in github site. in the days of vb6 it was nearly every day job to write something like this:
Private Sub Command1_Click()
For i = 1 To 1000
total = total + i
Next i
Text1.Text = total
End Sub
Text1 is the first Text Box, while Sub Command1_Click() is the click event of the first Button. the ""Private Sub Command1_Click()"" is opened automatically when we DBL click on the button in the vb6 Form designer.
this why is why in thinbasic i am using 2 codes : one for the GUI design (because its complexity and i don't want to see it any more) and the other for the everyday usage code such as my post here:
http://www.thinbasic.com/community/showthread.php?12715-Linguistics-research-with-ThinBasic
the controls and Dialog codes is so complex so it is better to hide it under easy to remember clothes and names. but this suggested approach will not run the old code. this is why i suggest it as an experimental and another flavor of thinbasic to put it in github site
ErosOlmi
02-11-2017, 17:46
Thanks a lot primo.
So far I'm working on handling "events" that is "Command1_Click()" firing.
But your suggestion on control.property (Text1.Text) is inspiring me on other fields.
As soon as I will finish on control events, I will think about control properties. Control Name is already there.
ErosOlmi
07-11-2017, 00:08
Quite exciting about new features I'm adding to UI (User Interface) module for the next thinBasic version.
Dialog and controls automatic event handling functions: just give a name to windows or controls and your will have a lot of function events ready to be personalized.
Dialog and controls properties: just give a name to windows or controls and you will have a lot of easy to be used properties to get/set
An example that will be available with next thinBasic 1.10.5 as soon and it will be ready and attached a working executable:
USES "UI"
'---Define a button ID
begin ControlID
%lblNum1
%txtNum1
%lblNum2
%txtNum2
%lblResult
%txtResult
%lblOp
%cbOp
%btnResult
%btnClose
end ControlID
string sOperations(4) = "+", "-", "*", "/"
dialog Font "Courier New", 12
DIALOG New Pixels , Name SimpleCalc, 0, "Basic calculator with events",-1,-1, 640, 380,
%WS_DLGFRAME | %DS_CENTER | %WS_CAPTION | %WS_SYSMENU | %WS_OVERLAPPEDWINDOW,
CONTROL ADD Label , Name lblNum1 , SimpleCalc.Handle, %lblNum1 , "Number 1" , 10, 15, 350, 20, %SS_NOTIFY
CONTROL ADD Textbox , Name txtNum1 , SimpleCalc.Handle, %txtNum1 , "" , 10, 30, 350, 30, %ES_AUTOHSCROLL | %ES_RIGHT | %WS_TABSTOP | %ES_NUMBER
CONTROL ADD Label , Name lblOp , SimpleCalc.Handle, %lblOp , "Operation" , 10, 60, 350, 20, %SS_NOTIFY
CONTROL ADD COMBOBOX, Name cbOp , SimpleCalc.Handle, %cbOp , sOperations , 10, 75, 350, 100, %CBS_DROPDOWNLIST | %WS_TABSTOP
CONTROL ADD Label , Name lblNum2 , SimpleCalc.Handle, %lblNum2 , "Number 2" , 10, 110, 350, 20, %SS_NOTIFY
CONTROL ADD Textbox , Name txtNum2 , SimpleCalc.Handle, %txtNum2 , "" , 10, 125, 350, 30, %ES_AUTOHSCROLL | %ES_RIGHT | %WS_TABSTOP '| %ES_NUMBER
CONTROL ADD Label , Name lblResult, SimpleCalc.Handle, %lblResult , "Result" , 10, 255, 350, 20, %SS_NOTIFY
CONTROL ADD Textbox , Name txtResult, SimpleCalc.Handle, %txtResult , "0" , 10, 270, 350, 30, %ES_AUTOHSCROLL | %ES_RIGHT | %WS_TABSTOP | %ES_READONLY
CONTROL ADD BUTTON , Name btnResult, SimpleCalc.Handle, %btnResult , "Result" , 480, 10, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP
CONTROL ADD BUTTON , Name btnClose , SimpleCalc.Handle, %btnClose , "Close" , 480, 340, 150, 25, %BS_NOTIFY | %BS_CENTER | %BS_VCENTER | %WS_TABSTOP
DIALOG SHOW MODAL SimpleCalc.Handle
'------------------------------------------------
' Callback function used to handle dialog events
' not handled by specific event functions
'------------------------------------------------
CallBack Function SimpleCalc_OnCallBack() As Long
'------------------------------------------------
End Function
'------------------------------------------------
CallBack Function SimpleCalc_OnLoad() As Long
'------------------------------------------------
'---Limits window minimum size
DIALOG SET MINSIZE SimpleCalc.Handle, 550, 320
'---Force resize logic
control set Resize CBHNDL, %btnResult , 0, 1, 0, 0
control set Resize CBHNDL, %btnClose , 0, 1, 0, 1
'---Select first element in combo operations
COMBOBOX SELECT SimpleCalc.Handle, %cbOp, 1
'---Some initial values
txtNum1.Text = "10"
txtNum2.Text = "20"
'---Change name to Close button
btnClose.Text = "Close Me"
End Function
'------------------------------------------------
' Function fired when SimpleCalc window will be closed
'------------------------------------------------
CallBack Function SimpleCalc_OnDestroy() As Long
'------------------------------------------------
MsgBox "Thanks for testing thinBASIC"
End Function
'------------------------------------------------
' Function fired when button Close is clicked
'------------------------------------------------
CallBack Function btnClose_OnClick() As Long
'------------------------------------------------
DIALOG End CBHNDL
End Function
'------------------------------------------------
' Function fired when drop down combo box is closed after a selection
'------------------------------------------------
callback function cbOp_ONCLOSEUP() as Long
'------------------------------------------------
CalculateResult
End Function
'------------------------------------------------
' Function fired when change selected item in a drop down combo box
'------------------------------------------------
callback function cbOp_ONSELCHANGE() as Long
'------------------------------------------------
CalculateResult
End Function
'------------------------------------------------
' Function fired when button Result is clicked
'------------------------------------------------
CallBack Function btnResult_OnClick() As Long
'------------------------------------------------
CalculateResult
End Function
'------------------------------------------------
' Function fired when text inside txtNum1 textbox is changed
'------------------------------------------------
CallBack Function txtNum1_OnChange() As Long
'------------------------------------------------
CalculateResult
End Function
'------------------------------------------------
' Function fired when text inside txtNum2 textbox is changed
'------------------------------------------------
CallBack Function txtNum2_OnChange() As Long
'------------------------------------------------
CalculateResult
End Function
'------------------------------------------------
' Calculate and fill txtResult textbox
'------------------------------------------------
Function CalculateResult() as ext
'------------------------------------------------
txtResult.BackColor = rgb(0, 255, 255)
select case cbOp.Text
case "+"
txtResult.Text = tstr$(val(txtNum1.text) + val(txtNum2.text))
case "-"
txtResult.Text = tstr$(val(txtNum1.text) - val(txtNum2.text))
case "*"
txtResult.Text = tstr$(val(txtNum1.text) * val(txtNum2.text))
case "/"
if val(txtNum2.text) Then
txtResult.Text = tstr$(val(txtNum1.text) / val(txtNum2.text))
Else
txtResult.BackColor = rgb(255, 0, 0)
txtResult.Text = "Div/0"
end If
end Select
function = txtResult.Text
End Function
Thanks Eros
txtNum1.Text = "10"
txtNum2.Text = "20"
this is what is needed, like the good old VB6
so i can hide the GUI complex code in an include file and in the working code i use the new syntax
hope also the same for the RichEdit box
but does the new version can't run the TB 1.10.4 examples or it will run the 1.10.4 examples and the newer 1.10.5 examples ??. or may be an option button in the Options settings gives the user the choice of new vb6 style or the TB 1.10.4 style
ErosOlmi
08-11-2017, 18:06
thinBasic is always (or quite always) compatible with the past.
So new features will not change anything and will remain compatible with old code.
It will be just a matter of programmer coding style
Petr Schreiber
09-11-2017, 01:13
Eros,
you are on fire. Thank you very much for another bucket of hard work :).
I have an heretic suggestion - what about making the ctrlId optional for named controls? Once somebody names the control, he will probably use this magic as much as possible and that ctrlId could be generated internally automagically. What do you think?
Petr
ErosOlmi
09-11-2017, 01:21
Great idea, as usual.
First I need to get most of all possible properties available.
Than I will make it optional.
So far I've added the following control properties, most of them bot SET/GET, some only GET (read only) to Buttons, Labels, Textbox, Combobox, Canvas, Dialogs:
Name
Text
Id
Parent
Handle
FORECOLOR
BACKCOLOR
X
Y
W
H
Also added many control and dialogs events.
I'm really excited. Once done code will really resemble VB6
Bad news is that it will take months to write help documentation :(
ErosOlmi
01-02-2018, 23:56
Just to let you know I'm working on thinBasic as much as possible to release new 1.10.5 version.
Problem is that I made e lot of changes into thinAir and I have some bugs quite weird to be resolved because they involve a lot of message handling of the new editor.
I added possibility to split scintilla windows and that added a lot of new messages to be properly handled ad I'm studying how to do it
Very soon a new release.
9808
[QUOTE=ErosOlmi;93649]thinBASIC 1.10.x.x
Download from: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.4.0.zip
Hello,
Please let me know if someone have encountered this problem (mentioned below), right after downloading this latest release:
"
Trojan:Win32/Bitrep.A
Affected items:
file: C:\Users\HP\AppData\Local\Temp\Rar$EXa0.900\thinBasic_1.10.4.0.exe
"
Curiously, when scanning the compressed (zipped) file, no problem.
This warning only happen when trying to extract the compressed file.
Because if this, was not possible to check this latest release (1.10.4.x).
But I've downloaded the previous release (1.9.16.17) and it is working fine.
Please advice.
Best Regards,
SBleck
ErosOlmi
06-03-2018, 19:49
Ciao,
to develop thinBasic I use Windows 10 and Microsoft Windows Defender (all latest versions)
I use thinBasic also in Windows 7 and Trend Office Scan AV
what AV are you using?
Thanks a lot
Eros
Petr Schreiber
06-03-2018, 20:16
Scanned with Avast Premier and also no issues found.
As Eros suggests, letting us know which solution triggers this false positive would be helpful.
Petr
Ciao,
to develop thinBasic I use Windows 10 and Microsoft Windows Defender (all latest versions)
I use thinBasic also in Windows 7 and Trend Office Scan AV
what AV are you using?
Thanks a lot
Eros
Hello,
Probably, the same as yours (Windows 10 Pro build 1703 with Windows Defender, active and updated). But, as like as I tried to say before, no problem right after downloading the latest release. Only when trying to extract it, to install it.
Please advice,
Sven
ErosOlmi
06-03-2018, 23:08
OK I confirm Windows Defender seems thinking thinBasic 1.10.4 has a virus.
Even on local copy on my computer.
As done in other cases for other AV software, I will try to submit to Windows Defender as false positive if I find how to do it.
For other AV in the past, after few days they released a new version.
Some weeks ago I uploaded a preliminar 1.10.5 version that has some problems in thinAir due to lot of changes not yet finished.
You can download from here: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.5.0.zip
It seems immune from this false positive
Let me know.
OK I confirm Windows Defender seems thinking thinBasic 1.10.4 has a virus.
Even on local copy on my computer.
As done in other cases for other AV software, I will try to submit to Windows Defender as false positive if I find how to do it.
For other AV in the past, after few days they released a new version.
Some weeks ago I uploaded a preliminar 1.10.5 version that has some problems in thinAir due to lot of changes not yet finished.
You can download from here: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.5.0.zip
It seems immune from this false positive
Let me know.
Ok, thanks for confirm that was a false positive and I will wait you finish this new release, of course too.
And I will give you a suggestion to be possible to upgrade these releases, from inside of your environment (thinAir), too.
Thanks in advance.
ErosOlmi
07-03-2018, 00:27
Sure, I will try.
So far there is just a version check:
9827
Sure, I will try.
So far there is just a version check:
9827
Hello,
Any news or was this latest release available, as described previously ?
Please comment.
Tks in adv.
ErosOlmi
18-04-2018, 07:14
If you want to try there is a 1.10.5 version I'm working on: https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.5.0.zip
It has a huge number of new features especially on UI module but not already documented.
Also almost completely re-coding thinAir to only use Scintilla Edit Control (https://www.scintilla.org/)
I'm working on that
catventure
18-04-2018, 10:52
oooh! I'm looking at PDF. Lots of very interesting stuff there, Eros. Really hope you can find time to get round to documenting/adding help for it all... :)
Hi Eros,
It seems a lot of work has done behind the scene. Thank you for your hard work. While inspecting the pdf you posted here, i've noticed the <Control Property GET/SET:<ControlName>.BackColor. I wonder how that works internally, especially when we used buttons. I mean, i am trying to do it in FreeBasic but i can't set my button back color. I can see that my buttons have a colored outline instead of a complete back color. These are the steps i followed.
Case WM_CTLCOLORBTN message,
Get dc_handle from wparam
SetBkMode(dc_Handle, Transparent)
SetBkColor(dc_Handle, myColor)
Set hBrush with CreateSolidBrush(myColor)
Return hBrush
ErosOlmi
18-04-2018, 21:12
Not all properties are available for all controls.
Button is one of those that do not allow changing colors.
Have a look at attached personalized XPButton create by Jose Rocha years ago.
It is Power Basic code, not far from FreeBasic code. Maybe you can get ideas.
You can also see thinBasic example of XPButton integration executing scripts in \thinBasic\SampleScripts\UI\XPButton\
Ciao
Eros
Hi Eros,
Thanks for the reply.
I saw the xpButton in sample scripts. Let me study the Josep Roca's code. :)
José Roca
18-04-2018, 22:39
XpButton is available in my WinFBX framework for PowerBasic. It has been implemented a class in the file CXpButton.inc.
BTW I wrote it to demonstrate the use of visual styles, not to change the button background color. I never have had any interest in colored buttons or other controls because they can look horrible if the user selects a different theme.
ErosOlmi
19-04-2018, 07:36
Attached an old code I took from PowerBasic forum years ago.
It shows how to own draw a button.
Code is to adapt to your needs but can show how to draw a button
Also found this thread that can help: https://forum.powerbasic.com/forum/user-to-user-discussions/powerbasic-for-windows/46476-ownerdraw-buttons?t=45331&highlight=ownerdraw+button
As José said ... results can be horrible :)
@Josep Roca,
Thanks for the reply. I know that it looks horrible when you change the system theme. But I want to make a custom button control just for a practice. I just tried and experimented with the code you posted on FreeBasic forum. It worked but the back color is only changed behind the button text area, not the full rect of button. By the way, i have some questions related to CWSTR.inc Which is the best forum to ask it ?
@Eros Olmi,
Thanks for the code sample and the link. Let me check. :)
José Roca
19-04-2018, 20:49
> By the way, i have some questions related to CWSTR.inc Which is the best forum to ask it ?
http://www.planetsquires.com/protect/forum/index.php
ReneMiner
21-04-2018, 08:36
myWindow(1).Caption = myBMP(1).Filename
Can just read but not try out yet.
Just one thing: old vb6-controls (and windows) also had an Index so if we have let's say a few windows of the same type that show a bitmap where we draw unto then it was possible to give them all the same name only they had different indexes so these windows can share the same subs or functions. For the event-subs it's easy the user just might use one of the 4 user-values attached to every UI-"object", but if you think about setting properties:
Text1(1).Text = "Hello"
Text1(2).Text = "world!"
it would be worth to think about to add an index-property to all UI-things that have a name also
Dear All,
I have problems with McAffee when running Thinbundle, any ideas??
KR
Axel
ErosOlmi
20-06-2018, 19:45
It is a continuous fight against AV.
I published a 1.10.5 just yesterday evening because at work we had problems with Trend AV. I made a few changes in thinBundle and it worked.
Download from https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.5.0.zip
and see if this solve the problem
This is an unfinished version of 1.10.5 but should not cause any problem.
Let me know
Eros
Hi Eros,
on my PC it's McAffee, and yes the Bundle Problem is solved but after that McAffee blocks the bundled program (included DLL's)
KR
Axel
ErosOlmi
21-06-2018, 09:28
Can you send AV details to support@thinbasic.com
So I can check and try to do something.
Thanks
Eros
Thanks Eros for the new TB version 1.10.5.0. i think its new IDE is better than before
i will check ..
ErosOlmi
21-06-2018, 11:33
Among many other things, I introduced thinAir themes :D
When inside the editor, right click and at the bottom you will find "Themes ..." menu.
I and Petr have developed some themes you can change on the fly.
You can also add new themes copying one you will find into themes directory and making changes.
It is all very experimental and I wanted to finish before releasing but seems working fine.
IMPORTANT: do not touch default theme because all aspects not changes in personalized theme will be taken from default one.
9852
ErosOlmi
21-06-2018, 11:38
Can you send AV details to support@thinbasic.com
So I can check and try to do something.
Thanks
Eros
I got the mail but I do not see any error coming from AV
Does it just block without any error/warning or indication of what was the threat?
Does the bundled exe size is correct or it is just few KB file?
Thanks
Eros
ErosOlmi
21-06-2018, 11:57
Sorry, got it.
I was looking mail from mobile phone and didn't see the image at first
Problem seems in thinBasic_ini.dll module.
the themes idea is great. i have tested all. since i have a bad eyes vision, changing from theme to other will relief the eyes.
no problem.
But my message is also incomplete, all involved Module (_file, _ftp, _console, _ini) are listed in teh event lock. When I do a manuall scan with this files no problems are reported.
KR
Axel
ErosOlmi
21-06-2018, 22:08
the themes idea is great. i have tested all. since i have a bad eyes vision, changing from theme to other will relief the eyes.
Great. I will remove thinAir options regarding colors/fonts/... and will develop a theme editor
So far you have to copy a theme into another xml file and manually edit it.
ErosOlmi
21-06-2018, 22:11
no problem.
But my message is also incomplete, all involved Module (_file, _ftp, _console, _ini) are listed in teh event lock. When I do a manuall scan with this files no problems are reported.
KR
Axel
I have update .10.5 at https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.5.0.zip
Nothing special, just changed the way needed modules are extracted from bundled exe and saved to disk.
Hopefully this new way will let the "adaptive behave detection" of the AV engine think it is a little less risky, bu not sure.
Hi Eros,
I've tested it but I received the same messages for the bundled application
KR
Axel
ErosOlmi
22-06-2018, 11:47
OK thanks.
It was a try.
I have to think of a new method to "extract" DLLs from a bundled exe.
I was looking at some McAfee docs about Adaptive Protection: https://kc.mcafee.com/corporate/index?page=content&id=KB88482#SP
Do not know if I will have something in the short period. I have to study well how this Adaptive Protection works and understand what behave is blocked by McAfee.
In the meantime if you have some parameters you can change in you AV system ...
Let me know if you discover something.
i want to display a Russian characters with msgbox but i get a gibberish chars. then i have tried msgboxW and it works
string a
a = "девочки"
'a = "girls"
msgboxW 0, a ' works
msgboxW 0, Mid$(a,1,1) ' does not work
msgbox 0, a ' does not work
msgbox 0, Mid$(a,1,1)
my window is XP/english
how i get the first character of the "девочки"
notes: the new IDE is excellent since it seems capable to display any language
how i get the first character of the "девочки"
This seems to work, displaying the characters of "девочки" one by one:
string a, c
long i
a = "девочки"
for i=0 to 6
c = Peek$(STRPTR(a)+(i*2),2)
msgboxW 0, c ' works
next
i: is the position of the character. i expect the one char = 2 bytes. but this is may be more for some languages.
ErosOlmi
26-06-2018, 14:12
I have to develop many string functions specific for wide strings.
Maybe a new string type too: wide string type.
Petr Schreiber
08-07-2018, 15:08
Eros does excellent job on the development of 1.10.5.0, just have a look at the brutal amount of new features in What's new section of help file!
Should you need some adjustment of vim Zenburn theme, let me know, as I am preparing this one.
Petr
Thanks Petr
i switch themes too much, since nowadays i have a bad vision, i have tested the
vim Zenburn theme it seems good for the eyes, sometimes i need lighter background for a few minutes, i also make the fonts big such as 13
you and Eros have made big things with the IDE, also Zoom+/- is handy.
this one may be good but not all the time:
9864
<editor>
<style name = "default">
<item name = "color.background">100,100,100</item>
<item name = "color.foreground">0,205,255</item>
<item name = "font.size">14</item>
</style>
<style name = "comments">
<item name = "color.foreground">227,159,127</item>
</style>
<style name = "keywords">
<item name = "color.foreground">240,223,15</item>
<item name = "font.bold">true</item>
<item name = "font.weight">300</item>
</style>
Eros does excellent job on the development of 1.10.5.0, just have a look at the brutal amount of new features in What's new section of help file!
Petr
Hi Petr,
I cant find any download link for version 1.10.5.
ErosOlmi
08-07-2018, 21:39
Not yet out officially because I still have to document and fix some issues but if you are brave :D
https://www.thinbasic.biz/projects/thinbasic/thinBasic_1.10.5.0.zip
In post 96 of this thread some info on new thinAir themes option
http://www.thinbasic.com/community/showthread.php?12778-thinBasic-1-10-x&p=94288&viewfull=1#post94288
@Eros,
Thank you. Just downloaded. :D
i suggest the new thinbasic ide which are based on scintella have the option
File->Encoding->ASCII
File->Encoding->UTF-8
so the strings we write in the IDE go to its variables in the form as needed. this is what was in purebasic in v5.46LTS before turning to a complete unicode which many users don't like.
about the scintella editor look:
https://groups.google.com/forum/#!topic/scintilla-interest/MGUBrMrHKQg
ErosOlmi
26-07-2018, 11:28
Will try for next update
Hi Eros,
When you update the file encoding section, please include a "Default Encoding" option.
here is how i run the new thinAir and the Old thinair :
install thinbasic 1.10.5 from the link at the top of this page.
rename the thinAir folder to thinAirNEW, and make a shortcut for this file : C:\thinBasic\thinAirNEW\thinAir.exe as thinAirNEW
copy thinAir folder from the old installation of v1.10.4 to the new thinbasic installation folder and rename it as thinAirOLD and make a shortcut to its thinAir.exe file as thinAirOLD
look the picture:
9873
so you can run the new scintella IDE which support unicode and the old IDE which suport asci
what is important is that every version of thinAir loads its own open files
ErosOlmi
15-10-2018, 21:48
thinBasic updated to version 1.10.5.0
See first post of this thread for more info: https://www.thinbasic.com/community/showthread.php?12778-thinBasic-1-10-x
ReneMiner
15-10-2018, 22:05
Just one word:
Wow!
ErosOlmi
15-10-2018, 22:27
Thanks René.
Hope you will be able to get a PC and return to program with your great and inspiring thinBasic applications.
ErosOlmi
15-10-2018, 23:22
I will make few posts during the week showing (by making script examples) some of the new features developed in version 1.10.5.0
ReneMiner
16-10-2018, 08:21
Just a question - or thought - to the statics, assigned during type-definition.
If type t2 extends type t1 and both have a static x1 of same type, same name and same value because x1 was defined and assigned in type-definition of t1, but both also have a static x2 that is defined and assigned in both types separately -
isn't that the exactly same mechanism as internally assigning the function-pointers when type-functions are encountered by parser?
I remember those type-function-names were static udt-members in the very beginning of Udt-functionality:
https://www.thinbasic.com/community/project.php?issueid=440..
ErosOlmi
16-10-2018, 11:55
Ciao René,
on inherited UDT and static elements initialization I'm still working.
I will let you know in next days when I will have more clear ideas. I will study what other languages (.Net languages for example) behaves.
Eros
Michael Hartlef
16-10-2018, 20:08
Great job Eros. I admire your motivation and stemina to keep on working on TB.
Petr Schreiber
17-10-2018, 07:44
thinBasic micro book on UDTs (https://thinbasic.github.io/book-thinbasic_user_defined_types/chapter_01-01-elements.html) updated to cover the STATIC initialization :cool:.
Eros, this is such a huge release. Just the codePtr opens mountain of new possibilities, AppConfig brings easy standardised way for script configuration.
Thank you :drink:,
Petr
ErosOlmi
17-10-2018, 11:36
Thanks Petr,
I will add to official help asap.
I developed AppConfig because at work I have a lot of scripts that loads application configuration parameters from XML file and every time I had to include a lot of code just to read them.
So I decided that a conjunction of an XML file with an hash table could be the perfect marriage to have all parameters loaded in one go into a script class and be accessed with a simple key level nodes string.
ErosOlmi
17-10-2018, 21:20
OK, I think thinBasic 1.10.x.x beta version phase as lasted even too much.
I've developed so many new features in this beta that it is time to close it and publish this release as stable.
Still to decide what version number to give to final stable release. Maybe just 1.11 :)
I will wait around 2 weeks in order to see if any bug will discovered and I will fix.
In the while ... I will try to finish missed documentation and next version will be the last.
Thanks to all.
Eros
Mike83200
18-12-2018, 11:51
Hi, all.
First : Apologies for my bad english...
2nd : French characters does not work properly between Source Code and windows (MsgBox or Dialog)... But I think you are working about this...
3rd : Function 'Replace' or 'Ctrl+R' (From menu/edit) does not work.
4th : When we have many source in use (in ThinAir), some disappear when we click on it (left side of the window of ThinAir : Code Browser).
Best regards
Mike F-83000.
I will try to finish missed documentation and next version will be the last.
Eros
does that mean you will stop development on ThinBasic?
DirectuX
18-12-2018, 16:33
does that mean you will stop development on ThinBasic?
Interresting, i had it understood as the last beta. Hope I'm right.
catventure
18-12-2018, 17:54
Does anyone actually know where Eros is? Haven't seen him around for a while here. Busy working I would imagine, or perhaps not well?
I do hope he has not abandoned thinbasic! Surely not?
ErosOlmi
18-12-2018, 21:24
Does anyone actually know where Eros is? Haven't seen him around for a while here. Busy working I would imagine, or perhaps not well?
I do hope he has not abandoned thinbasic! Surely not?
Ciao,
up and quite well :D
Just busy at work, sorry.
From Sept to Dec the company I work for does 45% of annual income so we cannot miss this moment.
Abandoned thinbasic? Be sure: it will NEVER happen.
It's my passion and I'm having also great success at work developing solutions in many cases much faster than any other development environment especially data exchange between external systems and in house systems.
Next week I will have some rest and will start to read all forum posts I missed, sorry about that.
I will publish a new version by end of the year with some new features I'm finishing to work on.
Ciao
Eros
catventure
19-12-2018, 15:41
Hi Eros,
Thanks for putting things straight, Eros. I'm pleased to hear all is OK and that you intend a new release soon, :D
ErosOlmi
19-01-2019, 15:21
Released thinBasic 1.10.6
See first post of this thread.
Ciao
Eros
ErosOlmi
19-01-2019, 22:45
If you have already downloaded version 1.10.6 before this message, please download it again.
There was a problem with TBGL module now fixed: https://github.com/ThinBASIC/thinBasic_TBGL/pull/8
Petr Schreiber
19-01-2019, 23:01
There are some nice additions to TBGL, thanks to input (and testing) from DirectuX.
For example:
- tbgl_mouseGetPosX & tbgl_mouseGetPosY now can map to tbgl_renderMatrix2D coordinates
- new attempt at "pixel perfect" 2D mode, still in progress, but some nice results already
Additionally, I removed the need to call tbgl_resetKeyState for common scripts.
You can check all the new stuff in this example:
uses "tbgl"
begin const
%WIDTH = 640
%HEIGHT = 480
end const
function tbMain()
double frameRate
' -- Create and show window
dWord hWnd = tbgl_createWindowEx("TBGL script - press ESC to quit", %WIDTH, %HEIGHT, 32, %TBGL_WS_WINDOWED | %TBGL_WS_DONTSIZE | %TBGL_WS_CLOSEBOX)
tbgl_showWindow
tbgl_showCursor false
long x, y
' -- Main loop
while tbgl_isWindow(hWnd)
frameRate = tbgl_getFrameRate
tbgl_renderMatrix2d(1, 1, %WIDTH, %HEIGHT, %TBGL_PIXEL_PERFECT_2D) ' -- New switch for pixel perfect 2D
tbgl_clearFrame
' -- Draw cursor cross, if mouse moves over window
if tbgl_mouseInClient then ' -- New function to check for mouse presence in window
x = tbgl_mouseGetPosX(%TBGL_2D) ' -- This override applies coordinate system transformation from renderMatrix2D
y = tbgl_mouseGetPosY(%TBGL_2D)
tbgl_line (x, 1, x, %HEIGHT)
tbgl_line (1, y, %WIDTH, y)
end if
tbgl_drawFrame
' -- ESCAPE key to exit application
if tbgl_getWindowKeyState(hWnd, %VK_ESCAPE) then exit while
wend
tbgl_destroyWindow
end function
Petr
ErosOlmi
26-05-2019, 11:56
Released thinBasic 1.10.7
See first post of this thread.
Ciao
Eros
Petr Schreiber
26-05-2019, 16:24
Eros, cannot thank you enough for the thinAir tweaks - CTRL+L & smart code browser are excellent helpers :)
For fans of ThinBASIC - we have now an official Twitter account, where release announcements (and useful links) will be posted:
https://twitter.com/thinBasicTeam
Petr