small basic code reference

50
Array This object provides a way of storin accessed by another index. Operations ContainsIndex Array.ContainsIndex(array, index) Gets whether or not the array cont array's index was initialized by som array The array to check. index The index to check. Returns "True" or "False" depending on if the index ContainsValue Array.ContainsValue(array, value) Gets whether or not the array cont array's value was stored in some in array The array to check. value The value to check. Returns "True" or "False" depending on if the value GetAllIndices Array.GetAllIndices(array) Gets all the indices for the array, as array The array whose indices are requested. Returns An array filled with all the indices of the sp ng more than one value for a given name. These v tains the specified index. This is very useful when d me value or not. x was present in the specified. array. tains the specified value. This is very useful when d ndex. e was present in the specified. array. s another array. pecified array. The index of the returned array starts from 1. values can be deciding if the deciding if the

Upload: alter-dev

Post on 23-Oct-2014

51 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Small Basic Code Reference

Array

This object provides a way of storing more than one value for a given name. These values can be accessed by another index.

Operations ContainsIndex

Array.ContainsIndex(array, index)

Gets whether or not the array contains the specified index.array's index was initialized by some value or not.

array

The array to check.

index

The index to check.

Returns

"True" or "False" depending on if the index was present in the specified. array.

ContainsValue

Array.ContainsValue(array, value)

Gets whether or not the array contains the specified value. This is very useful when deciding if the array's value was stored in some index.

array

The array to check.

value

The value to check.

Returns

"True" or "False" depending on if the value was present in the specified. array.

GetAllIndices

Array.GetAllIndices(array)

Gets all the indices for the array, as another array.

array

The array whose indices are requested.

Returns

An array filled with all the indices of the specified array. The index of the returned array starts from 1.

This object provides a way of storing more than one value for a given name. These values can be

Gets whether or not the array contains the specified index. This is very useful when deciding if the array's index was initialized by some value or not.

"True" or "False" depending on if the index was present in the specified. array.

Gets whether or not the array contains the specified value. This is very useful when deciding if the array's value was stored in some index.

ending on if the value was present in the specified. array.

Gets all the indices for the array, as another array.

specified array. The index of the returned array starts from 1.

This object provides a way of storing more than one value for a given name. These values can be

This is very useful when deciding if the

Gets whether or not the array contains the specified value. This is very useful when deciding if the

Page 2: Small Basic Code Reference

GetItemCount

Array.GetItemCount(array)

Gets the number of items stored in the array.

array

The array for which the count is requested.

Returns

The number of items in the specified array.

IsArray

Array.IsArray(array)

Gets whether or not a given variable is an array.

array

The variable to check.

Returns

"True" if the specified variable is an array. "False" otherwise.

SetValue

Array.SetValue(arrayName, index, value)

Sets a value for a given array and index.

arrayName

The name of the array.

index

Name of the index.

value

The value to set.

Returns

Nothing

GetValue

Array.GetValue(arrayName, index)

Gets a value for a given array and index.

arrayName

The name of the array.

index

The name of the index.

Returns

Gets the number of items stored in the array.

The array for which the count is requested.

The number of items in the specified array.

Gets whether or not a given variable is an array.

"True" if the specified variable is an array. "False" otherwise.

array and index.

Gets a value for a given array and index.

Page 3: Small Basic Code Reference

The value at the specified index of the specified array.

RemoveValue

Array.RemoveValue(arrayName, index)

Removes the array item at the specified index.

arrayName

The name of the array.

index

The index of the item to remove.

Returns

Nothing

Clock

This class provides access to the system clock

Properties Time (This property is read-only.)

Clock.Time

Gets the current system time.

Date (This property is read-only.)

Clock.Date

Gets the current system date.

Year (This property is read-only.)

Clock.Year

Gets the current year.

Month (This property is read-only.)

Clock.Month

Gets the current Month.

Day (This property is read-only.)

Clock.Day

The value at the specified index of the specified array.

Removes the array item at the specified index.

This class provides access to the system clock

Page 4: Small Basic Code Reference

Gets the current day of the month.

WeekDay (This property is read-only.)

Clock.WeekDay

Gets the current day of the week.

Hour (This property is read-only.)

Clock.Hour

Gets the current Hour.

Minute (This property is read-only.)

Clock.Minute

Gets the current Minute.

Second (This property is read-only.)

Clock.Second

Gets the current Second.

Millisecond (This property is read-only.)

Clock.Millisecond

Gets the current Millisecond.

