'Shapes', 'Eval', 'DotNet Interop', ... : An extension for Small Basic
- I've made in VB.NET an extension for Small Basic (to place in a 'lib' folder you must create within the Small Basic installation directory).
This extension allows :
- To use all DotNet Types, Subs and Functions in Small Basic, as well as events.
- To add events on controls (button, textboxes, ...) and shapes (ellipses, polygons, ...)
- To use an 'EVAL' function, and 'SmallBasic events'
- To have more than one GraphicsWindow at a time (using MultipleInstancesApplications or MIA)
- To use XML documents
- To run functions asynchronously, and create timers.
- ...
You can download the Interop source code (not the latest version) at :
http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/FC.SmallBasic.Complements.zip
[EDIT]
You can find more info on the wiki of Small Basic at '/Ressources/Fremy's extension'
To install my extension, you need to unzip this file in the 'lib' folder of Small Basic : Public/Small Basic/ folder of my SkyDrive
To download the help related to my extension : Help.zip
[/EDIT]

Fremy VB & C#- Edited byFremyCompanyAnswererTuesday, December 30, 2008 3:11 PMUpdate the post for the new versions
- Edited byFremyCompanyAnswererSaturday, April 25, 2009 5:07 PMLink to help
- Edited byFremyCompanyAnswererTuesday, February 24, 2009 3:20 PMNew version for v0.3.1
- Edited byFremyCompanyAnswererThursday, December 25, 2008 4:34 PMLine numbers where just before the code, with no marge
- Edited byFremyCompanyAnswererFriday, December 26, 2008 10:38 PMNew functionnalities
- Edited byFremyCompanyAnswererThursday, December 25, 2008 11:24 PM
- Edited byFremyCompanyAnswererFriday, April 17, 2009 12:51 PMNew version
- Edited byFremyCompanyAnswererWednesday, December 31, 2008 1:30 PMAdding images
All Replies
- * [EDIT=25/12/08-21:15-Brussel]
I've uploaded a new version that support more functionnalities :
- easier : using native Arrays and Collections, and conversion to Small Basic 'arrays'
- added : a function to cleanup the whole interop cache
- added : support for delegates and delegate conversion
[/!\ There's some problems with Timer, ...]
- fixed some bugs
* [EDIT=26/12/08-00:10-Brussel]
Changelog :
- added : Language.Eval
* [EDIT=26/12/08-23:30-Brussel]
Changelog :
- added : The 'Shapes' class for using Shapes, Button and TextBoxes easily and with Events !
- renamed : The 'Language' class has been renamed to 'SmallBasic'
- added : Gesture of Events, AsyncCall, Timers, ... in 'SmallBasic'
- added : SmallBasic simple reflection in 'SmallBasic'
- added : Possibility to call a sub from its name and have a return value using the 'Stack' object
- better interop : automatic avoiding of memory leak due to small objects (string, numbers, ...)
- fixed some bugs
* [EDIT=30/12/08-16:13-Brussel]
Changelog :
- [BETA] Create MultipleI nstances Applications (MIA)
- XMLDocument API
- fixed some bugs
- ...
Fremy VB & C#- Edited byFremyCompanyAnswererFriday, December 26, 2008 10:35 PMNew update
- Edited byFremyCompanyAnswererTuesday, December 30, 2008 3:13 PMNew version uploaded
New version to be uploaded soon (sorry, I must really go out now, so I'll do this later) :
- Possibility to apply a skin the window's controls (Vista, XP, ...)
- Read/Write XML documents
- New controls (CheckBox, ...)
- ...
Fremy VB & C#- Very nice, FremyCompany. Would it be possible for you to upload this in the resources section of our Small Basic wiki? http://smallbasic.com/wiki
Thanks - The new version has now been updated, and I've created some links from the wiki, as you've asked.
I also have published some more samples, too.
I hope people will like the extension.
Fremy
Fremy VB & C# - New update :
- Some new functions (MathEval, ...)
- Fixed a lot of small bugs
This will normally be the last version for Small Basic v0.2, because
- It's stable now
- I don't plan to add new functionnalities as of now
Fremy VB & C# - VERSION 3.0 BETA OF MY EXTENSION
I'm happy to say that my extension is now compatible with v0.3.1 of Small Basic .
It needed some changes, but I runned all my test cases with no problem on my computer, so I hope it's quite stable.
Please note that using my extension currently can braek some applications since it replaces the 'Shapes' Object, and it's possible that some methods are missing or using another name or syntax. I'll try to have full compatibility for the next release.
The next release will also have a 'Settings' Object where you can save settings for you application that get saved when the application exits and reloaded when the application loads !
Fremy VB & C# - FremyCompany,
I tried to get the extension to work, but it doesn't. I downloaded FC.dll from the Wiki. I created a lib folder where the small basic .exe is. I put the FC.dll in the lib folder. I then tried to run your 1st sample file, but it doesn't recognize any of the new methods. I'm pretty sure that Small Basic knows the lib folder is there because if I delete the FC.dll then small basic crashes while trying to load. Also, shouldn't there be an XML file that you need to add for the intellisense to work with the new methods?
Thanks,
JR - Yes, you need a .xml file, too.
You should use this ZIP file for the last version of my library :
http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/lib.zip?wa=wsignin1.0&sa=679540255
Bear in mind that my API is still in BETA phase. I'll publish a new version in the begin of April.
If you still encounters problems, please feel free to talk about it here.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - FremyCompany,
The Zip worked alot better. I did find that I was downlevel. I was at .30 and needed to reload to get to .31. I can now see the Shapes.AddButton in Intellisense. I then tried to run the first sample in the Wiki. It says it can't find the GraphicsWindow.AnimateShape method. Intellisense doesn't show it either. I see this needs to be changed to Shapes.MoveAsAnimation. So the program on the Wiki needs to be changed. The other problem I had was with the Shapes.AddImage("ApplIcon.png"). I didn't have that so the program would just bomb. I just substitued another .png file and then everything worked. You might want to put a comment in the sample program for this.
Is there a document that details your new objects and methods?
This setup is really nice!
Thanks for your help!
JR- Edited byjricestk Friday, March 13, 2009 1:03 AMChange Comments
- Yes, I need to modify all my samples.
I'll do this for Small Basic v0.4 (that you can expect for a few time, now) because a lot of things have changed since the last publishet build, due to some changes I needed to do to comply with a better v0.3.1 compatibility, and those I'll do for v0.4.
There's currently no document that show all the methods added by my extension. I plan to make one as much the v0.4 will be out, too.
So, keep updated :)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - FremyCompany,
I tried the second sample program from the Wiki which is your XML examples. Is the method (Xml.LoadXMLFile) supposed to work at the 3.1 level? Of course I don't have the file that you are using in the sample program so I just substituted an XML file that is on my machine. When I do that, in the Doc container I just get (obj://1)if I do a textwinndow.writeline(doc). I also wrote doc out to a file and looked at it with notepad and there isn't anything else in it. So, I'm not sure if it isn't working at the 3.1 level or if I am doing something wrong.
Thanks,
JR - Here's the XMLFile I use :
<root> <bag name="1"> <item name="a" /> <item name="b" /> <item name="c" /> </bag> <bag name="2"> <item name="d" /> <item name="e" /> </bag> </root>
The document get parsed as any XML document, after that.
If you aren't familar to XML, I recomend you to find more information on the web on it.
BTW, all my samples (and needed files) will be availabe (and updated) in the reference document about my API.
It's possible that I'll publish it before v0.4 out, but I'm unsure of it.
Fremy
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - FremyCompany,
Your sample file got me started.
Thanks,
JR - New version, compatible with v0.4 !
Changelogs (I may forget some things) :
- Clipboards object
- DataFile & Settings gestion
- ColorObject (some functions to handle colors)
- Dialogs (some common dialogs to show or ask things to the user)
- Many bugfixes and new subs in the old objects like Shapes, ...
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - Very nice, Fremy. Can I download the new version from the Small Basic wiki?
- Oops ! I've forgotten the wiki.
I'm going to update. Currently, there's only the download link in this thread.
[EDIT] I just have seen I didn't mention the existance of a new control : the WebBrowserControl.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension Maintenance update :
* Fixed some bugs
* Added support for Semi-transparent color in Small Basic
* Added Controls.SetImageSource
The download link is still the same
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension- FremyCompany,
Do you have an example for the datafile methods. I tried them and did get them to work, but was wondering if you had an example to review. I looked on your skydrive and didn't see anything there.
Thanks,
JR - > Dézipper le fichier http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/Help%20archive.zip
> Dézipper le fichier Help - Extension.ZIP conçernant mon extension dans un dossier
> Ouvrir le fichier index.html
C'est la documentation de mon extension, il y a surement un exemple qui parle des fichiers de données.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension Var1 = "<Variable/>" Array.SetValue("Arr", "=", "Hello") Stack.PushValue("Stk", "!") F = DataFile.CreateNewFileWriter("Data.dta", "True") DataFile.WriteVariable(F, Var1) DataFile.WriteArray(F, "Arr") DataFile.WriteStack(F, "Stk") DataFile.CloseDataFile(F) F = DataFile.CreateNewFileReader("Data.dta") TextWindow.WriteLine(DataFile.ReadVariable(F)) DataFile.ReadArray(F, "Arr2") TextWindow.WriteLine(Array.getValue("Arr2", "=")) DataFile.ReadStack(F, "Stk2") TextWindow.WriteLine(Stack.PopValue("Stk2"))
Here's the sample I've found in my documentation (the link I provided).
But in the documentation, it's syntaxicaly colored, and you have some additional remarks.
Each function have a description and (sometimes) additional informations related to them (how it works, how you should use it, ...)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension- FremyCompany,
Thanks again! Also, I have been wondering if it is possible to add a feature to Small Basic that would add an apostrophe to the front of a selected block of code and then remove the apostrophe if it is selected again? This would be just like it does in Visual basic. Or, maybe use a letter sequence like /* and */ to block out lines of code that would then not be used by the compiler? I've seen this approach done in some other languages. And while I'm dreaming how about using a character like _ this as a line continuation character so that you don't have a line of code running beyond the editing screen?
I think both of these would be great features for Small Basic, but I don't know if it can be done via an extension or not.
Thanks,
JR - It can't be done because I can't edit the compiler. Even if I can write another compiler for Small Basic... I already have tried it, but Small Basic detects that I've modified the compiler (not signed by microsoft) and won't run.
I've also tried to rebuilt the whole program, but I had some problems....
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - Maintenance update :
- ColorObject renamed to Drawings
- Added many methods to Drawings
>> Modification of images
>> Saving an image to a file
>> ...
The download link is still the same.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension Updated for v0.5
* http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/lib.zip
* SmallBasic.TextWindow_ReadKey() added in response to a thread's request
Please note that many functions will now take advantage of the new Array system, but it breaks many old applications.
I run my (modified) test cases and found no problem. If you encounter any problem, feel free to post a message here.
The documentation will be updated in few day.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension- Maintenance update :
- Fixed some bugs
- The Instances Object is now quicker
The download link is still the same
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - Maintenance update :
- SmallBasic.Eval now support arrays as v0.5 does !
- Instances.EvalCode allows you to execute SmallBasic code on another instance
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - Small update :
- FTP.DownloadFile / FTP.UploadFile
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - Fremy
Will you be updating your extensions to work with version 0.6? - Give me one or two days to do the update ;-)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - Sorry Fremy I did not mean to pressurise you, I was just enquiring, as you extensions are a great addition to smallbasic.
Sorry Fremy I did not mean to pressurise you, I was just enquiring, as you extensions are a great addition to smallbasic.
No problem ;-) I don't feel enforced at all. I was just giving you the time I need to update my extension (if there's no bad surprise !)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension- Maintenance update for 0.6 :
* No new feature at this time.
* I don't have tested the whole API, as everything
should continue to work. If you encounter a bug,
please tell it.
http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/lib.zip
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension Fremy
I am trying to use your controls.addcheckbox but I can't test for the checkbox for example;
chkbx1=Controls.AddCheckBox("ticked")Program.Delay(6000)
If chkbx1 = "True" Then
Dialogs.ShowMessage("Ticked")
EndIf
Dialogs.ShowMessage("Not Ticked")
If I tick the box I still get the "Not ticked" message.
I am using v0.6chckbx1 doens't contains the *value* of the textbox, in fact, but its name (the same way Shapes.AddImage does).
You should use Controls.GetChecked to retreive the state :
chkbx1=Controls.AddCheckBox("ticked")Program.Delay(6000)
If Controls.GetChecked(chkbx1) = "True" Then
Dialogs.ShowMessageAsInformation("Ticked")
Else
Dialogs.ShowMessageAsWarning("Not Ticked")
EndIf
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extensionMaintenance update for 0.6 :
Small bug fixes in Dialogs / Controls :
* Error when GraphicsWindow was not opened at least a time.
* Dialogs were not modal
Download link is still the same
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extensionMinor update :
* Added Controls.AddMultilineTextBox
* Better performance (using Code Optimisation of Visual Studio, since no debugging is needed)
This version should be flagged as 2.1. Previous version was 2.0.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension- Minor update (v2.2) :
* Added Controls.ElementFromPoint to get an element from its position
* SetBackground now works on TextBoxes. SetBorder still fails, however.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension - Minor update (v2.3) :
* Added compatibility with 0.7.
* Dropped compatibility with 0.7.
(@Vijaye : The problem I had was that the 'Version specific' flag on the SmallBasicLibrary.dll reference was set to false)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension


