Microsoft Small Basic

FremyCompany's Extension

Modified: 2010/07/23 17:49 by 72.234.135.60 - Categorized as: Api, Resources, Samples
Edit

What does this extension provides

This extension provides support :
Online, homework help site mean your chance to order custom essay without any time spent.

Edit

Better Shapes and Controls management

- More controls : Button, TextBox, CheckBox, Label, Polygon, WebBrowser, ...
- Possibility to register events of Shapes and Controls
- More properties for Shapes and Controls (Opacity, ...)


Edit

Full interop with .NET FrameWork

- Creating .NET objects
- Using .NET objects using Reflection
- Registering events and converting delegate from a type to another
- ...


Edit

New SmallBasic functions

- Eval()
- Timers
- Sort of SmallBasic events
- Call Sub by Name, ...
- Simple reflection (name of all defined subs/variables)
- ...


Edit

Support for XML

- Loading documents from file or string
- Reading/Writing the DOM
- Saving to file
- ...
Experienced paper writers are willing to assist you with any essay you need to complete!

Edit

And much more !

You can download the API Reference at http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/Help.zip

Edit

How to use it ?

Edit

1. Getting the DLL

Download it at http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/lib.zip
Or compile it from sources at http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/FC.SmallBasic.Complements.zip (may be an old version)

Edit

2. Adding the DLL as plugin for Small Basic

Copy the DLL into a 'lib' folder you create in the Small Basic's installation directory.

Edit

3. Opening Small Basic

Open Small Basic and start to use the new objects.



Edit

Samples

First sample : the Controls extension (and others)
' Init variables
Timer = ""

' Init Window
GraphicsWindow.Show()
GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(240,240,240)
Controls.LoadTheme("Vista")

' Create animation
MyImage = Controls.AddImage("AppIcon.png")
ButtonClick()

' Create button
MyButton = Controls.AddButton(150, 22, "Start/Stop")
Controls.Move(MyButton, 5, 150)
Controls.RegisterMouseUpEvent(MyButton, "ButtonClick")

' Create textbox
MyTextBox = Controls.AddTextBox(175, 22, "")
Controls.Move(MyTextBox, 165, 150)
Controls.SetText(MyTextBox, "Some text")
Controls.RegisterEvent(MyTextBox, "TextChangedEvent", "OnTextChange")

' Create checkbox
MyCheckBox = Controls.AddCheckBox("Cliquez ici !")
Controls.Move(MyCheckBox, 350, 155)
Controls.SetChecked(MyCheckBox, "True")

' Subs
CurrentMyImageRotation = 0
To150 = "False"
Sub RotateMyImage
  CurrentMyImageRotation = CurrentMyImageRotation + 1
  If CurrentMyImageRotation = 360 Then
    CurrentMyImageRotation = 0
    If To150 = "False" Then
      To150 = "True"
      Controls.MoveAsAnimation(MyImage, 0, 0, 1080)
    Else
      To150 = "False"
      Controls.MoveAsAnimation(MyImage, GraphicsWindow.Width-125, 0, 1080)
    EndIf
  EndIf
  Controls.SetRotationAngle(MyImage, CurrentMyImageRotation)
EndSub

Sub ButtonClick
  If Timer = "" Then
    Timer = SmallBasic.SetInterval("RotateMyImage", 3, -1)
    GraphicsWindow.AnimateShape(MyImage, GraphicsWindow.Width-125, 0, 1080)
  Else
    SmallBasic.AsyncStop(Timer)
    Timer = ""    
  EndIf
EndSub
Take advantage of profession resume and you will obtain position you strive for
Sub OnTextChange GraphicsWindow.ShowMessage(Controls.GetText(MyTextBox),"Text") EndSub

Second sample : XML
TextWindow.WriteLine("Test du système XML")

Quote = Text.GetCharacter(34)
Doc = Xml.LoadXMLFile("Data.XML")
TextWindow.WriteLine("")

' First test
Bag2 = Xml.GetNode(Doc, "//bag[2]")
TextWindow.WriteLine("The element : " + Bag2)
TextWindow.WriteLine("Content of the element : " + Xml.GetOuterXML(Bag2))
TextWindow.WriteLine("")

' Second test
ItemE = Xml.GetNode(Bag2, "./item[@name="+Quote+"e"+Quote+"]")
TextWindow.WriteLine("The element : " + ItemE)

Name = Xml.GetNodeValue(Xml.GetNode(ItemE, "@name"))
TextWindow.WriteLine("Name of the element : " + Quote + Name + Quote)

TextWindow.WriteLine("")

Sample 3 : Interop
Args[0] = "Bonjour "
Builder = Interop.CreateObject("System.Text.StringBuilder",Args)
ClearArgs()

Args[0] = "Objet StringBuilder créé !"
Args[1] = "My TestApp for Interop"
Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", Args)
ClearArgs()

TextWindow.Write("Entrez votre nom ici : ")

Args[0] = TextWindow.Read()
Interop.CallSub(Builder, "Append", Args)
ClearArgs()

Args[0] = "L'objet StringBuilder semble avoir fonctionné correctement"
Args[1] = "My TestApp for Interop"
Interop.CallSharedSub("System.Windows.Forms.MessageBox", "Show", Args)
ClearArgs()

TextWindow.WriteLine(Interop.ToString(Builder))

Sub ClearArgs
  Args = ""
EndSub
Reliable custom term paper and professional assistance are your assistants 24/7!

Sample 4 : Drawings and curve generator
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 = Drawings.CreateEmpyGraphics(50,50)
MyPicture = Drawings.CreateEmpyGraphics(50,50)

' Draw the curves
Drawings.DrawCurve(MyCurve, "Blue", 3, Arr2)
Drawings.DrawClosedCurve(MyPicture, "Red", 3, Arr1)

' Generate the images to use in the Graphics Window
MyCurve = Drawings.GenerateImage(MyCurve)
MyPicture = Drawings.GenerateImage(MyPicture)

Shapes.Move(Shapes.AddImage(MyPicture), 50, 0)
Shapes.Move(Shapes.AddImage(MyCurve), 0, 0)

GraphicsWindow.ShowMessage("THE END!",":)")

Needs a file called AppIcon.png in the same directory as the *.sb
GraphicsWindow.Show()

G  = Drawings.CreateGraphics("AppIcon.png")

Drawings.DrawLine(g, "Red", 5, -10,-10,50,50)

Pts[0]["X"] = (5)
Pts[0]["Y"] = (5)
Pts[1]["X"] = (25)
Pts[1]["Y"] = (10)
Pts[2]["X"] = (45)
Pts[2]["Y"] = (40)
Drawings.DrawCurve(g, "Green", 3, Pts)

Drawings.DrawEllipse(g, "Blue", 3, 5, 5, 60, 75)

Drawings.DrawRectangle(G, "Yellow", 3, 40, 40, 20, 20)

I = Drawings.GeneratePartialImage(g, 5, 5, 60, 75)
Drawings.ReleaseGraphics(g)
GraphicsWindow.Title = I
Controls.AddImage(I)


G = Drawings.CreateGraphics(I)
Drawings.SaveGraphicsToFile(G, "Result.png")
Drawings.ReleaseGraphics(g)

Download these exemples and some others at http://cid-201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/ (the samples included in the Help archive)

ScrewTurn Wiki version 2.0.35. Some of the icons created by FamFamFam.