ElapsedMilliseconds (This property is read

Clock.ElapsedMilliseconds

Gets the number of milliseconds that have elapsed since 1900.

Controls

The Controls object allows you to add, move and interact with controls.

Properties LastClickedButton (This property is read

Controls.LastClickedButton

Gets the last Button that was clicked on the Graphics Window.

LastTypedTextBox (This property is

Gets the current day of the month.

only.)

only.)

(This property is read-only.)

Gets the number of milliseconds that have elapsed since 1900.

Controls object allows you to add, move and interact with controls.

(This property is read-only.)

Gets the last Button that was clicked on the Graphics Window.

(This property is read-only.)

Page 5: Small Basic Code Reference

Controls.LastTypedTextBox

Gets the last TextBox, text was typed into.

Events ButtonClicked

Controls.ButtonClicked

Raises an event when any button control is clicked.

TextTyped

Controls.TextTyped

Raises an event when text is typed into any

Operations AddButton

Controls.AddButton(caption, left, top)

Adds a button to the graphics window with the specified width and height.

caption

The caption to display in the button.

left

The x co-ordinate of the button.

top

The y co-ordinate of the button.

Returns

The button that was just added to the Graphics Window.

GetButtonCaption

Controls.GetButtonCaption(buttonName)

Gets the curent caption of the specified button.

buttonName

The Button whose caption is requested.

Returns

The current caption of the button.

SetButtonCaption

Controls.SetButtonCaption(buttonName, caption)

Sets the caption of the specified button.

Gets the last TextBox, text was typed into.

Raises an event when any button control is clicked.

Raises an event when text is typed into any TextBox control.

Adds a button to the graphics window with the specified width and height.

The button that was just added to the Graphics Window.

Gets the curent caption of the specified button.

Controls.SetButtonCaption(buttonName, caption)

Sets the caption of the specified button.

Page 6: Small Basic Code Reference

buttonName

The Button whose caption needs to be set.

caption

The new caption for the button.

Returns

Nothing

AddTextBox

Controls.AddTextBox(left, top)

Adds a text input box to the graphics window with the specified width and height.

left

The x co-ordinate of the text box.

top

The y co-ordinate of the text box.

Returns

The text box that was just added to the Graphics Window.

AddMultiLineTextBox

Controls.AddMultiLineTextBox(left, top)

Adds a multi-line text input box to the graphics window with the specified width and height.

left

The x co-ordinate of the text box.

top

The y co-ordinate of the text box.

Returns

The text box that was just added to the Graphics Window.

GetTextBoxText

Controls.GetTextBoxText(textBoxName)

Gets the curent text of the specified TextBox.

textBoxName

The TextBox whose text is requested.

Returns

The text in the TextBox

SetTextBoxText

Controls.SetTextBoxText(textBoxName, text)

The Button whose caption needs to be set.

Adds a text input box to the graphics window with the specified width and height.

Graphics Window.

line text input box to the graphics window with the specified width and height.

The text box that was just added to the Graphics Window.

Gets the curent text of the specified TextBox.

Controls.SetTextBoxText(textBoxName, text)

line text input box to the graphics window with the specified width and height.

Page 7: Small Basic Code Reference

Sets the text of the specified TextBox.

textBoxName

The TextBox whose text needs to be set.

text

The new text for the TextBox.

Returns

Nothing

Remove

Controls.Remove(controlName)

Removes a control from the Graphics Window.

controlName

The name of the control that needs to be removed.

Returns

Nothing

Move

Controls.Move(control, x, y)

Moves the control with the specified name to a new position.

control

The name of the control to move.

x

The x co-ordinate of the new position.

y

The y co-ordinate of the new position.

Returns

Nothing

SetSize

Controls.SetSize(control, width, height)

Sets the size of the control.

control

The name of the control to be resized.

width

The width of the control.

height

Sets the text of the specified TextBox.

from the Graphics Window.

The name of the control that needs to be removed.

Moves the control with the specified name to a new position.

Page 8: Small Basic Code Reference

The height of the control.

Returns

Nothing

HideControl

Controls.HideControl(controlName)

Hides an already added control.

controlName

The name of the control.

Returns

Nothing

ShowControl

Controls.ShowControl(controlName)

Shows a previously hidden control.

controlName

The name of the control.

Returns

Nothing

Desktop

This class provides methods to interact with the desktop.

Properties Width (This property is read-only.)

Desktop.Width

Gets the screen width of the primary desktop.

Height (This property is read-only.)

Desktop.Height

Gets the screen height of the primary desktop.

Operations SetWallPaper

control.

This class provides methods to interact with the desktop.

Gets the screen width of the primary desktop.

Gets the screen height of the primary desktop.

Page 9: Small Basic Code Reference

Desktop.SetWallPaper(fileOrUrl)

Sets the specified picture as the desktop's wallpaper.even an internet url.

fileOrUrl

The filename or url of the picture.

Returns

Nothing

Dictionary

This class provides access to an online Dictionary service.

Operations GetDefinition

Dictionary.GetDefinition(word)

Gets the definition of a word, in English.

word

The word to define.

Returns

The definition(s) of the specified word.

GetDefinitionInFrench

Dictionary.GetDefinitionInFrench(word)

Gets the definition of a word, in French.

word

The word to define.

Returns

The definition(s) of the specified word.

File

The File object provides methods to access, read and write information from and to a file on disk. Using this object, it is possible to save and open settings across multiple

Sets the specified picture as the desktop's wallpaper. This file could be a local file or a network file or

This class provides access to an online Dictionary service.

Gets the definition of a word, in English.

Gets the definition of a word, in French.

The File object provides methods to access, read and write information from and to a file on disk. Using this object, it is possible to save and open settings across multiple sessions of your program.

This file could be a local file or a network file or

The File object provides methods to access, read and write information from and to a file on disk. sessions of your program.

Page 10: Small Basic Code Reference

Properties LastError

File.LastError

Gets or sets the last encountered file operation based error message. This property is useful for finding out when some method fails to execute.

Operations ReadContents

File.ReadContents(filePath)

Opens a file and reads the entire file's contents. This method will be fast for small files that are less than an MB in size, but will start to slow down and will be noticeable for files greater than 10MB.

filePath

The full path of the file to read. An example of a full path will be c:

Returns

The entire contents of the file.

WriteContents

File.WriteContents(filePath, contents)

Opens a file and writes the specified contents into it, replacing the original contents with the content.

filePath

The full path of the file to write to. An example of a full path will be c:

contents

The contents to write into the specified file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it

ReadLine

File.ReadLine(filePath, lineNumber)

Opens the specified file and reads the contents at the specified line number.

filePath

The full path of the file to read from. An example of a full path will be c:

lineNumber

The line number of the text to be read.

Returns

The text at the specified line of the specified file.

Gets or sets the last encountered file operation based error message. This property is useful for finding out when some method fails to execute.

Opens a file and reads the entire file's contents. This method will be fast for small files that are less than an MB in size, but will start to slow down and will be noticeable for files greater than 10MB.

read. An example of a full path will be c:\temp\settings.data.

Opens a file and writes the specified contents into it, replacing the original contents with the

The full path of the file to write to. An example of a full path will be c:\temp\settings.data.

The contents to write into the specified file.

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

Opens the specified file and reads the contents at the specified line number.

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

The text at the specified line of the specified file.

Gets or sets the last encountered file operation based error message. This property is useful for

Opens a file and reads the entire file's contents. This method will be fast for small files that are less than an MB in size, but will start to slow down and will be noticeable for files greater than 10MB.

Opens a file and writes the specified contents into it, replacing the original contents with the new

Page 11: Small Basic Code Reference

WriteLine

File.WriteLine(filePath, lineNumber, contents)

Opens the specified file and write the contents at the specified line number. This overwrite any existing content at the specified line.

filePath

The full path of the file to read from. An example of a full path will be c:

lineNumber

The line number of the text to write.

contents

The contents to write at the specified line of the specified file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

InsertLine

File.InsertLine(filePath, lineNumber, contents)

Opens the specified file and inserts the contents at the specified line number. This operation will not overwrite any existing content at the specifid line.

filePath

The full path of the file to read from. An example of a full path will be c:

lineNumber

The line number of the text to insert.

contents

The contents to insert into the file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

AppendContents

File.AppendContents(filePath, contents)

Opens the specified file and appends the contents to the end of the file.

filePath

The full path of the file to read from. An example of a full path will be c:

contents

The contents to append to the end of the file.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

CopyFile

File.WriteLine(filePath, lineNumber, contents)

Opens the specified file and write the contents at the specified line number. This operation will overwrite any existing content at the specified line.

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

at the specified line of the specified file.

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

File.InsertLine(filePath, lineNumber, contents)

Opens the specified file and inserts the contents at the specified line number. This operation will not overwrite any existing content at the specifid line.

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

Opens the specified file and appends the contents to the end of the file.

The full path of the file to read from. An example of a full path will be c:\temp\settings.data.

The contents to append to the end of the file.

the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

operation will

Opens the specified file and inserts the contents at the specified line number. This operation will not

Page 12: Small Basic Code Reference

File.CopyFile(sourceFilePath, destinationFilePath)

Copies the specified source file to the destination file path.doesn't exist, the method will attempt to create it automatically. Existing files will be overwritten. It is always best to check if the destination file exists if you don't want to overwrite existing files.

sourceFilePath

The full path of the file that needs to be copied. An example of a full path will be c:

destinationFilePath

The destination location or the file path.

Returns

If the operation was successful, this will return "SUCCESS".

DeleteFile

File.DeleteFile(filePath)

Deletes the specified file.

filePath

The destination location or the file path. An example of a full path will be c:

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

CreateDirectory

File.CreateDirectory(directoryPath)

Creates the specified directory.

directoryPath

The full path of the directory to be created.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

DeleteDirectory

File.DeleteDirectory(directoryPath)

Deletes the specified directory.

directoryPath

The full path of the directory to be deleted.

Returns

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

GetFiles

File.GetFiles(directoryPath)

File.CopyFile(sourceFilePath, destinationFilePath)

Copies the specified source file to the destination file path. If the destination points to a location that doesn't exist, the method will attempt to create it automatically. Existing files will be overwritten. It is always best to check if the destination file exists if you don't want to overwrite existing files.

The full path of the file that needs to be copied. An example of a full path will be c:\temp\settings.data.

If the operation was successful, this will return "SUCCESS". Otherwise, it will return "FAILED".

The destination location or the file path. An example of a full path will be c:\temp\settings.data.

this will return "SUCCESS". Otherwise, it will return "FAILED".

The full path of the directory to be created.

will return "SUCCESS". Otherwise, it will return "FAILED".

The full path of the directory to be deleted.

will return "SUCCESS". Otherwise, it will return "FAILED".

If the destination points to a location that doesn't exist, the method will attempt to create it automatically. Existing files will be overwritten. It is always best to check if the destination file exists if you don't want to overwrite existing files.

Page 13: Small Basic Code Reference

Gets the path of all the files in the specified directory path.

directoryPath

The directory to look for files.

Returns

If the operation was successful, this will return the files as an array. Otherwise, it will return "FAILED".

GetDirectories

File.GetDirectories(directoryPath)

Gets the path of all the directories in the specified directory path.

directoryPath

The directory to look for subdirectories.

Returns

If the operation was successful, this will return the list of directories as an array. Otherwise, it will return "FAILED".

GetTemporaryFilePath

File.GetTemporaryFilePath()

Creates a new temporary file in a temporary directory and returns the full file

Returns

The full file path of the temporary file.

GetSettingsFilePath

File.GetSettingsFilePath()

Gets the full path of the settings file for this program.program's name and is present in the same location as the program.

Returns

The full path of the settings file specific for this program.

Flickr

This class provides access to Flickr photo services.

Operations GetPictureOfMoment

Flickr.GetPictureOfMoment()

Gets the path of all the files in the specified directory path.

will return the files as an array. Otherwise, it will return "FAILED".

Gets the path of all the directories in the specified directory path.

If the operation was successful, this will return the list of directories as an array. Otherwise, it will return "FAILED".

Creates a new temporary file in a temporary directory and returns the full file path.

Gets the full path of the settings file for this program. The settings file name is based on the program's name and is present in the same location as the program.

The full path of the settings file specific for this program.

This class provides access to Flickr photo services.

If the operation was successful, this will return the list of directories as an array. Otherwise, it will return "FAILED".

The settings file name is based on the

Page 14: Small Basic Code Reference

Gets the url for the picture of the moment.

Returns

A file url for Flickr's picture of the moment

GetRandomPicture

Flickr.GetRandomPicture(tag)

Gets the url for a random picture tagged with the specified tag.

tag

The tag for the requested picture.

Returns

A file url for Flickr's random picture

GraphicsWindow

The GraphicsWindow provides graphics related input and output functionality. For example, using this class, it is possible to draw and fill circles and rectangles.

Properties BackgroundColor

GraphicsWindow.BackgroundColor

Gets or sets the Background color of the Graphics

BrushColor

GraphicsWindow.BrushColor

Gets or sets the brush color to be used to fill shapes drawn on the Graphics Window.

CanResize

GraphicsWindow.CanResize

Specifies whether or not the Graphics Window can be resized by the user.

PenWidth

GraphicsWindow.PenWidth

Gets or sets the width of the pen used to draw shapes on the Graphics Window.

PenColor

Gets the url for the picture of the moment.

A file url for Flickr's picture of the moment

for a random picture tagged with the specified tag.

provides graphics related input and output functionality. For example, using this class, it is possible to draw and fill circles and rectangles.

Gets or sets the Background color of the Graphics Window.

Gets or sets the brush color to be used to fill shapes drawn on the Graphics Window.

Specifies whether or not the Graphics Window can be resized by the user.

Gets or sets the width of the pen used to draw shapes on the Graphics Window.

provides graphics related input and output functionality. For example, using

Gets or sets the brush color to be used to fill shapes drawn on the Graphics Window.

Page 15: Small Basic Code Reference

GraphicsWindow.PenColor

Gets or sets the color of the pen used to draw shapes on the Graphics Window.

FontName

GraphicsWindow.FontName

Gets or sets the Font Name to be used when drawing text on the Graphics Window.

FontSize

GraphicsWindow.FontSize

Gets or sets the Font Size to be used when drawing text on the Graphics Window.

FontBold

GraphicsWindow.FontBold

Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is bold.

FontItalic

GraphicsWindow.FontItalic

Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is italic.

Title

GraphicsWindow.Title

Gets or sets the title for the graphics window.

Height

GraphicsWindow.Height

Gets or sets the Height of the graphics window.

Width

GraphicsWindow.Width

Gets or sets the Width of the graphics window.

Left

GraphicsWindow.Left

Gets or sets the Left Position of the

Top

GraphicsWindow.Top

Gets or sets the color of the pen used to draw shapes on the Graphics Window.

sets the Font Name to be used when drawing text on the Graphics Window.

Gets or sets the Font Size to be used when drawing text on the Graphics Window.

font to be used when drawing text on the Graphics Window, is bold.

Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is italic.

title for the graphics window.

Gets or sets the Height of the graphics window.

Gets or sets the Width of the graphics window.

Gets or sets the Left Position of the graphics window.

font to be used when drawing text on the Graphics Window, is bold.

Gets or sets whether or not the font to be used when drawing text on the Graphics Window, is italic.

Page 16: Small Basic Code Reference

Gets or sets the Top Position of the graphics window.

LastKey (This property is read-only.)

GraphicsWindow.LastKey

Gets the last key that was pressed or released.

LastText (This property is read-only.)

GraphicsWindow.LastText

Gets the last text that was entered on the Graphics Window.

MouseX (This property is read-only.)

GraphicsWindow.MouseX

Gets the x-position of the mouse relative to the Graphics Window.

MouseY (This property is read-only.)

GraphicsWindow.MouseY

Gets the y-position of the mouse relative to the Graphics Window.

Events KeyDown

GraphicsWindow.KeyDown

Raises an event when a key is pressed down on the keyboard.

KeyUp

GraphicsWindow.KeyUp

Raises an event when a key is released

MouseDown

GraphicsWindow.MouseDown

Raises an event when the mouse button is clicked down.

MouseUp

GraphicsWindow.MouseUp

Raises an event when the mouse button is released.

MouseMove

GraphicsWindow.MouseMove

Gets or sets the Top Position of the graphics window.

Gets the last key that was pressed or released.

only.)

