Fremy's Extension : Add support for Controls, Drawings, Code evaluation and .Net Interop
-
Thursday, December 25, 2008 4:31 PMI'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 by FremyCompany Monday, June 14, 2010 8:51 AM "Shapes" is not longer an FC extension, it's built-in in Small Basic
All Replies
-
Thursday, December 25, 2008 8:18 PM* [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 by FremyCompany Tuesday, December 30, 2008 3:13 PM New version uploaded
-
Saturday, December 27, 2008 3:01 PM
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# -
Saturday, December 27, 2008 7:32 PMModeratorVery 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 -
Sunday, December 28, 2008 3:23 PMThe 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# -
Saturday, January 03, 2009 9:26 AMNew 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# -
Tuesday, February 24, 2009 3:27 PMVERSION 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# -
Thursday, March 12, 2009 2:14 AMFremyCompany,
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 -
Thursday, March 12, 2009 4:35 PMYes, 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 -
Thursday, March 12, 2009 8:20 PMFremyCompany,
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 by jricestk Friday, March 13, 2009 1:03 AM Change Comments
-
Friday, March 13, 2009 9:50 PMYes, 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 -
Saturday, March 14, 2009 12:48 AMFremyCompany,
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 -
Sunday, March 15, 2009 4:09 PM
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 -
Sunday, March 15, 2009 10:56 PMFremyCompany,
Your sample file got me started.
Thanks,
JR -
Friday, April 17, 2009 12:54 PMNew 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 -
Friday, April 17, 2009 7:33 PMModeratorVery nice, Fremy. Can I download the new version from the Small Basic wiki?
-
Friday, April 17, 2009 7:39 PMOops ! 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 -
Monday, April 20, 2009 5:34 PM
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 -
Wednesday, April 22, 2009 1:13 AMFremyCompany,
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 -
Wednesday, April 22, 2009 3:39 PM> 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 -
Wednesday, April 22, 2009 3:44 PM
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 -
Wednesday, April 22, 2009 7:00 PMFremyCompany,
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 -
Wednesday, April 22, 2009 7:56 PMIt 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 -
Saturday, April 25, 2009 1:44 PMMaintenance 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 -
Monday, June 22, 2009 8:33 AM
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 -
Monday, June 29, 2009 9:39 AMMaintenance 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 -
Monday, June 29, 2009 11:44 AMMaintenance 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 -
Tuesday, August 11, 2009 10:24 AMSmall update :
- FTP.DownloadFile / FTP.UploadFile
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Thursday, August 20, 2009 12:34 PMFremy
Will you be updating your extensions to work with version 0.6? -
Thursday, August 20, 2009 2:04 PMGive me one or two days to do the update ;-)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Thursday, August 20, 2009 2:32 PMSorry Fremy I did not mean to pressurise you, I was just enquiring, as you extensions are a great addition to smallbasic.
-
Thursday, August 20, 2009 2:34 PM
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 -
Friday, August 21, 2009 7:35 PMMaintenance 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 -
Saturday, August 22, 2009 12:11 PM
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.6 -
Saturday, August 22, 2009 12:21 PM
chckbx1 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 extension -
Saturday, August 22, 2009 1:36 PM
Maintenance 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 extension -
Saturday, August 29, 2009 8:31 AM
Minor 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 -
Monday, August 31, 2009 11:10 AMMinor 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 -
Saturday, November 07, 2009 4:30 PMMinor 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 -
Wednesday, January 06, 2010 10:13 PMI need help with the dialogs.askforlogincredentials command. I cannot figure out how use it to password protect a program. I also need help with controls.addbutton. I can't figure out how to open a dialogs.askforsavelocation when the button is clicked.
-
Thursday, January 07, 2010 8:47 AMAskForCredentials shows up a dialog which ask for an username and a password.
Then, it return a string containing "UserName:PassWord".
You can then check
If (Dialogs.AskForCredentials()=="Admin:passX") Then
IsAdminConnected = True
EndIf
and then latter check in your app
If IsAdminConnected Then
'...
Else
Dialogs.ShowErrorMessage("You need to be connected as admin to perform that action")
EndIf
For the button :
Button1 = Controls.AddButton("Connect user", 150, 24)
Controls.RegisterMouseDownEvent(Button1, "Button1_MouseDown
And the sub would be
Sub Button1_MouseDown
' What to do when the button is pressed
EndSub
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension- Edited by FremyCompany Thursday, January 07, 2010 9:12 AM Converting @ to :
-
Thursday, January 07, 2010 11:52 PMThanks
-
Thursday, January 07, 2010 11:56 PMSorry if I sound ignorant, but I'm a beginner. Where does the string show up?
-
Friday, January 08, 2010 8:17 AMMy account under The Hacker got hacked or something. But I was trying to install the extension and could not find where to out the file?
-
Saturday, February 13, 2010 2:51 AMupdate for .8?
-
Friday, February 19, 2010 6:36 PMAre these extensions compatibal with v0.8 ? What would be involved to create access to SQL Express? If it is easy quick it would be nice for a project I am doing. If it is not I can just store my data in a text file and access it that way.
Many thanks
Bob -
Friday, February 19, 2010 7:00 PMI'm considering taking some time this week-end in updating the extension for v0.8.
BTW, SQL Express is something completely different from the rest of the extensions.
Maybe you could use the Interop object to use the native ones of .NET. But I agree
it would not be a great solution.
However, using SQL isn't common for a beginner, so I don't think it would be primordial
to implement it (at least because it's untrivial and it would require SQL Express installed).
Why do you want to use SQL ?
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Friday, February 19, 2010 7:47 PMNo big change performed in the SB API. I just recompiled the code, and everthing seems to work.
As usual, please report any problem you encounter, if any.
Fremy
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Friday, February 19, 2010 8:12 PMthe project that I am working on is at http://24.207.27.16/BCFerriesNew/web.site/logs/Logs2003.aspx . What it is a database of ship (ferry) movements with the objective of tracking on time performance. One ferry terminal has a unigue problem that if the ferry in the top berth tries to unload while either of the other two berths is loading then there is a traffic stall and the vessel is delayed. The problem is known as cross loading.
Orginally I wrote it using access which worked fine until I changed ISP's and the cost of using access was cost prohibitive for me.
Five years later I decided to revive the project using small basic to grab the data from the BC Ferries web site each night and convert the data into SQL Express. When 0.8 came out I saw that you could run a program using Silverlight in a webpage. This would allow me to run my model very simply (From a programing viewpoint) as a webpage. There are probably easier ways of doing this, but I am not aware of them.
Copying the data from SQL to a CSV txt file and reading it in Small Basic is not a big deal. I just hate having data in two spots!
If any one has some ideas as to do this simply, I would much appreciate hearing your thoughts
Many thanks in advance,
Bob Jones -
Sunday, March 28, 2010 12:50 AM
Fremy,
A small request if I may. In the next version, would it be possible for you to label all the extension commands somehow to show that they are part of your extension and not one of the core SB commands.
Now that I have your extension installed, it's difficult knowing if a program I write uses only core commands or would require the extension to run.
-
Sunday, March 28, 2010 12:53 AMWhere did you get that theme???
Signature: Phillip Mikesell -
Sunday, March 28, 2010 1:06 AM
Where did you get that theme???
Phillip, it helps if you quote who or what you are referring to rather than making random replies or requests in the forums.
Signature: Phillip Mikesell -
Sunday, March 28, 2010 4:02 PM
Now that I have your extension installed, it's difficult knowing if a program I write uses only core commands or would require the extension to run.
I'm rather in favor of a command like "Imports FC.SmallBasic.Complements" that would be necessary as an header to the file to have my extension referenced by the projet. Renaming "Controls" into "{something}Controls" seems very bad.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Tuesday, April 20, 2010 1:09 PM
Hi
I have found that with SmallBASIC v0.8, if I even extract your extension into my lib subfolder, none of my SB programs willl run at all (SmallBASIC crashes) *even if they don't use your extension*
For example, install Small Basic from the msi installer, download and run TETRIS - this works fine.
WITHOUT doing anything else, download and extract your extension into a subfolder called 'lib', try to run TETRIS now and SB crashes...
I've used earlier versions of SB with earlier versions of your extension and it has all worked properly, so I'm pretty sure I have the setup correct.
All very odd, any ideas as to what is wrong here?
Jen H
-
Tuesday, April 20, 2010 6:21 PMModerator
Jen,
Check that there is no SmalBasicLibrary.dll or SmallBasicLibrary.xml present within the lib directory. These may be present in the FC zip file you downloaded. If these files are there, then delete them.
-
Tuesday, April 27, 2010 12:27 PM
FC API Reference - http://myfiles.ru/17475366 in Word format
My daddy creates Word document with all reference commands FC extension for Small Basic. I hope this document will be useful for all. Later my daddy will translete this in russian language.
Good luck.
-
Tuesday, April 27, 2010 3:24 PM
FC API Reference - http://myfiles.ru/17475366 in Word format
Thanks for having done it. Hope it'll help people getting started.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Tuesday, April 27, 2010 7:09 PM
The site is in Russian and doesn't translate well. Could tell me to download in english?
Many thanks
-
Tuesday, April 27, 2010 7:34 PM
The site is in Russian and doesn't translate well. Could tell me to download in english?
Many thanks
http://www.filefactory.com/file/b155gea/n/FC_eng.doc - this site for download in english. If you do not download from this site tell me about on this post.Good Luck!
-
Thursday, April 29, 2010 6:31 PM
If you could email me the document I will post it on my site which has simple downloads! Goes for anything elese Small Basic orientated that you cannn't post here!
Many Thanks!
-
Saturday, June 12, 2010 7:20 PM
<big>Update about FC.SmallBasic.Complements</big>
Well, I've lost several days of programmation today since my data hard drive crashed (seems I should really invest in more resent, less cheaper material if I want to avoid such problems in the future; I'll simply ditch the use of my old PC and only use my netbook at this time, it's more secure). I restored some files from an old backup, can't say which version of Small Basic Complements I was able to recover. Maybe some very old one, so many features will need to be completely rewritten. I'll see later if I can recover (some) files from the disk crash, but nothing is less sure :D
Anyway, I've ended up my last examen for this university year yesterday, so I'll have some time to update my extensions. Previsible changes are :
--> Controls will be renamed to FCControls to avoid conflict with the new SmallBasic object. I'll consider doing this change on every Object exposed to Small Basic to avoid any conflict in further versions. This has been a requested feature, anyway.
--> The documentation around the Drawings object will be updated, possibly with new features and breaking changes
--> The final version of FC.SmallBasic.Complements will not be availabe immediately. I'll need to modify my code to match the 0.9 version and see if I need to rebuild anything from scratch (or update existing code).
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, June 13, 2010 8:31 PM
Well, the fact is I've been able to restore the latest version of the files.
So, I'm already able to publish a new version of the FC extension. Please not no old program should continue to run with this new version since I've put a prefix before every object I expose to Small Basic, because I'm quite tired of beeing forced to rename the objects when some features are included in Small Basic (which is great!). So, every object will now have a "FC" prefix. It's better, because it'll be simpler for people to know if they use the FC extension in their applications or not, and will no more have to guess if an object is a native one or a added one. The only negative point is that it's longer to type and it's a breaking change (anyway, I would have had to rename the Controls object so many applications would have requierd a change).
The new (and exiting) features already present in this new build (which is still a beta version, since I was not able to test every feature) are :
- Completely renewed FCDrawings API, with now even more useful features.
- Some new features in FCExtensions (previoulsy known as Language and SmallBasic) like User language and some syntax sugar about arrays of point
- The ability to change the order of display of elements added to GraphicsWindow through FCControls.Get/SetZIndex (higher z-index mean higher chances of beeing displayed first)
- Some bug fixes, as usual
The download link is, as usual :
http://cid-201f3835d49587fe.office.live.com/self.aspx/Public/Small%20Basic/lib.zip
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Thursday, July 22, 2010 4:16 PMbug: Right-clicking an ellipse will freeze other controls
-
Sunday, August 01, 2010 3:58 PM
FremyCompany,
I tried to use one of your examples to to save a graphics to a file, but it doesn't work. The file doesn't get saved. Everything else works OK. The curves get drawn like they are supposed to. Any idea on what I'm doing wrong? Here's the code I used.
GraphicsWindow.Show()
GraphicsWindow.BackgroundColor = "#FFEEDD"' Closed curve points
Arr1[0]["X"] = 10
Arr1[0]["Y"] = 10
Arr1[1]["X"] = 10
Arr1[1]["Y"] = 40
Arr1[2]["X"] = 40
Arr1[2]["Y"] = 40
Arr1[3]["X"] = 40
Arr1[3]["Y"] = 10' Normal curve points
Arr2 = Arr1
Arr2[4]["X"] = 10
Arr2[4]["Y"] = 10' Create the graphics
MyCurve = FCDrawings.CreateGraphics(50,50)
MyPicture = FCDrawings.CreateGraphics(50,50)' Draw the curves
FCDrawings.DrawCurve(MyCurve, "Blue", 3, Arr2)
FCDrawings.DrawClosedCurve(MyPicture, "Red", 3, Arr1)' Generate the images to use in the Graphics Window
MyCurve = FCDrawings.GenerateImage(MyCurve)
MyPicture = FCDrawings.GenerateImage(MyPicture)Shapes.Move(Shapes.AddImage(MyPicture), 50, 0)
Shapes.Move(Shapes.AddImage(MyCurve), 0, 0)'Save to File
FCDrawings.SaveGraphicsToFile(MyCurve,"c:\test.jpg")GraphicsWindow.ShowMessage("THE END!",":)")
This code appears to run OK when I run it, but I just don't get a file.
Also, after saving a graphic to a file what do you use to load the graphic back into the a graphics window?
Thanks,
Jricestk
-
Sunday, August 01, 2010 4:44 PM
Well, I must admit I don't remind me how I implemented that. I'll have a look at my code and I'll send you another response when the needed verrifications will be done ;-)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, August 01, 2010 5:17 PM
Okay, I've found the problem in your code.
As the name of the functions indicates it, SaveGraphicsToFile takes a graphics as first parameter, not an image.
But, even with that fact corrected, it seems I'm still facing an error. The error message is not very instructive, so I don't know exactly what the problem is. I'm going to investigate.
System.Runtime.InteropServices.ExternalException: Une erreur générique s'est produite dans GDI+.
à System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
à FC.FCDrawings.SaveGraphicsToFile(Primitive GraphicsObject, Primitive FileName)
Okay, I've found the problem: the C:\ directory is protected by Windows. Using simply "test.jpg" to write in the current application directory solved the problem. In a future version of my extension, I'll modify the places where I catch errors and prevents those to break the program and show an error message to indicate that an error occured but that the program should continue to run (or, even better, ask the user if he want to kill the app or continue execution).
Does my message solves your problem .
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, August 01, 2010 5:25 PM
Fremy,
I'll try your answer above, but I wanted to catch you while you are still online.
Is there a way to load the graphics file back into the graphics window after saving it?
Thanks,
Jricestk
-
Sunday, August 01, 2010 5:33 PM
Yes, but the methods depends on what you want to do.
If you want to display it using AddImage, you should use the classical Small Basic API (namely ImageList.LoadImage).
If you want to be able to continue to draw on it, you'll need
FCDrawings
.CreateGraphicsFromImage(ImageSrc)
As the documentation specify :
ImageSrc
Name of an image in the ImageList, or path to a fileBTW, you're welcome :-)
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, August 01, 2010 5:36 PM
what about the right click bug
its really frustrating
-
Sunday, August 01, 2010 5:38 PM
Fremy,
I got it working. I had to move the savegraphics line to before the image lines and then it worked.
Thanks,
Jricestk
- Edited by jricestk Sunday, August 01, 2010 5:42 PM
-
Sunday, August 01, 2010 5:40 PM
MyCurve2 = FCDrawings.GenerateImage(MyCurve)
MyPicture = FCDrawings.GenerateImage(MyPicture)
Shapes.Move(Shapes.AddImage(MyPicture), 50, 0)
Shapes.Move(Shapes.AddImage(MyCurve2 ), 0, 0)and leave the rest as it is
-
Sunday, August 01, 2010 5:42 PM
GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "#FFEEDD" ' Closed curve points Arr1[0]["X"] = 10 Arr1[0]["Y"] = 10 Arr1[1]["X"] = 10 Arr1[1]["Y"] = 40 Arr1[2]["X"] = 40 Arr1[2]["Y"] = 40 Arr1[3]["X"] = 40 Arr1[3]["Y"] = 10 ' Normal curve points Arr2 = Arr1 Arr2[4]["X"] = 10 Arr2[4]["Y"] = 10 ' Create the graphics MyCurve = FCDrawings.CreateGraphics(50,50) MyPicture = FCDrawings.CreateGraphics(50,50) ' Draw the curves FCDrawings.DrawCurve(MyCurve, "Blue", 3, Arr2) FCDrawings.DrawClosedCurve(MyPicture, "Red", 3, Arr1) ' Generate the images to use in the Graphics Window 'MyCurve = FCDrawings.GenerateImage(MyCurve) MyPicture = FCDrawings.GenerateImage(MyPicture) Shapes.Move(Shapes.AddImage(MyPicture), 50, 0) 'Shapes.Move(Shapes.AddImage(MyCurve), 0, 0) 'Save to File GraphicsWindow.ShowMessage(MyCurve,"MyCurve") FCDrawings.SaveGraphicsToFile(MyCurve,"test2.jpg") GraphicsWindow.ShowMessage("THE END!",":)")
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, August 01, 2010 5:44 PM
what about the right click bug
its really frustrating
Sorry, didn't notice your bug report. I'm investigating it now.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, August 01, 2010 6:00 PM
what about the right click bug
It seems there's no right-click bug. At least not in my code (if you think there's really a problem, please care to send me a code that repros, because I didn't find any that involves my code only) :-D
But as you were reporting the problem, I was asking myself how this could be possible, since I strongly suspected you're truly facing that issue. I then came with something like that :
E=FCControls.AddEllipse(200,100) FCControls.RegisterMouseDownEvent(E, "WorkaroundSub") 'FCControls.RegisterMouseDownEvent(E, "UILockerSub") R=FCControls.AddRectangle(50,50) While "True" FCControls.MoveAsAnimation(R, 150, 0, 7000) Program.Delay(7000) FCControls.MoveAsAnimation(R, 0, 0, 7000) Program.Delay(7000) EndWhile Sub UILockerSub ' If this code is executed in a function directly called by the ' drawing thread, the whole application will have to wait ' 3 seconds before getting a chance to redraw itself Program.Delay(3000) EndSub Sub WorkaroundSub ' This sub will basicly do the same job as the other one ' but it will run the function in another thread, allowing ' the thread doing the drawing job to continue running. FCExtensions.AsyncCall("UILockerSub") EndSubCoud you confirm your issue is related with that problem (an event handler that takes too much time to run and block the UI thread) ?
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, August 01, 2010 6:06 PM
Fremy,
One last question I hope. Is there a way to save a whole graphics window to a file? What I am wanting to do is print out on paper a graphics window that I've created in another program. I have the printer extension loaded and can print .jpg files. That works OK, but I'm not sure how to save a whole window.
Thanks,
Jricestk
-
Sunday, August 01, 2010 6:19 PM
This is the source code and the files
Just extract & compile
try right clicking one of the points
sorry for not commenting, but I'm sure you'll figure it out
i have just included the English language file because I don't think you are into Bosnian :)
i'm working on adding a right click menu but it suddenly freezes all the clickable controls like they have suddenly been unregistered
P.S.:you can drag the background and im working to make the line & grid rendering through drawings
-
Sunday, August 01, 2010 8:55 PM
@4000a
I'll have a look at this tomorrow.
@jricestk
Maybe you should have a look at FCDrawings.CreateGraphicsFromControl and FCDrawings.CreateGraphicsFromUI.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, August 01, 2010 9:18 PM
Well, I didn't resist and I looked at your application tonight. It seems well-done, but you should graduate from Small Basic now since you're too far from the drawing components in Small Basic to use the full power of your computer. On my computer your application is even flickering due to large GPU consumtion.
Anyway, I can confirm the bug, but I remain certain the problem is in your own code ;-) I'll check in the details to find out why this problem occur. Seems it's (....)
Well, I found the problem right now. It's effectively in your code. Please modify your rightClick function the following way to solve your problem :
Sub rightClickPoint
' Wathever you want
doingclick="false"
EndSubA debugger would have helpt you to find out the problem. I'm strongly considering making a new FCDebug object which would give the programmers some debugging possibilities (nothing complex though, since I would need to craft a special compiler to make something great and I don't want to accomplish this anymore because I don't want to maintain a parallel compiler, the most important reason is that it takes too much time to decompile the official one, understand the new changes and modify the unofficial compiler accordoingly) but it could help in some scenarios.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Monday, August 02, 2010 5:32 PM
Thank you VERY MUCH
Graduating gives me a lot of errors, specifically in the for loops
I managed to link your lib with the project, but the for loops are giving me a headache
I will continue to do it in small basic, and I will use your drawing API to write the screen to a bitmap and then display it (the lines and grid), and then release the memory.
BTW Is there any way to make the translation thing better
-
Monday, August 02, 2010 6:15 PMI'm going to say one word: Wow!
-
Monday, August 02, 2010 6:53 PM
BTW Is there any way to make the translation thing better
Maybe using FCDialogs and not the console. Using FCDataFile may help if you want to load/save the translation data quickly.
But the point about graduating is not to compile the same application using VB. Small Basic has a well-done compiler. The problem is the API, that makes things very simple, but at a high performance cost ;-)
BTW, congrats for your application, it's a nice idea. I myself did something like that in the past, it's a nice way to learn programmation because you'll learn some very useful design pattern.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Tuesday, August 03, 2010 12:29 AM
Fremy,One last question I hope. Is there a way to save a whole standard graphics window to a file using your extension? What I am wanting to do is print out on paper a graphics window that I've created in another program. This program only uses the standard graphics functions. Do I need to change those functions to the functions that are in your extension? It seems like standard graphics don't get saved in a file, but when I use your functions they do.
I have a printer extension loaded and can print .png files. That works OK, but I'm not sure how to save a whole window to a file.
Even if I need to change the program to use your extension graphics functions can I create a whole window and then save that window to a file with everyting that I put in the window?
Thanks,
Jricestk
-
Saturday, August 14, 2010 8:00 AM
Sorry if i bother anyone, but how do I print things in smallbasic?
thanks,
AirWaves
-
Saturday, August 14, 2010 8:02 AM
Sorry if i bother anyone, but how do I print things in smallbasic?
thanks,
AirWaves
I think there's no way to print anything in Small Basic. My extension don't help here. Maybe another extension provides a Print object, but I'm not sure there's one. Why would you like to print something ?
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Saturday, August 14, 2010 9:26 AMYou can Print with my Data extension
Sorry My Bad English -
Saturday, August 14, 2010 9:28 AM
You can Print with my Data extension
Sorry My Bad English
It's why I did remindi me of an extension allowing to print, then. Could you provide a link to the related forum thread ?
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Saturday, August 14, 2010 9:43 AM
You can Print with my Data extension
Sorry My Bad English
It's why I did remindi me of an extension allowing to print, then. Could you provide a link to the related forum thread ?
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/d001e5ab-5180-49c6-9894-8d16f6a65e0b
Sorry My Bad English -
Saturday, August 14, 2010 7:31 PM
Sorry, but when I download the .exe file, it shows up as a file not as a .exe file, but as a "File" file. I can't run this. Am I doing something wrong?
Thanks!
-
Saturday, August 14, 2010 9:16 PM
Do you mean Data.exe?
When you download .exe file does it have .exe extension? If it don't have change it to .exe and try run it.
Sorry My Bad English -
Saturday, August 14, 2010 11:55 PM
Do you mean Data.exe?
When you download .exe file does it have .exe extension? If it don't have change it to .exe and try run it.
Sorry My Bad English
Sorry for causing all this trouble, but I don't know how to change the file extension -
Sunday, August 15, 2010 12:03 AM
WOW!
I just found out, and the objects are amazing! Thanks!
-
Wednesday, August 25, 2010 7:38 PM
FremyCompany,
I tried your extension compiler, but I do not understand what to do with it. Would it be possible to provide a sample?
-
Thursday, August 26, 2010 3:58 PMThe extension compiler was a fork of the Small Basic compiler, but an old version of it. I ended up support for it as it takes too many times to modify each Small Basic subservsion. If you want to build a Small Basic extension, the new way is to "Graduate" your code to VB and add some attributes (see documentation) around the generated classes.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Sunday, October 10, 2010 1:57 AM
How do you use "FCInstances"? Everytime i use
FCInstances
.Add,
the graphicswindow opens up a millon times. How do i make it open up once?
-
Tuesday, August 16, 2011 11:07 PMIs there to be an update for Small Basic 1.0?
~~AirWaves!!~~ -
Wednesday, August 17, 2011 7:49 AM
Thanks for asking. I wasn't aware Small Basic had been updated. I'll work on an update later today but, depending on the changes that were introduced, it may takes several days to complete the process.
Regards,
François
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Wednesday, August 17, 2011 8:38 AM
I just read on the Small Basic website this is just a bug fix release. I'll then cancel my testing process and release next version now. I can't be sure there will be no bug, but I'm pretty confident there will be no new bug since last release. You can grab the new version at the same URL.
In the mean time, here's a sample code showing how to use FCInstances :
GWTitle = "FCInstances"
FCInstances.MainSub("Main")Sub Main
GraphicsWindow.Show()
ChildWindow = FCInstances.Add("ChildMain")
FCInstances.SetVariable(ChildWindow, "GWTitle", "Hello world")
FCInstances.CallSub(ChildWindow, "UpdateTitle")
EndSubSub ChildMain
GraphicsWindow.Show()
GraphicsWindow.Width = 300
GraphicsWindow.Height = 200
GraphicsWindow.CanResize = "False"
GraphicsWindow.BackgroundColor = "Black"
EndSubSub UpdateTitle
GraphicsWindow.Title = GWTitle
EndSubPlease note how FCInstances force you to use very structured code. For example, you can't do anything in your program body beside initialize variables or use code EVERY instance will be able to run. If you create a new window in the program body, every new window will create a new window and your code will loop.
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Wednesday, August 17, 2011 8:22 PMThat's great. In thanks for your great extension, here's a picture for your extension:

~~AirWaves!!~~ -
Thursday, August 18, 2011 8:32 AM
Thanks. Don't hesitate to ask questions if you have any.
François
Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension -
Thursday, September 08, 2011 1:41 AM
I am having troubles with the browser feature.
I am trying to make a webbrowser display an html file on my computer. and it doesn't seem to support file:// stuff.
Is there any substitute for this? I would like to do this without the need for internet access.
-
Thursday, September 08, 2011 2:32 AM
If you had an html file in C:\Test.HTML, then try this:
"file:///C:/Test.html"
Keep in mind that if you have spaces in your filepath, you need to replace spaces with "%20"
~~AirWaves!!~~ -
Thursday, September 08, 2011 9:53 PM
If you had an html file in C:\Test.HTML, then try this:
"file:///C:/Test.html"
Keep in mind that if you have spaces in your filepath, you need to replace spaces with "%20"
~~AirWaves!!~~That didn't work
"file:///C:/Test.html"
I always forget the triple slash!Anyways, I think Fremy needs to make support for file:/// stuff, or make a local web browser.