Gets the last text that was entered on the Graphics Window.

position of the mouse relative to the Graphics Window.

position of the mouse relative to the Graphics Window.

Raises an event when a key is pressed down on the keyboard.

Raises an event when a key is released on the keyboard.

Raises an event when the mouse button is clicked down.

Raises an event when the mouse button is released.

Page 17: Small Basic Code Reference

Raises an event when the mouse is moved around.

TextInput

GraphicsWindow.TextInput

Raises an event when text is entered on the GraphicsWindow.

Operations Show

GraphicsWindow.Show()

Shows the Graphics window to enable interactions with it.

Returns

Nothing

Hide

GraphicsWindow.Hide()

Hides the Graphics window.

Returns

Nothing

DrawRectangle

GraphicsWindow.DrawRectangle(x, y, width, height)

Draws a rectangle on the screen using the selected Pen.

x

The x co-ordinate of the rectangle.

y

The y co-ordinate of the rectangle.

width

The width of the rectangle.

height

The height of the rectangle.

Returns

Nothing

FillRectangle

GraphicsWindow.FillRectangle(x, y, width, height)

Fills a rectangle on the screen using the selected Brush.

mouse is moved around.

Raises an event when text is entered on the GraphicsWindow.

Shows the Graphics window to enable interactions with it.

GraphicsWindow.DrawRectangle(x, y, width, height)

Draws a rectangle on the screen using the selected Pen.

GraphicsWindow.FillRectangle(x, y, width, height)

Fills a rectangle on the screen using the selected Brush.

Page 18: Small Basic Code Reference

x

The x co-ordinate of the rectangle.

y

The y co-ordinate of the rectangle.

width

The width of the rectangle.

height

The height of the rectangle.

Returns

Nothing

DrawEllipse

GraphicsWindow.DrawEllipse(x, y, width, height)

Draws an ellipse on the screen using the selected Pen.

x

The x co-ordinate of the ellipse.

y

The y co-ordinate of the ellipse.

width

The width of the ellipse.

height

The height of the ellipse.

Returns

Nothing

FillEllipse

GraphicsWindow.FillEllipse(x, y, width, height)

Fills an ellipse on the screen using the

x

The x co-ordinate of the ellipse.

y

The y co-ordinate of the ellipse.

width

The width of the ellipse.

height

The height of the ellipse.

Returns

Nothing

GraphicsWindow.DrawEllipse(x, y, width, height)

Draws an ellipse on the screen using the selected Pen.

GraphicsWindow.FillEllipse(x, y, width, height)

Fills an ellipse on the screen using the selected Brush.

Page 19: Small Basic Code Reference

DrawTriangle

GraphicsWindow.DrawTriangle(x1, y1, x2, y2, x3, y3)

Draws a triangle on the screen using the selected pen.

x1

The x co-ordinate of the first point.

y1

The y co-ordinate of the first point.

x2

The x co-ordinate of the second point.

y2

The y co-ordinate of the second point.

x3

The x co-ordinate of the third point.

y3

The y co-ordinate of the third point.

Returns

Nothing

FillTriangle

GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3)

Draws and fills a triangle on the screen using the selected brush.

x1

The x co-ordinate of the first point.

y1

The y co-ordinate of the first point.

x2

The x co-ordinate of the second point.

y2

The y co-ordinate of the second point.

x3

The x co-ordinate of the third point.

y3

The y co-ordinate of the third point.

Returns

Nothing

DrawLine

GraphicsWindow.DrawLine(x1, y1, x2, y2)

GraphicsWindow.DrawTriangle(x1, y1, x2, y2, x3, y3)

the screen using the selected pen.

GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3)

Draws and fills a triangle on the screen using the selected brush.

Page 20: Small Basic Code Reference

Draws a line from one point to another.

x1

The x co-ordinate of the first point.

y1

The y co-ordinate of the first point.

x2

The x co-ordinate of the second point.

y2

The y co-ordinate of the second point.

Returns

Nothing

DrawText

GraphicsWindow.DrawText(x, y, text)

Draws a line of text on the screen at the specified location.

x

The x co-ordinate of the text start point.

y

The y co-ordinate of the text start point.

text

The text to draw

Returns

Nothing

DrawBoundText

GraphicsWindow.DrawBoundText(x, y, width, text)

Draws a line of text on the screen at the specified location.

x

The x co-ordinate of the text start point.

y

The y co-ordinate of the text start point.

width

The maximum available width. This parameter helps define when the text should wrap.

text

The text to draw.

Returns

Nothing

from one point to another.

Draws a line of text on the screen at the specified location.

GraphicsWindow.DrawBoundText(x, y, width, text)

Draws a line of text on the screen at the specified location.

The maximum available width. This parameter helps define when the text should wrap.

Page 21: Small Basic Code Reference

DrawResizedImage

GraphicsWindow.DrawResizedImage(imageName, x, y, width, height)

Draws the specified image from memory on to the screen, in the specified size.

imageName

The name of the image to draw

x

The x co-ordinate of the point to draw the image at.

y

The y co-ordinate of the point to draw the image at.

width

The width to draw the image.

height

The height to draw the image.

Returns

Nothing

DrawImage

GraphicsWindow.DrawImage(imageName, x, y)

Draws the specified image from memory on to the screen.

imageName

The name of the image to draw.

x

The x co-ordinate of the point to draw the image at.

y

The y co-ordinate of the point to draw the image at.

Returns

Nothing

SetPixel

GraphicsWindow.SetPixel(x, y, color)

Draws the pixel specified by the x and y co

x

The x co-ordinate of the pixel.

y

The y co-ordinate of the pixel.

color

GraphicsWindow.DrawResizedImage(imageName, x, y, width, height)

Draws the specified image from memory on to the screen, in the specified size.

point to draw the image at.

ordinate of the point to draw the image at.

GraphicsWindow.DrawImage(imageName, x, y)

memory on to the screen.

ordinate of the point to draw the image at.

ordinate of the point to draw the image at.

specified by the x and y co-ordinates using the specified color.

Page 22: Small Basic Code Reference

The color of the pixel to set.

Returns

Nothing

GetPixel

GraphicsWindow.GetPixel(x, y)

Gets the color of the pixel at the specified x and y co

x

The x co-ordinate of the pixel.

y

The y co-ordinate of the pixel.

Returns

The color of the pixel.

GetRandomColor

GraphicsWindow.GetRandomColor()

Gets a valid random color.

Returns

A valid random color.

GetColorFromRGB

GraphicsWindow.GetColorFromRGB(red, green, blue)

Constructs a color given the Red, Green and Blue values.

red

The red component of the Color (0-255).

green

The green component of the color (0-255).

blue

The blue component of the color (0-255).

Returns

Returns a color that can be used to set the brush or pen color.

Clear

GraphicsWindow.Clear()

Clears the window.

Returns

at the specified x and y co-ordinates.

GraphicsWindow.GetColorFromRGB(red, green, blue)

Constructs a color given the Red, Green and Blue values.

255).

Returns a color that can be used to set the brush or pen color.

Page 23: Small Basic Code Reference

Nothing

ShowMessage

GraphicsWindow.ShowMessage(text, title)

Displays a message box to the user.

text

The text to be displayed on the message box.

title

The title for the message box.

Returns

Nothing

ImageList

This class helps to load and store images in memory.

Operations LoadImage

ImageList.LoadImage(fileNameOrUrl)

Loads an image from a file or the internet into

fileNameOrUrl

The file name to load the image from. This could be a local file or a url to the internet location.

Returns

Returns the name of the image that was loaded.

GetWidthOfImage

ImageList.GetWidthOfImage(imageName)

Gets the width of the stored image.

imageName

The name of the image in memory.

Returns

The width of the specified image.

GetHeightOfImage

ImageList.GetHeightOfImage(imageName)

Displays a message box to the user.

displayed on the message box.

This class helps to load and store images in memory.

Loads an image from a file or the internet into memory.

The file name to load the image from. This could be a local file or a url to the internet location.

Returns the name of the image that was loaded.

stored image.

Page 24: Small Basic Code Reference

Gets the height of the stored image.

imageName

The name of the image in memory.

Returns

The height of the specified image.

Math

The Math class provides lots of useful mathematics related methods

Properties Pi (This property is read-only.)

Math.Pi

Gets the value of Pi

Operations Abs

Math.Abs(number)

Gets the absolute value of the given number.

number

The number to get the absolute value for.

Returns

The absolute value of the given number.

Ceiling

Math.Ceiling(number)

Gets an integer that is greater than or equal to the specified decimal number.will return 33.

number

The number whose ceiling is required.

Returns

The ceiling value of the given number.

Floor

Math.Floor(number)

Gets the height of the stored image.

The Math class provides lots of useful mathematics related methods

Gets the absolute value of the given number. For example, -32.233 will return 32.233.

Gets an integer that is greater than or equal to the specified decimal number. For example, 32.233

32.233 will return 32.233.

For example, 32.233

Page 25: Small Basic Code Reference

Gets an integer that is less than or equal to the specified decimal number.return 32.

number

The number whose floor value is required.

Returns

The floor value of the given number.

NaturalLog

Math.NaturalLog(number)

Gets the natural logarithm value of the given number.

number

The number whose natural logarithm value is required.

Returns

The natural log value of the given number.

Log

Math.Log(number)

Gets the logarithm (base 10) value of the given number.

number

The number whose logarithm value is required

Returns

The log value of the given number

Cos

Math.Cos(angle)

Gets the cosine of the given angle in radians.

angle

The angle whose cosine is needed (in radians).

Returns

The cosine of the given angle.

Sin

Math.Sin(angle)

Gets the sine of the given angle in radians.

angle

The angle whose sine is needed (in radians)

Gets an integer that is less than or equal to the specified decimal number. For example, 32.233 will

Gets the natural logarithm value of the given number.

logarithm value is required.

The natural log value of the given number.

Gets the logarithm (base 10) value of the given number.

The number whose logarithm value is required

Gets the cosine of the given angle in radians.

The angle whose cosine is needed (in radians).

Gets the sine of the given angle in radians.

needed (in radians)

For example, 32.233 will

Page 26: Small Basic Code Reference

Returns

The sine of the given angle

Tan

Math.Tan(angle)

Gets the tangent of the given angle in radians.

angle

The angle whose tangent is needed (in radians).

Returns

The tangent of the given angle.

ArcSin

Math.ArcSin(sinValue)

Gets the angle in radians, given the sin value.

sinValue

The sine value whose angle is needed.

Returns

The angle (in radians) for the given sine Value.

ArcCos

Math.ArcCos(cosValue)

Gets the angle in radians, given the cosine value.

cosValue

The cosine value whose angle is needed.

Returns

The angle (in radians) for the given cosine Value.

ArcTan

Math.ArcTan(tanValue)

Gets the angle in radians, given the tangent value.

tanValue

The tangent value whose angle is needed.

Returns

The angle (in radians) for the given tangent Value.

GetDegrees

Math.GetDegrees(angle)

Gets the tangent of the given angle in radians.

The angle whose tangent is needed (in radians).

the angle in radians, given the sin value.

The angle (in radians) for the given sine Value.

Gets the angle in radians, given the cosine value.

The angle (in radians) for the given cosine Value.

Gets the angle in radians, given the tangent value.

given tangent Value.

Page 27: Small Basic Code Reference

Converts a given angle in radians to degrees.

angle

The angle in radians.

Returns

The converted angle in degrees.

GetRadians

Math.GetRadians(angle)

Converts a given angle in degrees to radians.

angle

The angle in degrees.

Returns

The converted angle in radians.

SquareRoot

Math.SquareRoot(number)

Gets the square root of a given number.

number

The number whose square root value is needed.

Returns

The square root value of the given number.

Power

Math.Power(baseNumber, exponent)

Raises the baseNumber to the specified power.

baseNumber

The number to be raised to the exponent power.

exponent

The power to raise the base number.

Returns

The baseNumber raised to the specified exponent.

Round

Math.Round(number)

Rounds a given number to the nearest integer. For example 32.233 will be rounded to 32.0 while 32.566 will be rounded to 33.

Converts a given angle in radians to degrees.

Converts a given angle in degrees to radians.

Gets the square root of a given number.

The number whose square root value is needed.

The square root value of the given number.

Raises the baseNumber to the specified power.

The number to be raised to the exponent power.

The baseNumber raised to the specified exponent.

Rounds a given number to the nearest integer. For example 32.233 will be rounded to 32.0 while Rounds a given number to the nearest integer. For example 32.233 will be rounded to 32.0 while

Page 28: Small Basic Code Reference

number

The number whose approximation is required.

Returns

The rounded value of the given number.

Max

Math.Max(number1, number2)

Compares two numbers and returns the greater of the two.

number1

The first of the two numbers to compare.

number2

The second of the two numbers to compare.

Returns

The greater value of the two numbers.

Min

Math.Min(number1, number2)

Compares two numbers and returns the smaller of the two.

number1

The first of the two numbers to compare.

number2

The second of the two numbers to compare.

Returns

The smaller value of the two numbers.

Remainder

Math.Remainder(dividend, divisor)

Divides the first number by the second and returns the remainder.

dividend

The number to divide.

divisor

The number that divides.

Returns

The remainder after the division.

GetRandomNumber

Math.GetRandomNumber(maxNumber)

The number whose approximation is required.

Compares two numbers and returns the greater of the two.

The second of the two numbers to compare.

Compares two numbers and returns the smaller of the two.

The second of the two numbers to compare.

the first number by the second and returns the remainder.

Page 29: Small Basic Code Reference

Gets a random number between 1 and the specified maxNumber (inclusive).

maxNumber

The maximum number for the requested random value.

Returns

A Random number that is less than or equal to the specified max.

Mouse

The mouse class provides accessorsposition, pointer, etc.

Properties MouseX

Mouse.MouseX

Gets or sets the mouse cursor's x co

MouseY

Mouse.MouseY

Gets or sets the mouse cursor's y co

IsLeftButtonDown (This property is read

Mouse.IsLeftButtonDown

Gets whether or not the left button is pressed.

IsRightButtonDown (This property is read

Mouse.IsRightButtonDown

Gets whether or not the right button is pressed.

Operations HideCursor

Mouse.HideCursor()

Hides the mouse cursor on the screen.

Returns

Nothing

Gets a random number between 1 and the specified maxNumber (inclusive).

The maximum number for the requested random value.

A Random number that is less than or equal to the specified max.

The mouse class provides accessors to get or set the mouse related properties, like the cursor

Gets or sets the mouse cursor's x co-ordinate.

Gets or sets the mouse cursor's y co-ordinate.

(This property is read-only.)

Gets whether or not the left button is pressed.

(This property is read-only.)

Gets whether or not the right button is pressed.

Hides the mouse cursor on the screen.

to get or set the mouse related properties, like the cursor

Page 30: Small Basic Code Reference

ShowCursor

Mouse.ShowCursor()

Shows the mouse cursors on the screen.

Returns

Nothing

Network

This private helper class provides network access methods

Operations DownloadFile

Network.DownloadFile(url)

Downloads a file from the network to a local temporary file.

url

The url of the file on the network.

Returns

A local file name that the remote file was downloaded as.

GetWebPageContents

Network.GetWebPageContents(url)

Gets the contents of a specified web page.

url

The url of the web page

Returns

The contents of the specified web page.

Program

The Program class provides helpers to control the program execution.

Properties ArgumentCount (This property is read

Shows the mouse cursors on the screen.

This private helper class provides network access methods

Downloads a file from the network to a local temporary file.

A local file name that the remote file was downloaded as.

contents of a specified web page.

The Program class provides helpers to control the program execution.

(This property is read-only.)

Page 31: Small Basic Code Reference

Program.ArgumentCount

Gets the number of command-line arguments passed to this program.

Directory (This property is read-only.)

Program.Directory

Gets the executing program's directory.

Operations Delay

Program.Delay(milliSeconds)

Delays program execution by the specified amount of MilliSeconds.

milliSeconds

The amount of delay.

Returns

Nothing

End

Program.End()

Ends the program.

Returns

Nothing

GetArgument

Program.GetArgument(index)

Returns the specified argument passed to this

index

Index of the argument.

Returns

The command-line argument at the specified index.

Shapes

The Shape object allows you to add, move and rotate shapes to the Graphics window.

line arguments passed to this program.

only.)

Gets the executing program's directory.

Delays program execution by the specified amount of MilliSeconds.

Returns the specified argument passed to this program.

line argument at the specified index.

The Shape object allows you to add, move and rotate shapes to the Graphics window.The Shape object allows you to add, move and rotate shapes to the Graphics window.

Page 32: Small Basic Code Reference

Operations AddRectangle

Shapes.AddRectangle(width, height)

Adds a rectangle shape with the specified width and height.

width

The width of the rectangle shape.

height

The height of the rectangle shape.

Returns

The Rectangle shape that was just added to the Graphics Window.

AddEllipse

Shapes.AddEllipse(width, height)

Adds an ellipse shape with the specified width and height.

width

The width of the ellipse shape.

height

The height of the ellipse shape.

Returns

The Ellipse shape that was just added to the Graphics Window.

AddTriangle

Shapes.AddTriangle(x1, y1, x2, y2, x3, y3)

Adds a triangle shape represented by the specified points.

x1

The x co-ordinate of the first point.

y1

The y co-ordinate of the first point.

x2

The x co-ordinate of the second point.

y2

The y co-ordinate of the second point.

x3

The x co-ordinate of the third point.

y3

The y co-ordinate of the third point.

rectangle shape with the specified width and height.

The Rectangle shape that was just added to the Graphics Window.

Adds an ellipse shape with the specified width and height.

The Ellipse shape that was just added to the Graphics Window.

Adds a triangle shape represented by the specified points.

Page 33: Small Basic Code Reference

Returns

The Triangle shape that was just added to the Graphics Window.

AddLine

Shapes.AddLine(x1, y1, x2, y2)

Adds a line between the specified points.

x1

The x co-ordinate of the first point.

y1

The y co-ordinate of the first point.

x2

The x co-ordinate of the second point.

y2

The y co-ordinate of the second point.

Returns

The line that was just added to the Graphics Window.

AddImage

Shapes.AddImage(imageName)

Adds an image as a shape that can

imageName

The name of the image to draw.

Returns

The image that was just added to the Graphics Window.

AddText

Shapes.AddText(text)

Adds some text as a shape that can be moved, animated or rotated.

text

The text to add.

Returns

The text shape that was just added to the Graphics Window.

SetText

Shapes.SetText(shapeName, text)

Sets the text of a text shape.

The Triangle shape that was just added to the Graphics Window.

Adds a line between the specified points.

The line that was just added to the Graphics Window.

Adds an image as a shape that can be moved, animated or rotated.

The image that was just added to the Graphics Window.

Adds some text as a shape that can be moved, animated or rotated.

The text shape that was just added to the Graphics Window.

Page 34: Small Basic Code Reference

shapeName

The name of the text shape.

text

The new text value to set.

Returns

Nothing

Remove

Shapes.Remove(shapeName)

Removes a shape from the Graphics Window.

shapeName

The name of the shape that needs to be removed.

Returns

Nothing

Move

Shapes.Move(shapeName, x, y)

Moves the shape with the specified name to a new position.

shapeName

The name of the shape to move.

x

The x co-ordinate of the new position.

y

The y co-ordinate of the new position.

Returns

Nothing

Rotate

Shapes.Rotate(shapeName, angle)

Rotates the shape with the specified name to the specified angle.

shapeName

The name of the shape to rotate.

angle

The angle to rotate the shape.

Returns

Nothing

Zoom

Removes a shape from the Graphics Window.

The name of the shape that needs to be removed.

Moves the shape with the specified name to a new position.

Rotates the shape with the specified name to the specified angle.

Page 35: Small Basic Code Reference

Shapes.Zoom(shapeName, scaleX, scaleY)

Scales the shape using the specified zoom levels. Minimum is 0.1 and maximum is 20.

shapeName

The name of the shape to rotate.

scaleX

The x-axis zoom level.

scaleY

The y-axis zoom level.

Returns

Nothing

Animate

Shapes.Animate(shapeName, x, y, duration)

Animates a shape with the specified name to a new position.

shapeName

The name of the shape to move.

x

The x co-ordinate of the new position.

y

The y co-ordinate of the new position.

duration

The time for the animation, in milliseconds.

Returns

Nothing

GetLeft

Shapes.GetLeft(shapeName)

Gets the left co-ordinate of the specified shape.

shapeName

The name of the shape.

Returns

The left co-ordinate of the shape.

GetTop

Shapes.GetTop(shapeName)

Gets the top co-ordinate of the specified shape.

Scales the shape using the specified zoom levels. Minimum is 0.1 and maximum is 20.

Animates a shape with the specified name to a new position.

The time for the animation, in milliseconds.

ordinate of the specified shape.

ordinate of the specified shape.

Scales the shape using the specified zoom levels. Minimum is 0.1 and maximum is 20.

Page 36: Small Basic Code Reference

shapeName

The name of the shape.

Returns

The top co-ordinate of the shape.

GetOpacity

Shapes.GetOpacity(shapeName)

Gets the opacity of a shape.

shapeName

The name of the shape.

Returns

The opacity of the object as a value between 0 and 100. 0 is completely transparent and 100 is completely opaque.

SetOpacity

Shapes.SetOpacity(shapeName, level)

Sets how opaque a shape should render.

shapeName

The name of the shape.

level

The opacity level ranging from 0 to 100. 0 is completely transparent and 100 is completely opaque.

Returns

Nothing

HideShape

Shapes.HideShape(shapeName)

Hides an already added shape.

shapeName

The name of the shape.

Returns

Nothing

ShowShape

Shapes.ShowShape(shapeName)

Shows a previously hidden shape.

shapeName

The name of the shape.

The opacity of the object as a value between 0 and 100. 0 is completely transparent and 100 is completely opaque.

Sets how opaque a shape should render.

The opacity level ranging from 0 to 100. 0 is completely transparent and 100 is completely opaque.

The opacity of the object as a value between 0 and 100. 0 is completely transparent and 100 is completely opaque.

Page 37: Small Basic Code Reference

Returns

Nothing

Sound

The Sound object provides operations that allow the playback of sounds. Some sample sounds are provided along with the library.

Operations PlayClick

Sound.PlayClick()

Plays the Click Sound.

Returns

Nothing

PlayClickAndWait

Sound.PlayClickAndWait()

Plays the Click Sound and waits for it to finish.

Returns

Nothing

PlayChime

Sound.PlayChime()

Plays the Chime Sound.

Returns

Nothing

PlayChimeAndWait

Sound.PlayChimeAndWait()

Plays the Chime Sound and waits for it to finish.

Returns

Nothing

PlayChimes

Sound.PlayChimes()

The Sound object provides operations that allow the playback of sounds. Some sample sounds are

Plays the Click Sound and waits for it to finish.

Plays the Chime Sound and waits for it to finish.

The Sound object provides operations that allow the playback of sounds. Some sample sounds are

Page 38: Small Basic Code Reference

Plays the Chimes Sound.

Returns

Nothing

PlayChimesAndWait

Sound.PlayChimesAndWait()

Plays the Chimes Sound and waits for it to finish.

Returns

Nothing

PlayBellRing

Sound.PlayBellRing()

Plays the Bell Ring Sound.

Returns

Nothing

PlayBellRingAndWait

Sound.PlayBellRingAndWait()

Plays the Bell Ring Sound and waits for it to finish.

Returns

Nothing

PlayMusic

Sound.PlayMusic(notes)

Plays musical notes.

notes

A set of musical notes to play. The format is a subset of the Music Markup Language supported by QBasic.

Returns

Nothing

Play

Sound.Play(filePath)

Plays the Click Sound.

filePath

Returns

Sound and waits for it to finish.

Plays the Bell Ring Sound and waits for it to finish.

A set of musical notes to play. The format is a subset of the Music Markup Language supported by QBasic.A set of musical notes to play. The format is a subset of the Music Markup Language supported by QBasic.

Page 39: Small Basic Code Reference

Nothing

PlayAndWait

Sound.PlayAndWait(filePath)

Plays an audio file and waits until it is finished playing. This could be an mp3 or wav or wma file. Other file formats may or may not play depending on the audio codecscomputer. If the file was already paused, this operation will resume from the position where the playback was paused.

filePath

The path for the audio file. This could either be a local file (eg: c:

http://contoso.com/track01.wma).

Returns

Nothing

Pause

Sound.Pause(filePath)

Pauses playback of an audio file. If the file was not already playing, this operation will not do anything.

filePath

The path for the audio file. This could either be a local file (eg: c:

http://contoso.com/track01.wma).

Returns

Nothing

Stop

Sound.Stop(filePath)

Stops playback of an audio file. If the file was not already playing, this operation will not do anything.

filePath

The path for the audio file. This could either be a local file (eg: c:

http://contoso.com/track01.wma).

Returns

Nothing

Stack

Plays an audio file and waits until it is finished playing. This could be an mp3 or wav or wma file. Other file formats may or may not play depending on the audio codecs installed on the user's computer. If the file was already paused, this operation will resume from the position where the

The path for the audio file. This could either be a local file (eg: c:\music\track1.mp3) or a file on the network (eg:

Pauses playback of an audio file. If the file was not already playing, this operation will not do

This could either be a local file (eg: c:\music\track1.mp3) or a file on the network (eg:

If the file was not already playing, this operation will not do anything.

The path for the audio file. This could either be a local file (eg: c:\music\track1.mp3) or a file on the network (eg:

Plays an audio file and waits until it is finished playing. This could be an mp3 or wav or wma file. installed on the user's

computer. If the file was already paused, this operation will resume from the position where the

e network (eg:

Pauses playback of an audio file. If the file was not already playing, this operation will not do

track1.mp3) or a file on the network (eg:

If the file was not already playing, this operation will not do anything.

track1.mp3) or a file on the network (eg:

Page 40: Small Basic Code Reference

This object provides a way of storing values just like stacking up a plate. You can push a value to the top of the stack and pop it off. You can only pop the values one by one off the stack and the last pushed value will be the first one to pop out.

Operations PushValue

Stack.PushValue(stackName, value)

Pushes a value to the specified stack.

stackName

The name of the stack.

value

The value to push.

Returns

Nothing

GetCount

Stack.GetCount(stackName)

Gets the count of items in the specified stack.

stackName

The name of the stack.

Returns

The number of items in the specified stack.

PopValue

Stack.PopValue(stackName)

Pops the value from the specified stack.

stackName

The name of the stack.

Returns

The value from the stack.

TextWindow

The TextWindow provides text-related input and output functionalities. For example using this class, it is possible to write or read some text or number to and from the text

This object provides a way of storing values just like stacking up a plate. You can push a value to the top of the stack and pop it off. You can only pop the values one by one off the stack and the last pushed value will be the first one to pop out.

Pushes a value to the specified stack.

Gets the count of items in the specified stack.

The number of items in the specified stack.

Pops the value from the specified stack.

related input and output functionalities. For example using this class, it is possible to write or read some text or number to and from the text-based text window.

This object provides a way of storing values just like stacking up a plate. You can push a value to the top of the stack and pop it off. You can only pop the values one by one off the stack and the last

related input and output functionalities. For example using this class, based text window.

Page 41: Small Basic Code Reference

Properties ForegroundColor

TextWindow.ForegroundColor

Gets or sets the foreground color of the text to be output in the text window.

BackgroundColor

TextWindow.BackgroundColor

Gets or sets the background color of the text to be output in the text window.

CursorLeft

TextWindow.CursorLeft

Gets or sets the cursor's column position on the text window.

CursorTop

TextWindow.CursorTop

Gets or sets the cursor's row position on the text window.

Left

TextWindow.Left

Gets or sets the Left position of the Text Window.

Title

TextWindow.Title

Gets or sets the Title for the text window.

Top

TextWindow.Top

Gets or sets the Top position of the Text Window.

Operations Show

TextWindow.Show()

Shows the Text window to enable interactions with it.

Returns

Nothing

sets the foreground color of the text to be output in the text window.

Gets or sets the background color of the text to be output in the text window.

column position on the text window.

Gets or sets the cursor's row position on the text window.

Gets or sets the Left position of the Text Window.

the text window.

Gets or sets the Top position of the Text Window.

Shows the Text window to enable interactions with it.

Page 42: Small Basic Code Reference

Hide

TextWindow.Hide()

Hides the text window.

Returns

Nothing

Clear

TextWindow.Clear()

Clears the TextWindow.

Returns

Nothing

Pause

TextWindow.Pause()

Waits for user input before returning.

Returns

Nothing

PauseIfVisible

TextWindow.PauseIfVisible()

Waits for user input only when the TextWindow

Returns

Nothing

PauseWithoutMessage

TextWindow.PauseWithoutMessage()

Waits for user input before returning.

Returns

Nothing

Read

TextWindow.Read()

Reads a line of text from the text window.

Returns

The text that was read from the text window

Waits for user input before returning.

Waits for user input only when the TextWindow is already open.

Waits for user input before returning.

Reads a line of text from the text window. This function will not return until the user hits ENTER.

The text that was read from the text window

This function will not return until the user hits ENTER.

Page 43: Small Basic Code Reference

ReadKey

TextWindow.ReadKey()

Reads a single character from the text window.

Returns

The character that was read from the text window.

ReadNumber

TextWindow.ReadNumber()

Reads a number from the text window. This function will not return until the user hits ENTER.

Returns

The number that was read from the text window

WriteLine

TextWindow.WriteLine(data)

Writes text or number to the text window. A new line character will be appended to the output, so that the next time something is written to the text window, it will go in a new line.

data

The text or number to write to the text window.

Returns

Nothing

Write

TextWindow.Write(data)

Writes text or number to the text window. A new line character will be appended to the output, so that the next time something is written to the text window, it will go in a new line.

data

The text or number to write to the text window.

Returns

Nothing

Text

The Text object provides helpful operations for working with Text.

Operations

Reads a single character from the text window.

The character that was read from the text window.

Reads a number from the text window. This function will not return until the user hits ENTER.

The number that was read from the text window

window. A new line character will be appended to the output, so that the next time something is written to the text window, it will go in a new line.

The text or number to write to the text window.

text or number to the text window. A new line character will be appended to the output, so that the next time something is written to the text window, it will go in a new line.

The text or number to write to the text window.

The Text object provides helpful operations for working with Text.

Reads a number from the text window. This function will not return until the user hits ENTER.

window. A new line character will be appended to the output, so

text or number to the text window. A new line character will be appended to the output, so

Page 44: Small Basic Code Reference

Append

Text.Append(text1, text2)

Appends two text inputs and returns the result as another text. This operation is particularly useful when dealing with unknown text in added, instead of getting appended.

text1

First part of the text to be appended.

text2

Second part of the text to be appended.

Returns

The appended text containing both the specified parts.

GetLength

Text.GetLength(text)

Gets the length of the given text.

text

The text whose length is needed.

Returns

The length of the given text.

IsSubText

Text.IsSubText(text, subText)

Gets whether or not a given subText is a subset of the larger text.

text

The larger text within which the sub-text will be searched.

subText

The sub-text to search for.

Returns

True if the subtext was found within the given text.

EndsWith

Text.EndsWith(text, subText)

Gets whether or not a given text ends with the specified subText.

text

The larger text to search within.

subText

Appends two text inputs and returns the result as another text. This operation is particularly useful when dealing with unknown text in variables which could accidentally be treated as numbers and get added, instead of getting appended.

The appended text containing both the specified parts.

Gets whether or not a given subText is a subset of the larger text.

text will be searched.

True if the subtext was found within the given text.

Gets whether or not a given text ends with the specified subText.

Appends two text inputs and returns the result as another text. This operation is particularly useful variables which could accidentally be treated as numbers and get

Page 45: Small Basic Code Reference

The sub-text to search for.

Returns

True if the subtext was found at the end of the given text.

StartsWith

Text.StartsWith(text, subText)

Gets whether or not a given text starts with the specified subText.

text

The larger text to search within.

subText

The sub-text to search for.

Returns

True if the subtext was found at the start of the given text.

GetSubText

Text.GetSubText(text, start, length)

Gets a sub-text from the given text.

text

The text to derive the sub-text from.

start

Specifies where to start from.

length

Specifies the length of the sub text.

Returns

The requested sub-text

GetSubTextToEnd

Text.GetSubTextToEnd(text, start)

Gets a sub-text from the given text from a specified position to the end.

text

The text to derive the sub-text from.

start

Specifies where to start from.

Returns

The requested sub-text.

GetIndexOf

True if the subtext was found at the end of the given text.

Gets whether or not a given text starts with the specified subText.

True if the subtext was found at the start of the given text.

text from the given text.

text from the given text from a specified position to the end.

Page 46: Small Basic Code Reference

Text.GetIndexOf(text, subText)

Finds the position where a sub-text appears in the specified text.

text

The text to search in.

subText

The text to search for.

Returns

The position at which the sub-text appears in the specified text. If the text doesn't appear, it returns 0.

ConvertToLowerCase

Text.ConvertToLowerCase(text)

Converts the given text to lower case.

text

The text to convert to lower case.

Returns

The lower case version of the given text.

ConvertToUpperCase

Text.ConvertToUpperCase(text)

Converts the given text to upper case.

text

The text to convert to upper case.

Returns

The upper case version of the given text.

GetCharacter

Text.GetCharacter(characterCode)

Given the unicode character code, gets the corresponding character, which can then be used with regular text.

characterCode

The character code (Unicode based) for the required character.

Returns

A unicode character that corresponds to the code specified.

GetCharacterCode

Text.GetCharacterCode(character)

text appears in the specified text.

text appears in the specified text. If the text doesn't appear, it returns 0.

Converts the given text to lower case.

Converts the given text to upper case.

Given the unicode character code, gets the corresponding character, which can then be used with

The character code (Unicode based) for the required character.

A unicode character that corresponds to the code specified.

Given the unicode character code, gets the corresponding character, which can then be used with

Page 47: Small Basic Code Reference

Given a unicode character, gets the corresponding character code.

character

The character whose code is requested.

Returns

A unicode based code that corresponds to the character specified.

Timer

The Timer object provides an easy way for doing something repeatedly with a constant interval between.

Properties Interval

Timer.Interval

Gets or sets the interval (in milliseconds) specifying how often the timer should raise the Tick event. This value can range from 10 to 100000000

Events Tick

Timer.Tick

Raises an event when the timer ticks.

Operations Pause

Timer.Pause()

Pauses the timer. Tick events will not be raised.

Returns

Nothing

Resume

Timer.Resume()

Resumes the timer from a paused state. Tick events will now be raised.

Returns

Nothing

Given a unicode character, gets the corresponding character code.

A unicode based code that corresponds to the character specified.

The Timer object provides an easy way for doing something repeatedly with a constant interval

Gets or sets the interval (in milliseconds) specifying how often the timer should raise the Tick event. This value can range from 10 to 100000000

Raises an event when the timer ticks.

Pauses the timer. Tick events will not be raised.

Resumes the timer from a paused state. Tick events will now be raised.

The Timer object provides an easy way for doing something repeatedly with a constant interval

Gets or sets the interval (in milliseconds) specifying how often the timer should raise the Tick event.

Page 48: Small Basic Code Reference

Turtle

The Turtle provides Logo-like functionality to draw shapes by and drawing primitives.

Properties Speed

Turtle.Speed

Specifies how fast the turtle should move. Valid values are 1 to 10. If Speed is set to 10, the turtle moves and rotates instantly.

Angle

Turtle.Angle

Gets or sets the current angle of the turtle. While setting, this will turn the turtle instantly to the new angle.

X

Turtle.X

Gets or sets the X location of the Turtle. While setting, this will move the turtle instantly to the new location.

Y

Turtle.Y

Gets or sets the Y location of the Turtle. While setting, this will move the turtle instantly to the new location.

Operations Show

Turtle.Show()

Shows the Turtle to enable interactions with it.

Returns

Nothing

Hide

Turtle.Hide()

like functionality to draw shapes by manipulating the properties of a pen

Specifies how fast the turtle should move. Valid values are 1 to 10. If Speed is set to 10, the turtle

sets the current angle of the turtle. While setting, this will turn the turtle instantly to the new

Gets or sets the X location of the Turtle. While setting, this will move the turtle instantly to the new

sets the Y location of the Turtle. While setting, this will move the turtle instantly to the new

Shows the Turtle to enable interactions with it.

manipulating the properties of a pen

Specifies how fast the turtle should move. Valid values are 1 to 10. If Speed is set to 10, the turtle

sets the current angle of the turtle. While setting, this will turn the turtle instantly to the new

Gets or sets the X location of the Turtle. While setting, this will move the turtle instantly to the new

sets the Y location of the Turtle. While setting, this will move the turtle instantly to the new

Page 49: Small Basic Code Reference

Hides the Turtle and disables interactions with it.

Returns

Nothing

PenDown

Turtle.PenDown()

Sets the pen down to enable the turtle to draw as it moves.

Returns

Nothing

PenUp

Turtle.PenUp()

Lifts the pen up to stop drawing as the turtle moves.

Returns

Nothing

Move

Turtle.Move(distance)

Moves the turtle to a specified distance. If the pen is down, it will draw a line as it moves.

distance

The distance to move the turtle.

Returns

Nothing

MoveTo

Turtle.MoveTo(x, y)

Turns and moves the turtle to the specified location. If the pen

x

The x co-ordinate of the destination point.

y

The y co-ordinate of the destination point.

Returns

Nothing

Turn

Turtle.Turn(angle)

interactions with it.

Sets the pen down to enable the turtle to draw as it moves.

Lifts the pen up to stop drawing as the turtle moves.

Moves the turtle to a specified distance. If the pen is down, it will draw a line as it moves.

Turns and moves the turtle to the specified location. If the pen is down, it will draw a line as it moves.

ordinate of the destination point.

ordinate of the destination point.

Moves the turtle to a specified distance. If the pen is down, it will draw a line as it moves.

is down, it will draw a line as it moves.

Page 50: Small Basic Code Reference

Turns the turtle by the specified angle.the angle is positive, the turtle turns to its right. If it is negative, the turtle turns to its left.

angle

The angle to turn the turtle.

Returns

Nothing

TurnRight

Turtle.TurnRight()

Turns the turtle 90 degrees to the right.

Returns

Nothing

TurnLeft

Turtle.TurnLeft()

Turns the turtle 90 degrees to the left.

Returns

Nothing

Turns the turtle by the specified angle. Angle is in degrees and can be either positive or negative. If the angle is positive, the turtle turns to its right. If it is negative, the turtle turns to its left.

the turtle 90 degrees to the right.

Turns the turtle 90 degrees to the left.

Angle is in degrees and can be either positive or negative. If the angle is positive, the turtle turns to its right. If it is negative, the turtle turns to its left.