Q7Basic's Language Reference

Q7Basic comes with extensive documentation, with hypertext cross-references throughout, so you can easily click your way to whatever interests you. The part of the documentation that you will probably use the most is the this Language Reference. Each link provides a different way of navigating the this Language Reference; try them all to see which work best for you. Q7Basic ships with lots of small and some medium-sized example programs that teach you how to implement various tasks. Most of them will show how to use a certain class or module, others aim at programming techniques and basics, and some of them simply want to show you what is possible.

Names starting with 'Q' normally directly points to native Qt names in general. If you would like to send a comment or an example, please write to mailto:sales@kbasic.com. This new framework provides many improvements and enhancements over previous releases. This overview covers the most important features. Q7Basic will be continuously improved as a result of feedback and suggestions from customers and the open source community.

Last edit on 08:58, 22 June 2011 (UTC)

Subs

Sub-procedures contain commands and statements, but do not return a value or cannot be used in expressions. The following built-in subs are predefined subs, which has a special meaning and which meaning cannot be changed. Some of them are provided for VB6 backward compatibility.

Beep CLS Call Color DoEvents ExecAfterMSec Hide HideScreen Line Locate OpenHtmlWindow OpenTextWindow OpenWebWindow PSet Print PrintScreen Quit Randomize ReconnectSignals SetFocus SetFocusMDI SetFocusWindow Show ShowMaximized ShowMinimized ShowNormal ShowOrHide ShowScreen Wait

Functions

A function-procedure is like a sub-procedure, but it can return a value. That is the only difference between them. The following built-in functions are predefined functions, which has a special meaning and which meaning cannot be changed. Some of them are provided for VB6 backward compatibility.

Abs AddDays AddHours AddMinutes AddMonths AddSeconds AddYears Append Asc At Atn BLOB BOOLEAN Bin BitClr BitSet BitTst Boolean CBool CByte CDate CDbl CDec CInt CLng CSRLin CShort CSng Character Chr Close CloseAllMDI CloseDockWidget CloseMDI CloseToolWindow CloseWindow Compare Concat Contains Copy CopyDir Cos Count Date DateAdd DateDiff DatePart DateSerial DateTime DateValue Day DayName DayOfWeek DayOfYear DaysInMonth DaysInYear Decimal Delete DiffDays DiffSeconds Dir Drives EOF EndsWith Exp FLOAT Fact File FileBaseName FileExtension FileName FilePath Fill Fix Float Focus FocusMDI FocusWindow Format FormatDateTime FormatFloat FreeFile Hex Hour INTEGER InStr InStrRev IndexOf InputBox Insert Int Integer IsBoolean IsByte IsDateTime IsDateTimeValid IsDateValid IsDecimal IsDouble IsEmpty IsFloat IsInt16 IsInt32 IsInt64 IsInt8 IsInteger IsList IsShort IsSingle IsString IsTimeValid Join LBound LCase LTrim LastIndexOf Launch Left LeftJustified Len ListMDI Ln LoadUI Log10 Lower MD5 Max MessageBox Mid Min Minute Month MonthName Move MsgBox Now Nz OpenDialog OpenDockWidget OpenEmail OpenMDI OpenSDI OpenToolWindow OpenURL OpenWindow Pos Prepend RND RTrim Random ReadCString ReadDictionary ReadLines ReadList ReadRegistry ReadString Remove Replace Reversed Right Round Run SQLite Second Section Shell Simplified Sin Space Split Sqr StartsWith Str StrReverse String SubDays SubHours SubMinutes SubMonths SubSeconds SubYears TEXT Tan Time TimeSerial TimeValue Trim Truncate UBound UCase Unicode UnloadUI Upper Val Value WeekNumber WeekdayName WriteCString WriteDictionary WriteList WriteString Year

Objects

Application CMath ColorDialog Colors Database Debug Desktop Dir (Object) File (Object) FontDialog Fonts InputDialog MainWindow MessageBox OS OpenFileDialog Pixmaps Preferences ProgressDialog Query Records SaveFileDialog Sounds StatusBar SystemTray Table ToolBar

Classes

CheckBox Class CommandButton CommandLinkButton Control Frame ImageBox ImageButton Label Module PhononSeekSlider PhononVideoPlayer PhononVolumeSlider QAbstractButton QAction QButtonGroup QCalendarWidget QCheckBox QCloseEvent QColumnView QComboBox QCommandLinkButton QDateEdit QDateTimeEdit QDeclarativeView QDial QDialog QDialogButtonBox QDockWidget QDoubleSpinBox QFocusEvent QFontComboBox QFormLayout QFrame QGraphicsView QGridLayout QGroupBox QHBoxLayout QIcon QLabel QLCDNumber QLineEdit QListView QListWidget QMainWindow QMdiArea QMenu QMenuBar QObject QPainter QPaintEvent QPlainTextEdit QProgressBar QPushButton QRadioButton QResizeEvent QScrollArea QScrollBar QSlider QSpinBox QStackedWidget QStatusBar QTableView QTableWidget QTabWidget QTextBrowser QTextEdit QTimeEdit QToolBar QToolBox QToolButton QTreeView QTreeWidget QVBoxLayout QWebView QWidget RadioButton TextBox Timer ToolButton UdpSocket uiClass

Inheritance Tree of built-in Qt classes

QObject is the root class of most classes. Through id, objects inherit a basic interface to the runtime system.

QObject


Controls

This is the parent class of all controls providing common functionality for all controls (used by the form designer). It receives mouse, keyboard and other events from the window system, and paints a representation of itself on the screen.

Control


Keywords

A keyword is a predefined identifier, which has a special meaning for Q7Basic and which meaning cannot be changed. The following list contains all Q7Basic keywords. Be aware that keywords are case sensitive, which means you must it write with the same lowercase or uppercase letters everywhere. Some of them are provided for backward compatibility.

</string> <string> Alias As Break ByRef ByVal Case Class Const Continue Declare Dim Do Else End Enum Event Exit False For Form Function Global GoTo IIf If Is Iterate LBound Loop Me Mid Module Next Null Outlet Preserve Private Property Public ReDim Return Select Set Signal Slot Static Step Sub Super Then To True Type UBound Until While uiClass

Types

Like a file, a variable has a name (used to access the variable and to identify it). Additional, it has also a data type to specify the type of information a variable holds. So data types describe the type of data stored inside a variable. If you declare a variable you must also give it a data type. Unlike built-in classes, the following types cannot be used as super class for custom classes.

Boolean Byte CString DateTime Decimal Dictionary Double Float Int16 Int32 Int64 Int8 Integer List Object Short Single String id

Constants

Constants are similar to variables but they cannot change values. When you declare a constant you assign a value to it that cannot be altered during the lifetime of your program.

Alignment.AlignAbsolute Alignment.AlignBottom Alignment.AlignCenter Alignment.AlignHCenter Alignment.AlignHorizontal_Mask Alignment.AlignJustify Alignment.AlignLeading Alignment.AlignLeft Alignment.AlignRight Alignment.AlignTop Alignment.AlignTrailing Alignment.AlignVCenter Alignment.AlignVertical_Mask CaseInsensitive CaseSensitive CheckState.Checked CheckState.PartiallyChecked CheckState.Unchecked Dir.AllDirs Dir.AllEntries Dir.CaseSensitive Dir.Dirs Dir.Drives Dir.Executable Dir.Files Dir.Hidden Dir.Modified Dir.NoDotAndDotDot Dir.NoFilter Dir.NoSymLinks Dir.Readable Dir.System Dir.Writable EchoMode.NoEcho EchoMode.Normal EchoMode.Password EchoMode.PasswordEchoOnEdit Flags.ItemIsDragEnabled Flags.ItemIsDropEnabled Flags.ItemIsEditable Flags.ItemIsEnabled Flags.ItemIsSelectable Flags.ItemIsTristate Flags.ItemIsUserCheckable Flags.NoItemFlags InputDialog.NoEcho InputDialog.Normal InputDialog.Password InputDialog.PasswordEchoOnEdit MatchFlags.MatchCaseSensitive MatchFlags.MatchContains MatchFlags.MatchEndsWith MatchFlags.MatchExactly MatchFlags.MatchFixedString MatchFlags.MatchRecursive MatchFlags.MatchRegExp MatchFlags.MatchStartsWith MatchFlags.MatchWildcard MatchFlags.MatchWrap MessageBox.Abort MessageBox.AcceptRole MessageBox.ActionRole MessageBox.Apply MessageBox.ApplyRole MessageBox.Cancel MessageBox.Close MessageBox.Critical MessageBox.DestructiveRole MessageBox.Discard MessageBox.Help MessageBox.HelpRole MessageBox.Ignore MessageBox.Information MessageBox.InvalidRole MessageBox.No MessageBox.NoButton MessageBox.NoIcon MessageBox.NoRole MessageBox.NoToAll MessageBox.Ok MessageBox.Open MessageBox.Question MessageBox.RejectRole MessageBox.Reset MessageBox.ResetRole MessageBox.RestoreDefaults MessageBox.Retry MessageBox.Save MessageBox.SaveAll MessageBox.Sheet MessageBox.Warning MessageBox.Yes MessageBox.YesRole MessageBox.YesToAll MsgBox.Abort MsgBox.Apply MsgBox.Cancel MsgBox.Close MsgBox.Discard MsgBox.Help MsgBox.Ignore MsgBox.No MsgBox.NoButton MsgBox.NoToAll MsgBox.Ok MsgBox.Open MsgBox.Reset MsgBox.RestoreDefaults MsgBox.Retry MsgBox.Save MsgBox.SaveAll MsgBox.Yes MsgBox.YesToAll QDialog.Accepted QDialog.Rejected QMdiArea.SubWindowView QMdiArea.TabbedView QTableWidget.MatchCaseSensitive QTableWidget.MatchContains QTableWidget.MatchEndsWith QTableWidget.MatchExactly QTableWidget.MatchFixedString QTableWidget.MatchRecursive QTableWidget.MatchRegExp QTableWidget.MatchStartsWith QTableWidget.MatchWildcard QTableWidget.MatchWrap SectionCaseInsensitiveSeps SectionDefault SectionIncludeLeadingSep SectionIncludeTrailingSep SectionSkipEmpty SystemTray.Context SystemTray.Critical SystemTray.DoubleClick SystemTray.Information SystemTray.MiddleClick SystemTray.NoIcon SystemTray.Trigger SystemTray.Unknown SystemTray.Warning TextAlignment.AlignAbsolute TextAlignment.AlignBottom TextAlignment.AlignCenter TextAlignment.AlignHCenter TextAlignment.AlignHorizontal_Mask TextAlignment.AlignJustify TextAlignment.AlignLeading TextAlignment.AlignLeft TextAlignment.AlignRight TextAlignment.AlignTop TextAlignment.AlignTrailing TextAlignment.AlignVCenter TextAlignment.AlignVertical_Mask TextInteractionFlags.LinksAccessibleByKeyboard TextInteractionFlags.LinksAccessibleByMouse TextInteractionFlags.NoTextInteraction TextInteractionFlags.TextBrowserInteraction TextInteractionFlags.TextEditable TextInteractionFlags.TextEditorInteraction TextInteractionFlags.TextSelectableByKeyboard TextInteractionFlags.TextSelectableByMouse vbAbort vbAbortRetryIgnore vbCancel vbCr vbCrLf vbCritical vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbExclamation vbIgnore vbInformation vbLf vbNo vbOK vbOKCancel vbOKOnly vbQuestion vbRetry vbRetryCancel vbYes vbYesNo vbYesNoCancel

Operators

Operators for calculating, comparision, logical operators and other Operators.

! " & ' ( ) * + - . / : <= <> = == === >= And AndAlso Flip Mod Not Or OrElse Shl Shr Xor \ ^

Operator Order

Normally, an expression is executed from left to right following standard mathematical rules. Here is the overview about operator order (priority) from top to bottom, which means * is executed before And:

  1. . ! ( )
  2. Not Flip (unary +) (unary -)
  3. * / \ Mod
  4. & + -
  5. ^
  6. Shl Shr
  7. < > < = >= = == ===
  8. And
  9. Or Xor
  10. AndAlso
  11. OrElse

Use paranthesis () to change the order.

Sub-Classing

Most built-in Qt classes may be used to create new classes (a sub-class) based on an existing Qt class. Change the file extension of a code file in order to do so.

Example: file name is 'Car.QObject'.

Class name is 'Car' and super class is 'QObject' (the file extension).

Control Flow and structure

Decisions: The term 'decisions' refers to the use of conditional statements to decide what to execute in your program. Conditional statements test if a given expression is 'True' or 'False.'Then, statements are executed. Normally a condition uses an expression in which a comparison operator is used to compare two values or variables.

Loops: The statements that control decisions and loops are called control structures. Normally every command is executed only one time but in many cases it may be useful to run a command several times until a defined state has been reached. Loops repeat commands depending upon a condition. Some loops repeat commands while a condition is 'True,' other loops repeat commands while a condition is 'False.' There are other loops repeating a fixed number of times and some repeat for all elements of a collection.

Class : Classes are needed, when you would like use custom objects.


Module : Modules are needed, when you would like to organize large code parts


Do...Loop Until : repeats until a condition is set


Do...Loop While : repeats statements while condition is set


Do Until...Loop : A group of statements enabling you to define a loop which will be repeated until a certain condition remains true.


Do While...Loop : A group of statements enabling you to define a loop which will be repeated until a certain condition remains true.


Break : breaks out of a loop wether it is a for loop or not


Exit Do : breaks out of a loop


Exit For : breaks out of a for loop


Exit Function : exits a function


Exit Sub : exits a sub


For Next : Defines a loop that runs for a specified number of times.


GoTo : jumps to the desired label or line


If : single decision possibility


IIf : returns a value depending on an expression


Continue : continues to iterate a loop wether it is a for loop or not


Iterate Do : continues to iterate a loop if condition is set


Iterate For : continues to iterate a for loop if condition is set


Return : returns either from a gosub call or leaves the function or sub


Select : Multi-line conditional selection statement.


While...End While : A group of statements enabling you to define a loop which will be repeated until a certain condition remains true.

Comments

The comment symbol ' is used to mark comments in code. Comments can explain a procedure or a statement. Q7Basic ignores all comments while compiling and running your program. To write a comment, use the symbol ' followed by the text of the comment. Comments are printed in green on screen. Comments are extremely helpful when it comes to explaining your code to other programmers. So comments, normally, describe how your program works.

  • ' Code is recognized as comment till the end of the current line.


Literals

Besides keywords, symbols, and names, a Q7Basic program contains literals. A literal is a number or string representing a value. There are different numerical literals.

Integer-1, 2, -44, 4453
Float21.32, 0.344, -435.235421.21
Decimal21.99D, 0.3456D
StringIs simply text, but it must start with a " and end with a " so that Q7Basic can recognize it as string. Strings uses the same escape codes as C++ strings. Important escape codes are: \" = Double quotation mark, \\ = Backslash
BooleanTrue, False


Appendix: Versions / Release Notes

The following list gives you an overview about the released versions and their changes.

V1.0

Appendix: Way of naming

When coding in Q7Basic, you declare and name elements, like procedures (functions and subs), variables, and constants and so on. All names must start with a letter; may contain letters, numbers, or the sign _ (periods and commas are forbidden); and must not contain reserved words. A reserved word is a part of Q7Basic and has a predefined meaning. These include keywords (e.g. If or Then), builtin-functions and operators (e.g. Mod). Be aware that names are case sensitive, which means you must it write with the same lowercase or uppercase letters everywhere.


Appendix: List of C++ Keywords

The following list contains all C++ keywords, which must not be used in Q7Basic code.

Q7B asm auto bad_cast bad_typeid bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum except explicit extern false finally float for friend goto id if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try type_info typedef typeid typename ui union unsigned using virtual void volatile while

Appendix: Syntax of Arguments

The following list gives you some hints regarding how to read the syntax provided here.

Arguments listed inside brackets [ ] are optional. (Do not write these [ ] in your code).

{ } together with | means that one of the elements must be written. (Do not write these { } or | in your code).

_______Subs_______

-------Misc.-------

Beep

Produces a sound. Depends on the system if it works. The Beep function is implemented using the Qt function qapplication.html#beep.
You may use Application.PlaySound(String) instead.


Call

The given signal is raised after the given milli seconds. If there is no such signal, nothing happens.


Example

Signal on_ProjectOpen() 
   MsgBox("Hello")
End Signal

Event Init()
  ExecAfterMSec(100, on_ProjectOpen) 
End Event


DoEvents

DoEvents() processes GUI events of the application.


ExecAfterMSec

The given signal is raised after the given milli seconds. If there is no such signal, nothing happens.


Example

Signal on_ProjectOpen() 
   MsgBox("Hello")
End Signal

Event Init()
  ExecAfterMSec(100, on_ProjectOpen) 
End Event


Quit

The Quit function is implemented using the Qt function qcoreapplication.html#quit.


ReconnectSignals

  • Sub ReconnectSignals(Argument As id)

ReconnectSignals(...) e.g. you have a QButtonGroup or any control which connects to signal automatically, do this in the code file, it is declared, so if you declare a QButtonGroup in Global.QObject, it is expected to have a

Signal on_MYCONTROL_buttonClicked(ky As QAbstractButton)
End Signal

Cannot change this behaviour, but I can provide a built-in function, which could be called, before controls are used


Wait

Blocks the app (current thread). Events are not processed.


See also Sleep

-------Math-------

Randomize

  • Sub Randomize()

Randomize() restarts the internal random number generator based on the current local system time. Using it only makes sense, if you want to use the Random() function as well.


See also Random

-------Screen-------

CLS

On the terminal screen, CLS will clear the screen and returns the cursor to the upper left corner (line 1, column 1).


Example

Sub Main()
  ' CLS clearing the terminal screen
  ' with a new background color

  Dim keypressed
  Print "This is to show the CLS command"
  Input "To clear the screen, press [Return]", keypressed

  ' changes the background color:
  Color(2, 4)
  CLS
  Print "This is green text on a blue screen!"
End Sub


See also Print

Color

Calling it will set the color of either the foreground and optionally the background. Passing only one integer will change the fore color. Passing 2 will change both the fore and background color.


Example

Sub Main()
  Color(5)
  Print "Hi"
  Color(15, 1)
  Print "Nadja"
End Sub


HideScreen

  • Sub HideScreen()


Line

Draws a line on the screen. Color might be a value between 0…255. Provided for QBasic compatibility.


Example

CLS

Dim a As Integer
For a = 1 To 15
  Line(10, a * 80) - (1000, a * 80), 15
Next


Locate

Sets the cursor position on screen. Provided for QBasic backward compatibility.


Example

CLS
Dim row, column

Locate 5, 5
row = CSRLin
column = Pos(0)
Print "position 1 (press any key)"
Do
Loop While Inkey$ = ""
Locate (row + 2), (column + 2)
Print "position 2"


PSet

Draws a point on screen. Step is not supported. Provided for QBasic backward compatibility.


Example

Dim x, y
For y = 0 To 200
  For x = 0 To 320
    PSet(x, y)
  Next
Next


See also Line

Print

Provided for QBasic backward compatibility.


Example

Print "Hello baby!"; ":-)", "----"

Dim s As String = "1"
Dim s2 As String = "2"
Dim s3 As String = "3"
 
Print s, s2, s3


PrintScreen

Prints the screen. If PrintDialog = True, the print dialog appears before printing.


ShowScreen

  • Sub ShowScreen()


-------ui-------

Hide


OpenHtmlWindow


OpenTextWindow


OpenWebWindow


SetFocus


SetFocusMDI


SetFocusWindow


Show


ShowMaximized


ShowMinimized


ShowNormal


ShowOrHide



_______Functions_______

-------Misc.-------

ReadRegistry


-------Array-------

LBound

LBound(...) return the lower boundary index of an array declared with [], which is always 0 in Q7Basic.


UBound

UBound(...) return the count of dimension (upper boundary index) of an array declared with [].


-------Conversion-------

Boolean

Tries to convert an expression to a boolean. Locale is ignored for now.


CBool

Tries to convert an expression to a boolean. Locale is ignored for now.


CByte

Tries to convert an expression to an integer type. This will remove any precision from a float value. Locale is ignored for now.


CDate

Tries to convert an expression to a DateTime. Locale is ignored for now.


CDbl

Tries to convert an expression to a Float. Locale is ignored for now.


See also CSng, CInt, CLng

CDec

Tries to convert an expression to a Decimal. Locale is ignored for now.


CInt

Tries to convert an expression to an integer type. This will remove any precision from a float value. Locale is ignored for now.


CLng

Tries to convert an expression to an integer type. This will remove any precision from a float value. Locale is ignored for now.


CShort

Tries to convert an expression to an integer type. This will remove any precision from a float value. Locale is ignored for now.


CSng

Tries to convert an expression to a Float. Locale is ignored for now.


See also CSng, CInt, CLng

DateTime

Tries to convert an expression to a DateTime. Locale is ignored for now.


Decimal

Tries to convert an expression to a Decimal. Locale is ignored for now.


Float

Tries to convert an expression to a Float. Locale is ignored for now.


See also CSng, CInt, CLng

Integer

Tries to convert an expression to an integer type. This will remove any precision from a float value. Locale is ignored for now.


IsBoolean

Returns true if a variable represents a boolean type.


Example

Dim x As Boolean

Print IsBoolean(x)


IsByte

Returns true if a variable represents an integer (Byte, Short...) type.



Example


Dim i As Byte 
Dim x As String

Print IsByte(i) 
Print IsByte(x)


IsDateTime

Returns true if a variable represents a datetime type.


IsDecimal

Returns true if a variable represents a Decimal type.


Example

Dim c As Decimal 

c = 23.67D ' decimal literal

MsgBox(IsDecimal(c))


IsDouble

Returns true if a variable represents a float type.



Example


Dim i As Float
Dim x As String

Print IsFloat(i) 
Print IsFloat(x)


IsFloat

Returns true if a variable represents a float type.



Example


Dim i As Float
Dim x As String

Print IsFloat(i) 
Print IsFloat(x)


IsInt16

Returns true if a variable represents an integer (Byte, Short...) type.



Example


Dim i As Byte 
Dim x As String

Print IsByte(i) 
Print IsByte(x)


IsInt32

Returns true if a variable represents an integer (Byte, Short...) type.



Example


Dim i As Byte 
Dim x As String

Print IsByte(i) 
Print IsByte(x)


IsInt64

Returns true if a variable represents an integer (Byte, Short...) type.



Example


Dim i As Byte 
Dim x As String

Print IsByte(i) 
Print IsByte(x)


IsInt8

Returns true if a variable represents an integer (Byte, Short...) type.



Example


Dim i As Byte 
Dim x As String

Print IsByte(i) 
Print IsByte(x)


IsInteger

Returns true if a variable represents an integer (Byte, Short...) type.



Example


Dim i As Byte 
Dim x As String

Print IsByte(i) 
Print IsByte(x)


IsList

Returns true if a variable or an expression represents a list type.


Example

Dim i As List
Dim x As String

MsgBox(IsList(i))
MsgBox(IsList(x))


IsShort

Returns true if a variable represents an integer (Byte, Short...) type.



Example


Dim i As Byte 
Dim x As String

Print IsByte(i) 
Print IsByte(x)


IsSingle

Returns true if a variable represents a float type.



Example


Dim i As Float
Dim x As String

Print IsFloat(i) 
Print IsFloat(x)


IsString

Returns true if expression represents a string value.


Example

Dim i As Integer
Dim k As String

MsgBox(IsString(i))
MsgBox(IsString(k))


Str

Converts a number to a string. Locale is ignored for now.


Example

MsgBox(Str(239.546))


See also Asc, Val

String

Converts a number to a string. Locale is ignored for now.


Example

MsgBox(Str(239.546))


See also Asc, Val

-------DateTime-------

AddDays


AddHours


AddMinutes


AddMonths


AddSeconds


AddYears


Date

Returns the current system date as string. Setting the date is not possible with this function. Format is yyyy-MM-dd.


See also Time

DateAdd

Adds something to a date.

interval values:


yyyy year

q quarter

M month

y day of year

d day

w weekday

ww week

h hour

n minute

s second




Example

Dim Date1 As DateTime
Dim Interval As String
Dim Number As Integer
Dim Msg
Interval = "m"
Date1 = InputBox("Input the date") ' #yyyy-MM-dd#
Number = Val(InputBox("Input the number of months to add"))
Msg = "New date: " & DateAdd(Interval, Number, Date1)
MsgBox(Msg)


See also DateDiff, DatePart, DateSerial, DateValue

DateDiff

Returns the number of interval laying between date1 and date2.

interval values:


yyyy year

q quarter

M month

y day of year

d day

w weekday

ww week

h hour

n minute

s second




Example

Dim Date1 As DateTime
Dim Msg
Date1 = InputBox("Input the date")
Msg = "Days till today: " & DateDiff("d", Now, Date1)
MsgBox(Msg)


See also DateAdd, DatePart, DateSerial, DateValue

DatePart

Returns the desired part of a date.

interval values:


yyyy year

q quarter

M month

y day of year

d day

w weekday

ww week

h hour

n minute

s second




Example

Dim Date1 As DateTime
Dim Msg
Date1 = InputBox("Input a date:")
Msg = "quarter: " & DatePart("q", Date1)
MsgBox(Msg)


See also DateAdd, DatePart, DateSerial, DateValue

DateSerial

Converts a date given by year, month and day into a big number.


Example

Dim Date1 As DateTime
Date1 = DateSerial(1969, 2, 12)' return Date1


See also DateAdd, DateDiff, DatePart, DateValue

DateValue

Converts a date given in a string into a date type.


Example

Dim Date1 As DateTime
Date1 = DateValue("1979-02-03")


See also DateAdd, DateDiff, DatePart, DateSerial

Day

Returns the day part of an date expression.


Example

Dim Date1, Day1
Date1 = DateValue("1979-02-12")
Day1 = Day(Date1) ' --> 12


DayName

Returns the name of the given weekday.


DayOfWeek


DayOfYear


DaysInMonth


DaysInYear


DiffDays


DiffSeconds


Hour

Returns the hour part of a datetime object.


IsDateTimeValid


IsDateValid


IsTimeValid


Minute

Returns the minute part of a datetime expression.


Month

Returns the month part of a date expression.


MonthName

Format may be short or long. If no Format is given, LongMonthName is used.


Example

Dim strMonatsname 

strMonatsname = MonthName(1)  ' January
strMonatsname = MonthName(1, True)  ' Jan


Now

Returns the current date and time as date time.


Example

MsgBox(Now())


Second

Returns the second part of a datetime expression.


SubDays


SubHours


SubMinutes


SubMonths


SubSeconds


SubYears


Time

Returns the current date as string. Setting the time is not possible with this function.


See also Date

TimeSerial

Returns a time as a integer.


Example

Dim Time1 
Time1 = TimeSerial(16, 35, 17) ' in integer format --> 16:35:17


TimeValue

Returns a time given in a string expression as a date.


Example

Dim Time1 
Time1 = TimeValue("4:35:17") ' return time string as datetime


WeekNumber


WeekdayName

Returns the name of the given weekday.


Year

Returns the year of a date.


-------Dictionary-------

ReadDictionary

ReadDictionary(...) loads an entire file from a path or on a website into a Dictionary.


WriteDictionary

WriteDictionary(...) saves the entire Array in a file to a given path.


-------File-------

Copy


CopyDir


Delete


Dir

Unlike the VB6 Dir function this function, tests if a directory exists. Look at the Dir object for directory listening.


Drives


EOF

EOF(...) returns true if end of file has been reached. In other words, it checks if end of file has been reached and return true if it has happened.


Example

Sub Main()
  Dim data
  Open "file1" For Input As #1 ' open file for reading
  Do While Not EOF(1) ' test for end of file
    Line Input #1, data ' get the data from file
    Print data 
  Loop
  Close #1 ' close file
End Sub


File


FreeFile


See also Open

Launch

If Wait = True, the executed command blocks until the command finished execution. If blocking works depends on the application started.


See also Run

Move


Run


See also Launch

Shell

Sends a command to the shell of the underlying operating system (internally uses the C function system(...)).


See also Run

-------List-------

ReadList

ReadList(...) loads an entire file from a path or on a website into an Array.


WriteList

WriteList(...) saves the entire List in a file to a given path.


-------Math-------

Abs

Abs(...) returns the absolute value of the given argument.


See also Atn

Atn

Atn(...) returns the principal arc tangent of x, in the interval [-pi/2,+pi/2] radians.


BitClr

BitClr(...) lets you set a single bit of an integer value to 0.


BitSet

BitSet(...) lets you set a single bit of an integer value to 1.


BitTst

BitTst(...) lets you retrieve a single bit of an integer value.


Cos

Cos(...) returns the cosine of the argument in radians.


Example

Sub Main()
  Const PI = 3.141592654
  Print Atn(Tan(PI / 4.0)), PI / 4.0 'result: .7853981635 .7853981635
  Print (Cos(180 * (PI / 180))) 'result: -1
  Print (Sin(90 * (PI / 180))) 'result: 1
  Print (Tan(45 * (PI / 180))) 'result: 1.000000000205103
End Main


See also Sin, Tan

Exp

Exp(...) returns the base-e exponential function of x, which is the e number raised to the power x.


Example

MsgBox(Exp(0), Exp(1)) 'result: 1 2.718282
MsgBox(Log10(1), Log10(Exp(1))) 'result: 0 1


See also Log10

Fact

Fact(...) is implemented as follows:


Example

Function test()
  Dim x As Float
  Dim y As Float

  y = 1
  For x = 1 To argument
    y = y * x
  Next
  Return y
End Function


Fix

Fix(...) removes the fraction part of a real number and returns the Integer portion only.


Example

MsgBox(Fix(12.49), Fix(12.54)) ' both results are : 12 


See also Int, CInt, CLng

Int

Int(...) returns the largest integer value that is not greater than the given argument (returns the next integer number <= given number).


Example

Dim n As Integer

n = Int(12.54)
MsgBox(n)

n = Int(-99.4)
MsgBox(n)


See also Fix, CInt

Ln

Ln(...) returns the natural logarithm of the given argument. The Ln function calculates the base “e” (or natural) logaritm of a number. Input number must be a positive (i.e. > 0).


Example

Dim x As Integer
x = 12
MsgBox(Ln(x))


Log10

Log10(...) returns the common (base-10) logarithm of the given argument (calculates the ten-based logarithmic of a number). Input number must be a positive (i.e. > 0).


See also Ln

Max

Max(...) compares two values and returns the bigger one. Both values are treated as Float values.


Example

MsgBox(44, 4)


See also Min

Min

Min(...) compares two values and returns the smaller one. Both values are treated as Float values.


See also Max

RND

RND(...) returns a float pseudo-random number. If an argument is given random values between 0 and the argument are returned only. If no argument is given, the next random number in the list is created and returned. If you use RND(...) the first time and you have not called Randomize() before, it is automatically called and new random numbers are created.


Example

Randomize
Dim x, y
x = Int(Random(6)) + 1 
y = Int(Random(6)) + 1 
MsgBox("2 turns with one dice: turn 1 = " & x & " and turn 2 = " & y)


See also Randomize

Random

Random(...) returns a float pseudo-random number. If an argument is given random values between 0 and the argument are returned only. If no argument is given, the next random number in the list is created and returned. If you use Random(...) the first time and you have not called Randomize() before, it is automatically called and new random numbers are created.


Example

Randomize
Dim x, y
x = Int(Random(6)) + 1 
y = Int(Random(6)) + 1 
MsgBox("2 turns with one dice: turn 1 = " & x & " and turn 2 = " & y)


See also Randomize

Round

Round(...) rounds a value, while Precision determines the number of digits after the decimal point.


Example

MsgBox(Round(34.45D, 2))
MsgBox(Round(34.456D, 2))
MsgBox(Round(34.451D, 2))
MsgBox(Round(34.4567D, 2))
MsgBox(Round(34.4561D, 2))
MsgBox(Round(34.4517D, 2))

MsgBox(Round(34.4567D, 3))
MsgBox(Round(34.4517D, 3))
MsgBox(Round(34.4567D, 4))
MsgBox(Round(34.4561D, 4))


See also Int

Sin

Sin(...) returns the sine of the argument 'number' in radians.


Example

Const PI=3.141592654
MsgBox(Atn(Tan(PI/4.0)), PI/4.0) 'result: .7853981635 .7853981635
MsgBox(Cos(180 * (PI / 180))) 'result: -1
MsgBox(Sin(90 * (PI / 180))) 'result: 1
MsgBox(Tan(45 * (PI / 180))) 'result: 1.000000000205103


See also Cos, Tan

Sqr

Sqr(...) returns the square root of the argument 'number'.


Example

MsgBox(Sqr(25), Sqr(2)) 'results: 5 1.414214


Tan

Tan(...) returns the tangent of the argument 'number' in radians.


-------SQL-------

BLOB


BOOLEAN


FLOAT


INTEGER


MD5


SQLite


TEXT


-------Screen-------

CSRLin

It returns the current line of the cursor in the terminal screen.


Example

Sub Main()
  Dim s

  Print CSRLin()

  Print "row = " + Pos()

  Input s

  Print "line = " + CSRLin

  Input s
End Main


See also Pos, Locate

Pos

Pos(...) returns the current cursor position in the line. Provided for QBasic backward compatibility.


Example

Dim s
MsgBox(Pos())
Input s

MsgBox(CSRLin())

MsgBox(s)


-------String-------

Append

Append(...) returns a new string as a combination of both given strings.


Asc

Asc(...) returns the unicode integer value of an character at the given position inside a string.


At

At(...) returns a single character from a given string as a string with the length 1 starting at the specified index argument.


Bin

Bin returns a string giving the binary (base 2) representation. The return string has as many characters as necessary to represent the integer in binary.


Example

MsgBox(Bin(128))


See also Hex

Character

Character(...) returns a unicode character as string for a given integer unicode value. (Or returns the ASCII character corresponding to the value of Val. Argument must be a numerical expression.)


See also Asc

Chr

Chr(...) returns a unicode character as string for a given integer unicode value. (Or returns the ASCII character corresponding to the value of Val. Argument must be a numerical expression.)


See also Asc

Compare

Compare(...) lexically compares this string with the other string and returns an integer less than, equal to, or greater than zero if this string is less than, equal to, or greater than the other string.


Concat

Concat(...) lets you join two or more strings.


Contains

Contains(...) finds out if a given string is inside another string. Returns true if this Argument string contains an occurrence of the string Search; otherwise returns false.


Count

Count(...) finds out how often a given string is inside another string.


EndsWith

EndsWith(...) finds out if a given string ends with another string. Returns true if the string Argument ends with Search; otherwise returns false.


FileBaseName

FileBaseName(...) is useful if you have to deal with filename in a string. It returns only the parts of the string, which are the name of the file name without the extension of a given string leaving out the full path.


FileExtension

FileExtension(...) returns the name of the file extension of a given string, which is expected to contain a file name.


FileName

FileName(...) is useful if you have to deal with filename in a string. It returns only the parts of the string, which are the name of the file name of a given string leaving out the full path.


FilePath

FilePath(...) returns the path information of a given string, which is expected to contain a path with a file name.


Fill

Fill(...) set characters of a string to some value. If Length is different from -1 (the default), the string is resized to size beforehand.


Format

Format(...) returns a value as string formatted. The argument is usally a number. It is useful for formatting numbers. Locale is ignored for now.


FormatDateTime


FormatFloat

Rounds decimal place (5 - 9 round up, else no round up). Locale and DecimalPlaceLength is ignored for now.


Hex

Hex(...) returns a string representing a long value as hexadecimal.


Example

'Characters of Hex (0 - 9, A - F)
'
'Hexadecimal -> Decimal
'0 -> 0
'1 -> 1
'2 -> 2
'3 -> 3
'4 -> 4
'5 -> 5
'6 -> 6
'7 -> 7
'8 -> 8
'9 -> 9
'A -> 10
'B -> 11
'C -> 12
'D -> 13
'E -> 14
'F -> 15
'10 -> 16
'
Dim v = InputBox("Please type in a number: ")
MsgBox("The hexadecimal representation is ", Hex(v))


InStr

InStr(...) returns the position of the first occurrence of a given string inside another string starting from the beginning. It returns -1, if the string could not be found. First position in Source is referenced as 0.


Example

Dim s As String

s = "Bernd Noetscher's Q7Basic"
MsgBox( "string position = " & InStr(1, s, "Q7Basic") )


See also Mid, Right, Len, Mid, InStRev

InStrRev

InStrRev(...) returns the position of the first occurrence a given string inside another string starting from the end. It returns -1, if the string could not be found.


Example

Dim x As String, y As String

x = "This is a string"
y = "s"

MsgBox(InStRev(x, y))


See also Mid, Right, Len, Mid, InStr

IndexOf

IndexOf(...) returns the position of the first occurrence of a given string inside another string starting from the beginning. It returns -1, if the string could not be found. First position in Source is referenced as 0.


Example

Dim s As String

s = "Bernd Noetscher's Q7Basic"
MsgBox( "string position = " & InStr(1, s, "Q7Basic") )


See also Mid, Right, Len, Mid, InStRev

Insert

Insert(...) set characters of a string to some value.


IsEmpty

IsEmpty(...) returns true if a string contains any character.


Join

Join(...) returns a string, which consists of all elements of a list changed to a string. Between each of them is a given separator string.


LCase

LCase(...) changes all characters of a string to lowercase. It then returns a copy of the string.


Example

Dim src As String
src = "Mr. Big was HERE"
MsgBox(LCase(src))

' Output:
' mr. big was here


See also UCase

LTrim

LTrim(...) removes the source string’s leading spaces, from the beginning of the source string.


Example

Dim x As String
x = "     My house is on fire."
MsgBox(LTrim(x))

' Output:
' My house is on fire.


See also RTrim, Trim

LastIndexOf

LastIndexOf(...) returns the position of the first occurrence a given string inside another string starting from the end. It returns -1, if the string could not be found.


Example

Dim x As String, y As String

x = "This is a string"
y = "s"

MsgBox(InStRev(x, y))


See also Mid, Right, Len, Mid, InStr

Left

Left(...) returns the leftmost part of a string containing 'Position' number of characters.


Example

Dim src As String
src = "What a nice day"
MsgBox(Left(src, 4))


See also Right, Mid

LeftJustified

LeftJustified(...) returns a string of size width that contains this string padded by the fill character.


Len

Len(...) returns the length of a string.


Lower

Lower(...) changes all characters of a string to lowercase. It then returns a copy of the string.


Example

Dim src As String
src = "Mr. Big was HERE"
MsgBox(LCase(src))

' Output:
' mr. big was here


See also UCase

Mid

Mid(...) returns a specific part of a string beginning at 'Index' for 'Length' number of charaters.


Example

Dim text
text = "The dog bites the cat"

text = Mid$(text, 10, 1)

MsgBox(text)


See also Trim, InStr

Nz

Nz(...) checks for null and returns an empty string (nullstring), if needed.


Example

Function test()
  Return Null   
End Function

MsgBox("'_" + Nz(test()) + "_'" ' --> "")


Prepend

Prepend(...) returns a new string as a combination of both given strings.


RTrim

RTrim(...) removes the source string’s trailing spaces, from the end of the source string.


Example

MsgBox("test..." & "  bedazzeled  " & "...test")
MsgBox("test..." & RTrim("  bedazzeled  ") & "...test")


ReadCString

ReadCString(...) loads an entire file from a path or on a website into a string. The file is expected to be encoded in ISO 8859-1.


ReadLines

ReadLines(...) loads an entire text file from a path or on a website and returns it as a list of strings (each line is a string). The file is expected to be encoded in UTF-8.


ReadString

ReadString(...) loads an entire file from a path or on a website into a string. The file is expected to be encoded in UTF-8.


Remove

Remove(...) deletes n characters from the string, starting at the given position index and returns it.


Replace

Replace(...) changes all occurrences of a string inside another string to a new string.


Example

Dim s = "Das ist alles was wir brauchen. Fang nochmal von vorne an."
Dim search = vorne"
Dim replace = "hinten"
MsgBox(Replace(s, search, replace))


Reversed

Reversed(...) returns a given string reversed.


Right

Right(...) returns the rightmost part of a string beginning at 'Position' (returns a string containing the last characters of a string).


Example

MsgBox(Right("I'm living in Germany", 7))
'MsgBox(Right("I'm living in Germany", Len("Germany")))


See also Left, Mid

Section

Section(...) returns a section of the string (section flags are: SectionDefault, SectionSkipEmpty, SectionIncludeLeadingSep, SectionIncludeTrailingSep, SectionCaseInsensitiveSeps).


Simplified

Simplified(...) returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.


Space

Space(...) function creates a string consisting of spaces (or other characters) based on x length.


Example

MsgBox("*" + Space(5) + "*")

' Output:
' * *

MsgBox(Space$(4.3 + 2))

MsgBox("*" + Space(5) + "*")


Split

Split(...) returns a list containing string objects from the given string, which have been separated by a string pattern.
This works a little different than the VB6 Split function, because the return value is not String() - but a list of String.


StartsWith

StartsWith(...) finds out if a given string starts with another string.


StrReverse

StrReverse(...) returns a all parts of a string mirrored.


Example

Dim s = "Mondscheinsonate by Beethoven"
MsgBox(StrReverse(s)) ' --> nevohteeB yb etanosniehcsdnoM


Trim

Trim(...) returns a string, in which all whitespace characters at the beginning and end have been removed (removes the source string’s leading and trailing spaces and other non-printable characters).


Example

Dim x As String
x = "   My house is on fire.   "
MsgBox( "test..." & Trim( x ) & "...test")

' Output:
' test...My house is on fire....test


See also LTrim, RTrim

Truncate

Truncate(...) cut off the string at the given position index and returns it.


UCase

UCase(...) changes all characters of a string to uppercase (contains the source string converted to all upper case).


Example

Dim src As String
src = "Mr. Big was HERE"
MsgBox(UCase( src ))

' Output:
' MR. BIG WAS HERE


See also LCase

Unicode

Unicode(...) returns the unicode integer value of an character at the given position inside a string.


Upper

Upper(...) changes all characters of a string to uppercase (contains the source string converted to all upper case).


Example

Dim src As String
src = "Mr. Big was HERE"
MsgBox(UCase( src ))

' Output:
' MR. BIG WAS HERE


See also LCase

Val

Val(...) returns the numerical value of a string.


Example

MsgBox(Value("344")) ' --> 344
MsgBox(Val("21st day")) ' --> 21
MsgBox(Val("BASIC")) ' --> 0


See also Str

Value

Value(...) returns the numerical value of a string.


Example

MsgBox(Value("344")) ' --> 344
MsgBox(Val("21st day")) ' --> 21
MsgBox(Val("BASIC")) ' --> 0


See also Str

WriteCString

WriteCString(...) saves the entire string in a file to a given path. URL is not supported yet. The file is encoded in ISO 8859-1.


WriteString

WriteString(...) saves the entire string in a file to a given path. URL is not supported yet. The file is encoded in UTF-8.


-------ui-------

Close


CloseAllMDI


CloseDockWidget


CloseMDI


CloseToolWindow


CloseWindow


Focus


FocusMDI


FocusWindow


InputBox

Get a string from the user using an input box on screen.


Example

Dim Msg, Titel, default2, val1

Msg = "Input value between 1 and 3"
Titel = "InputBox-Demo"
default2 = "1"

val1 = InputBox(Msg)

MsgBox("You have inputted: " + val1)


ListMDI


LoadUI


MessageBox

The order of the buttons is determined by the button role. The return value is for StandardButtons one of their integer const values or the order number of the user defined button.


See also InputBox

MsgBox

Prints a message in a GUI dialog box.

VB6 compatibility mode - buttons:

vbOKOnly 0 show only [OK].
vbOKCancel 1 show [OK] and [Cancel]
vbAbortRetryIgnore 2
vbYesNoCancel 3
vbYesNo 4
vbRetryCancel 5
vbCritical 16 Stop symbol
vbQuestion 32 question mark symbol
vbExclamation 48 exclamation mark symbol
vbInformation 64 information mark symbol
vbDefaultButton1 0
vbDefaultButton2 256
vbDefaultButton3 512

VB6 compatibility mode - return values:

vbOK 1 OK
vbCancel 2 Cancel
vbAbort 3 Abort
vbRetry 4 Retry
vbIgnore 5 Ignore
vbYes 6 Yes
vbNo 7 No



Example

' text in richtext is possible as well
'n = MsgBox("message or not", vbOKOnly, "title text")

'n = MsgBox("message", vbOKOnly, "title text")
'n = MsgBox("message", vbOKCancel, "title text")
'n = MsgBox("message", vbAbortRetryIgnore, "title text")
'n = MsgBox("message", vbYesNoCancel, "title text")
'n = MsgBox("message", vbYesNo, "title text")
'n = MsgBox("message", vbRetryCancel, "title text")
'    
'n = MsgBox("message", vbOKOnly Or vbCritical, "title text")
'n = MsgBox("message", vbOKOnly Or vbQuestion, "title text")
'n = MsgBox("message", vbOKCancel Or vbExclamation, "title text")
'n = MsgBox("message", vbOKOnly Or vbInformation, "title text")
'    
'n = MsgBox("message", vbYesNoCancel Or vbDefaultButton1, "title text")
'n = MsgBox("message", vbYesNoCancel Or vbDefaultButton2, "title text")
'n = MsgBox("message", vbAbortRetryIgnore Or vbDefaultButton3, "title text")
'

n = MsgBox(" to save succeeding generations from the scourge of war, which twice in our lifetime", vbOKOnly, "WE THE PEOPLES")


See also InputBox

OpenDialog


OpenDockWidget


OpenEmail


OpenMDI


OpenSDI


OpenToolWindow


OpenURL


OpenWindow


UnloadUI



_______Objects_______

Application

Super Classes
Overview
Properties










Procedures


  • Sub CursorSetWait()


  • Sub CursorUnsetWait()


  • Sub ClipboardText()


  • Sub QtVersion()


  • Sub OperatingSystemName()


  • Sub CloseAllWindows()


  • Sub IsRightToLeftLayoutDirection()




  • Sub AboutQt()








Signals



____________________________________________________________________

CMath

Overview
Procedures







  • Function atan2(x As Float, y As Float) As FloatDetermines the arc tangent of y/x in [-pi,pi] using the sign of both arguments to determine the quadrant














  • Function lgamma(x As Float) As FloatDetermines the base-e logarithm of the absolute value of gamma of its argument x, for x > 0



____________________________________________________________________

ColorDialog

Super Classes
Overview
Procedures








____________________________________________________________________

Colors

Overview
Properties






















Procedures



____________________________________________________________________

Database

Overview
Procedures




























____________________________________________________________________

Debug

Overview
Properties








____________________________________________________________________

Desktop

Overview
Procedures



____________________________________________________________________

Dir (Object)

Overview
Procedures





































____________________________________________________________________

File (Object)

Overview
Procedures






























____________________________________________________________________

FontDialog

Super Classes
Overview
Procedures









____________________________________________________________________

Fonts

Overview
Procedures



____________________________________________________________________

InputDialog

Super Classes
Overview
Procedures






____________________________________________________________________

MainWindow

Super Classes


____________________________________________________________________

MessageBox

Overview
Procedures






____________________________________________________________________

OS

Overview
Procedures





____________________________________________________________________

OpenFileDialog

Super Classes
Overview
Procedures








____________________________________________________________________

Pixmaps

Overview
Procedures



____________________________________________________________________

Preferences

Overview
Procedures

  • Sub RemoveAll()













____________________________________________________________________

ProgressDialog

Super Classes
Overview
Properties








Procedures






____________________________________________________________________

Query

Overview
Procedures






____________________________________________________________________

Records

Overview
Procedures



















____________________________________________________________________

SaveFileDialog

Super Classes
Overview
Procedures






____________________________________________________________________

Sounds

Overview
Procedures




____________________________________________________________________

StatusBar

Super Classes
Overview
Procedures

  • Sub ClearMessage()





____________________________________________________________________

SystemTray

Super Classes
Overview
Properties






Procedures





  • Sub ShowOrHide()






Signals





____________________________________________________________________

Table

Overview
Procedures




















____________________________________________________________________

ToolBar

Super Classes
Overview
Procedures


____________________________________________________________________


_______Classes_______

CheckBox

Super Classes

Overrides super.

Overview
Properties

Overrides super.


Signals



____________________________________________________________________

Class

Super Classes


____________________________________________________________________

CommandButton

Super Classes

Overrides super.

Overview
Properties

Overrides super.


Signals



____________________________________________________________________

CommandLinkButton

Super Classes

Overrides super.

Overview
Properties

Overrides super.




Signals



____________________________________________________________________

Control

Super Classes

Please read the Qt class overview of QWidget, which gives Control a lot of basic and important features.

Overview
Properties



Signals



















____________________________________________________________________

Dictionary

Super Classes
Init

Up to 20 arguments may be used to initialize the dictionary.


Overview
Procedures


  • Sub RemoveAll()








____________________________________________________________________

Frame

Super Classes


____________________________________________________________________

ImageBox

Super Classes
Overview
Properties




____________________________________________________________________

ImageButton

Super Classes
Overview
Properties



If it is true, the control appears as checkable button. If you would like to group several buttons as auto-exclusive group, set for all buttons the same group name.




Contains the path of the image to be displayed. It can be an absolute path to an image file (png, jpg,…) like c:\myfolder\myimage.png or can be an relative path to the current project like myimage.png (which is present in the current project directory). Relative paths are recommended. Might be a String containing binary data. See the binary project example for using.



















Signals



____________________________________________________________________

Label

Super Classes
Overview
Properties





____________________________________________________________________

List

Super Classes
Init

Up to 20 arguments may be used to initialize the list.


Overview
Procedures


  • Sub RemoveAll()







____________________________________________________________________

Module

Super Classes


____________________________________________________________________

PhononSeekSlider

Super Classes


____________________________________________________________________

PhononVideoPlayer

Super Classes
Overview
Procedures


____________________________________________________________________

PhononVolumeSlider

Super Classes


____________________________________________________________________

QAbstractButton

Super Classes
Overview
Properties








Signals





____________________________________________________________________

QAction

Super Classes
Overview
Properties









Signals





____________________________________________________________________

QButtonGroup

Super Classes

The Qt documentation says that you normally do not need QButtonGroup, because radio buttons with the same parent are automatically part of an exclusive group, so you normally don't need to do anything else.

Overview
Properties



Procedures


Signals







____________________________________________________________________

QCalendarWidget

Super Classes


____________________________________________________________________

QCheckBox

Super Classes


____________________________________________________________________

QCloseEvent

Super Classes


____________________________________________________________________

QColumnView

Super Classes


____________________________________________________________________

QComboBox

Super Classes
Overview
Properties



Procedures



  • Sub RemoveAll()


  • Sub SetNoCompleter()





Signals



____________________________________________________________________

QCommandLinkButton

Super Classes
Overview
Properties



____________________________________________________________________

QDateEdit

Super Classes


____________________________________________________________________

QDateTimeEdit

Super Classes


____________________________________________________________________

QDeclarativeView

Super Classes


____________________________________________________________________

QDial

Super Classes


____________________________________________________________________

QDialog

Super Classes
Overview
Procedures



____________________________________________________________________

QDialogButtonBox

Super Classes


____________________________________________________________________

QDockWidget

Super Classes
Overview
Properties



Procedures



____________________________________________________________________

QDoubleSpinBox

Super Classes
Overview
Properties





____________________________________________________________________

QFocusEvent

Super Classes


____________________________________________________________________

QFontComboBox

Super Classes


____________________________________________________________________

QFormLayout

Super Classes


____________________________________________________________________

QFrame

Super Classes


____________________________________________________________________

QGraphicsView

Super Classes


____________________________________________________________________

QGridLayout

Super Classes


____________________________________________________________________

QGroupBox

Super Classes
Overview
Properties




____________________________________________________________________

QHBoxLayout

Super Classes


____________________________________________________________________

QIcon

Super Classes
Init



____________________________________________________________________

QLCDNumber

Super Classes


____________________________________________________________________

QLabel

Super Classes
Overview
Properties








____________________________________________________________________

QLineEdit

Super Classes
Overview
Properties











Procedures


  • Sub SelectAll()


Signals













____________________________________________________________________

QListView

Super Classes


____________________________________________________________________

QListWidget

Super Classes
Overview
Procedures


  • Sub RemoveAll()


































Signals



____________________________________________________________________

QMainWindow

Super Classes


____________________________________________________________________

QMdiArea

Super Classes
Overview
Properties



Procedures


Signals



____________________________________________________________________

QMenu

Super Classes
Init


As QMenu will become owner of the given objects (added by AddAction, AddMenu...), Clear will release those objects regardless your app is holding still references to them.

Overview
Procedures







Signals





____________________________________________________________________

QMenuBar

Super Classes
Overview
Signals





____________________________________________________________________

QObject

Overview
Properties



Procedures





____________________________________________________________________

QPaintEvent

Super Classes


____________________________________________________________________

QPainter

Super Classes
Overview
Procedures


____________________________________________________________________

QPlainTextEdit

Super Classes
Overview
Properties




Procedures


Signals

  • Signal cursorPositionChanged ()















____________________________________________________________________

QProgressBar

Super Classes
Overview
Properties






____________________________________________________________________

QPushButton

Super Classes
Overview
Properties






____________________________________________________________________

QRadioButton

Super Classes


____________________________________________________________________

QResizeEvent

Super Classes


____________________________________________________________________

QScrollArea

Super Classes


____________________________________________________________________

QScrollBar

Super Classes


____________________________________________________________________

QSlider

Super Classes


____________________________________________________________________

QSpinBox

Super Classes
Overview
Properties





____________________________________________________________________

QStackedWidget

Super Classes
Overview
Properties



____________________________________________________________________

QStatusBar

Super Classes


____________________________________________________________________

QTabWidget

Super Classes
Overview
Properties



Procedures




____________________________________________________________________

QTableView

Super Classes
Overview
Procedures


____________________________________________________________________

QTableWidget

Super Classes
Overview
Properties




Procedures

  • Sub ClearContents()


  • Sub SetHorizontalHeaderAutoResize()



  • Sub SortItems()


  • Sub RemoveRow()















____________________________________________________________________

QTextBrowser

Super Classes


____________________________________________________________________

QTextEdit

Super Classes
Overview
Properties



Signals

  • Signal cursorPositionChanged()













____________________________________________________________________

QTimeEdit

Super Classes


____________________________________________________________________

QToolBar

Super Classes


____________________________________________________________________

QToolBox

Super Classes
Overview
Properties



____________________________________________________________________

QToolButton

Super Classes
Overview
Properties



____________________________________________________________________

QTreeView

Super Classes


____________________________________________________________________

QTreeWidget

Super Classes
Overview
Procedures












  • Sub ScrollToBottom()


  • Sub ScrollToTop()































































Signals





















____________________________________________________________________

QVBoxLayout

Super Classes


____________________________________________________________________

QWebView

Super Classes
Overview
Procedures



Signals





____________________________________________________________________

QWidget

Super Classes
Overview
Properties










Procedures

  • Function Actions() As ListReturns actions which are owned by this widget.


  • Sub ShowFullScreen()


  • Sub ShowMaximized()


  • Sub ShowMinimized()


  • Sub ShowNormal()




  • Sub ToggleVisible()



Events









____________________________________________________________________

RadioButton

Super Classes

Overrides super.

Overview
Properties

Overrides super.


Signals



____________________________________________________________________

TextBox

Super Classes

Overrides super.

Overview
Signals



____________________________________________________________________

Timer

Super Classes
Overview
Properties




Procedures





Signals



____________________________________________________________________

ToolButton

Super Classes

Overrides super.

Overview
Properties

Overrides super.


Signals



____________________________________________________________________

UdpSocket

Super Classes
Overview
Properties




Procedures









Signals









____________________________________________________________________

uiClass

Super Classes


____________________________________________________________________


_______Types_______

Boolean


It is internally a bool object.


Byte

It is internally a qint64 object. If needed it gets converted to unsigned 8-bit.


CString

It is internally a QString object. If needed it gets converted to a CString.


DateTime


A DateTime object is internally a QDateTime object.


Decimal


It is internally a Q7Basic custom object based storing its value in a qint64.


Dictionary

Up to 20 arguments may be used to initialize the dictionary.

It is internally a QMap<QString, id>.


Double

An alias for Float


Float


It is internally a qreal object.


Int16

It is internally a qint64 object. If needed it gets converted to 16-bit.


Int32

It is internally a qint64 object. If needed it gets converted to 32-bit.


Int64

An alias for Integer


Int8

It is internally a qint64 object. If needed it gets converted to unsigned 8-bit.


Integer


It is internally a qint64 object.


List

Up to 20 arguments may be used to initialize the list.

It is internally a QList<id>.


Object

An alias for id


Short

It is internally a qint64 object. If needed it gets converted to 16-bit.


Single

It is internally a qreal object. If needed it gets converted to 32-bit float (single).


String


It is internally a QString object. Unicode support is built-in. You need to have installed Unicode support (e.g. Asian language and character sets) for Windows for this feature.


id




_______Keywords_______

</string>

<string>

Alias

Declare statements: Used to extend the language and gain direct access to the Qt library or other C/C++ files of the current project.


As

Dim VARIABLENAME As VARIABLETYPE
Sub SUBNAME(ByRef VARIABLENAME As VARIABLETYPE)

It is used whenever you declare variables. After As, you write the type of the variable you currently declare. See the manual for more information on this.


Example
rem
'   This is yet another test ' c = 3.14

REM This is another test ' a = 4
print "The end!"  ' another rem here!


See also Dim


Break

Immediatily leaves the current loop.


ByRef

Sub SUBNAME(ByRef VARIABLENAME As VARIABLETYPE)

Defines the given variable to the sub or function, to be handled by reference. This means, that chaning the value of this varialbe affects the original variable as well. See the manual for more information on this.


See also ByVal


ByVal

Sub SUBNAME(ByVal VARIABLENAME As VARIABLETYPE)

Defines the given variable to the sub or function, to be handled by value. This means, that chaning the value of this varialbe DOES NOT affect the original variable as well. See the manual for more information on this.


See also ByRef


Case

Select Case EXPRESSION...Case EXPRESSION...End Select
Select Case EXPRESSION...Case EXPRESSION To EXPRESSION...End Select
Select Case EXPRESSION...Case Is OPERATOR EXPRESSION...End Select
Select Case EXPRESSION...Case Else...End Select

It is used for Select Case, which introduces a multi-line conditional selection statement.


Example

Dim i As Double
Dim n As Integer

i = 4

Select Case i
Case 0
  n = 0
Case 1, 2
  n = 1122
Case 4 To 10
  n = 441000
Case Is = 9
  n = 9999
Case Else
  n = 999999
End Select


See also Select


Class

Classes are needed, when you would like use (custom) objects. See the manual for more information.

A simple application can contain a form, while all source code is inside the form module of that form. But if the application grows bigger and bigger it might be useful, to write source codes from different forms at one place, so you need a place to write the source codes down outside the forms. Here comes the classes. Create a class, which contains a methods, which is useful for your forms. You code is stored in classes or modules. You can archive your code within classes. Every class consists of the declaration part and the methods you have inserted. A class can contain:

Declarations - for variables, types, enumerations and constants;Methods (also called procedures) - which are not assigned to a special event or object. You can create as many procedures as you want, e.g. sub-procedures without return value or function-procedures;Signal/Slots-Methods - These are special methods;Events - Needed for overriding super class features;Properties - Are variables, which are accessed through two special methods (get and set method). Properties are accessable without the need to write braces, when you use them.

You must not put several classes or modules in one file.


Example

Dim Name As Type
Const Name As Type

Public Name As Type
Private Name As Type
Public Const Name As Type
Private Const Name As Type
...


[Public | Private] 
Enum Name
  Name As Type
  ...
End Enum
...


[Public | Private] 
Type Name
  Name As Type
  ...
End Type
...


[Public | Private]  
Property Sub Name(Argument)
  [Statements]
End Sub
...

[Public | Private]  
Property Function Name()
  [Statements]
End Function 
...


[Public | Private] 
Function Name([Arguments]) [As Type]
  [Statements]
End Function
...


[Public | Private] 
Sub Name([Arguments])
  [Statements]
End Sub
...


[Public | Private] 
Event Name([Arguments])
  [Statements]
End Event
...


[Public | Private] 
Signal Name([Arguments])
  [Statements]
End Signal
...


[Public | Private] 
Slot Name([Arguments])
  [Statements]
End Slot
...


See also Module


Const

Const NAME [As TYPE] = EXPRESSION

Declares a constants.
Constants are similar to variables but they cannot change values. When you declare a constant you assign a value to it that annot be altered during lifetime of your program.


Example

Sub Namer() 
  Const pi = 3.14 
  Print pi 
End Sub

Sub test
  Dim k As Integer
  
  k = 9 + 23
  Print k  
End Sub

Const a = 123.88 * 2, bb = 6
Const k As Integer = 2 

Sub test2()
  Dim i As Double
  i = bb
  test
  'a = i ' would cause a parser error
End Sub


See also Dim


Continue

Immediatily tests loop condition of the current loop.


Declare

Used to extend the language and gain direct access to the Qt library or other C/C++ files of the current project.


Dim

Dim VARIABLENAME[ARRAY] [As VARIABLETYPE] {[, VARIABLENAME[ARRAY] [As VARIABLETYPE]]}

Before using variables, you must declare them. You must define the name and the data type of a variable. The 'Dim'-statement declares a variable. See the manual for more information.

Example
Dim A2 As Integer, B2 As Integer


Do

Do...Loop Until EXPRESSION
Do While EXPRESSION...Loop

Loop-statements

The statements that control decisions and loops in are called control structures. Normally every command is executed only one time but in many cases it may be useful to run a command several times until a defined state has been reached. Loops repeat commands depending upon a condition. Some loops repeat commands while a condition is ‘True,’ other loops repeat commands while a condition is ‘False.’ There are other loops repeating a fixed number of times and some repeat for all elements of a collection.
There are two different ways to use the keyword ‘Do’ in order to test a condition within a ‘Do...Loop’-statement. You can test the condition before the commands inside the loop are executed or you can test the condition after the commands of the loop have been executed at least once. If the condition is ‘True’ ( in the following procedure ‘SubBefore’) the commands inside the loop execute.


Example

Sub SubBefore()
  Counter = 0
  myNumber = 20
  Do While myNumber > 10
    myNumber = myNumber - 1
    Counter = Counter + 1
  Loop
  MsgBox("Loop has been executed " & Counter & " time(s).")
End Sub

Sub SubAfter()
  Counter = 0
  myNumber = 9
  Do
    myNumber = myNumber - 1
    Counter = Counter + 1
  Loop While myNumber > 10
  MsgBox("Loop has been executed " & Counter & " time(s).")
End Sub


Else

If EXPRESSION Then...Else If EXPRESSION...Else...End If

A single decision is used to execute a set of statements if a condition is set ('If'-statement). If the condition is 'True' then the statements after the 'Then' are executed and the statements after the 'Else' are skipped. If the condition is 'False,' the statements after the 'Else' are executed.


Example

Dim i As Integer
Dim n As Integer 

If i 1 Then 
  n = 11111 
Else If i = 2 * 10 Then
  n = 22222 
Else 
  n = 33333 
End If


End

End Sub
End Function
End Type
End Enum
End Event
End Type
End Enum
End Signal
End Slot
End If
End Select

It is used to close the current sub, function or other language structure. See the list above.


Enum

Enum ENUMNAME...End Enum

Is a list of integer constants relating to the same subject.


Example

Enum Level
   Mo = -1
   Di = 0
   Fr = 1
   Sa = 1 + Fr And 2
End Enum

Enum test
   Entry
   Entry2
   Security = Entry
End Enum

Sub test()
  MsgBox(3 + Level.Mo)
  MsgBox(test.Entry)
  MsgBox(test.Security)
End Sub


Event

Events are automatically called by the runtime. The difference between events and signals is that events are overriding the super class event function, but signal uses the signal/slot feature of Qt to connect different objects.


Exit

Exit For

Explicit leave of for loop.

Exit Do

Explicit leave of do loop.

Exit Sub

Explicit leave of sub.

Exit Function

Explicit leave of function.

Exit Event

Explicit leave of event procedure.

Exit Signal

Explicit leave of signal procedure.

Exit Slot

Explicit leave of slot procedure.


Example

Sub doingSomething()
  
  MsgBox("did something")  
  
  Exit Sub
  
  MsgBox("end of sub")
  
  For i As Integer = 1 To 11   
    Exit For
    MsgBox("xyz")
  Next

End Sub

Function doingSomething2()
      
  MsgBox("did something")
  
  Exit Function
  
  MsgBox("end of function")
  
End Function


False

The boolean literal used for the false value.


For

For VARIABLENAME = EXPRESSION To EXPRESSION [Step EXPRESSION]…Next

The statements that control decisions and loops are called control structures. Normally every command is executed only one time but in many cases it may be useful to run a command several times until a defined state has been reached. Loops repeat commands depending upon a condition. Some loops repeat commands while a condition is 'True', other loops repeat commands while a condition is 'False'. There are other loops repeating a fixed number of times and some repeat for all elements of a collection. The For-Next loop is useful when you know how often statements should be repeated. For-Next defines a loop that runs a specified number of times.


Example

Dim ctr As Integer

For ctr = 1 To 5 
  MsgBox("Z", i) 
Next


Form

Function

Function NAME([ARGUMENTS]) [As RETURNTYPE]...End Function

Is a part of a program, returning a value depending on calculation inside the function. A function-procedure can have arguments, variables, expressions, or constants that are given to it when it get called. Function-procedures return values.


Example

' function example

Function divide(dividend As Float, divisor As Float) As Float
  
  Return dividend / divisor
  
End Function

Sub Main()
  MsgBox(divide(18, 9))
End Sub


See also Sub


Global

GoTo

GoTo LABEL

Unconditional jumping
Programmers can also use unconditional branches. This type of branching can be performed using the ‘GoTo’-instruction. ‘GoTo’ forces program execution to branch to a specific line number or label. Because line numbers are now obsolete, you do not have to worry about how to use them. You may, however, want to use labels. ‘GoTo’ performs a unconditional jump. ‘GoTo’ is always executed, without a condition.


Example

Sub test()
  Dim b As Integer
  Dim n As Integer

  b = 45
  GoTo bernd
  b = 99999
  bernd:

  n = 0
  ok:
  n = n + 1
  If n < 5 Then GoTo ok
End Sub


IIf

IIf(EXPRESSION, THENRETURNEXPRESSION, ELSERETURNEXPRESSION)

IIf returns a value of two values depending on an expression.


Example

Function testing(Test1 As Integer) As String
  Return IIf(Test1 > 1000, "big", "small")
End Function

Sub Main()
  MsgBox(testing(5))
  MsgBox(testing(5555))
End Sub


If

A single decision is used to execute a set of statements if a condition is set ('If'-statement). If the condition is 'True' then the statements after the 'Then' are executed and the statements after the 'Else' are skipped. If the condition is 'False,' the statements after the 'Else' are executed.



Example

Dim i As Integer
Dim n As Integer 

If i = 1 Then 
  n = 11111 
Else If i = 2 * 10 Then
  n = 22222 
Else 
  n = 33333 
End If


See also Else, End


Is

Select Case EXPRESSION...Case Is OPERATOR EXPRESSION...End Select

Used in a select case statement for comparision.


Iterate

Iterate For

Manually test loop condition for a ‘For’-loop.

Iterate Do

Manually test loop condition of a ‘Do’-loop.


LBound

LBound(VARIABLENAME [, Index])

Getting lower bound of an array. LBound is used for the lower bound.


Example

Type book
  bkname As String 
  isbn[1000] As Integer
End Type 

Type address
  books[50] As book
  age As Integer
  name As String 
End Type 

Dim j[10] As book

Sub Main()
  MsgBox(LBound(j, 1))
End Sub


See also UBound


Loop

Do…Loop Until EXPRESSION
Do While EXPRESSION…Loop

Loop-statements. See Do fore more information.


See also Do


Me

Use current instance or object. The keyword ‘Me’ references the current instance (or object) in which the code is currently executed. Normally it is the current class (user defined class or form class).


Mid

Mid(STRINGVARIABLE, Position As Integer, Length As Integer) = {STRINGEXPRESSION | ASCII-Code}

Replaces text inside a string by another text.


Example

Sub Main()
  Dim txt As String, replacement As String, originaltxt As String

  replacement = "The power of Q7Basic"
  originaltxt = "***********************"
   Dim i As Integer
   For i = 1 To Len(replacement)
    Mid(originaltxt, 2, i) = replacement
    MsgBox(originaltxt)
  Next
End Sub


Module

Modules are usefull when you would like to organize functions and subs. A simple application can consist of only one form while the complete source code is in one form module. As your applications grow larger you probably would like to use the same code in different forms. To do so, place this code in a global module file as it is accessible by the entire application. You code is stored in classes or modules. You can archive your code within modules. Every module consists of the declaration part and the procedures you have inserted. A module can contain: Declarations - for variables, types, enumerations and constants; Procedures - which are not assigned to a special event or object.
You can create as many procedures as you want, e.g. sub-procedures without return value or function-procedures. You must not put several classes or modules in one file.
See the manual for more information.


Example

Dim Name As Type
Public Name As Type
Private Name As Type
Const Name As Type
Public Const Name As Type
Private Const Name As Type
...

[Public | Private] 
Enum Name
  Name As Type
  ...
End Enum
...

[Public | Private] 
Type Name
  Name As Type
  ...
End Type
...

[Public | Private] 
Function Name([Arguments]) [As Type] [Throws Name, ...]
  [Statements]
End Function
...

[Public | Private] 
Sub Name([Arguments]) [Throws Name, ...]
  [Statements]
End Sub
...


See also Class


Next

For VARIABLENAME = EXPRESSION To EXPRESSION [Step EXPRESSION]…Next

The statements that control decisions and loops are called control structures. Normally every command is executed only one time but in many cases it may be useful to run a command several times until a defined state has been reached. Loops repeat commands depending upon a condition. Some loops repeat commands while a condition is 'True', other loops repeat commands while a condition is 'False'. There are other loops repeating a fixed number of times and some repeat for all elements of a collection. The For-Next loop is useful when you know how often statements should be repeated. For-Next defines a loop that runs a specified number of times.


Example

Dim ctr As Integer

For ctr = 1 To 5 
  MsgBox("Z", i) 
Next


Null

If a variable has the value 'Null', it points to nothing (no object). The data type 'id' is automatically used if you do not specifiy a data type for an argument, constant, procedure or variable. Variables of type ‘id’ can contain strings, dates, time values, boolean values or even numerical values.


Example

Sub Main()
  Dim v As id
  v = Null
End Sub


Outlet

Outlet variables point to objects of ui files. See the manual for more information.


Preserve

ReDim Preserve VARIABLENAME[ARRAY] [,VARIABLENAME[ARRAY]]...

Preserve does not clear the array, when you change the size of the array by using ReDim.


Example

Sub Main()
    
  Dim i[10] As Integer
  
  i[0] = 99
  i[1] = 88
  i[2] = 77
  i[3] = 66
  i[4] = 55
  i[5] = 44
  
  ReDim Preserve i[20]
  
  MsgBox(i[0])
  
End Sub


Private

Private VARIABLENAME[ARRAY] [As VARIABLETYPE] [, VARIABLENAME[ARRAY] [As VARIABLETYPE]]

Before using variables, you must declare them. You must define the name and the data type of a variable. Use of the ‘Private’-Statement Use the ‘Private’-statement to declare private variables in module scope or class scope, making the variable accessible only from the same scope (module scope, all module procedures, class scope, all class methods)
See the manual for more information.


See also Class, Module, Dim, Public, Global


Property

Property Sub Name(Argument)...End Sub
Property Function Name()...End Function

Defining a property is like defining a procedure. Most objects and controls have properties that you can think of as nothing more complicated than attributes. For example, a ‘CommandButton’ control has a property called ‘Caption’ that determines the text that appears in the button. Many other controls, such as the familiar ‘Label’ control, also have a ‘Caption’ property. Some properties are common whereas others are associated with only a single control or object. Those properties are built-in, but it is also possible to define your own properties within your user defined class.
Defining a property is like defining a procedure. In fact, a property contains two property-procedures. One property-procedure reads the property (Get) and the other writes the property (Set). Additionally, you have to declare a variable that contains the value of the property. Why should I use a property, when I use a variable instead? It is easier to access a variable but it might be useful to check something when accessing a variable; with properties you are able to check values or conditions when you try to access the property. It is like data hiding. You can code so that the value of the property is always correct.


Example

' . operator     ! is direct access to dynamic properties of Qt

Dim myVar2
Property Sub Set_myVar2(Value) 
  MsgBox("Property Sub SetmyVar2(Set)")
  myVar2 = Value
End Sub 

Property Function Get_myVar2() 
  MsgBox("Property Function GetmyVar2()")
  Return myVar2 
End Function 


See also Class, Sub, Function


Public

Public VARIABLENAME[ARRAY] [As VARIABLETYPE] [, VARIABLENAME[ARRAY] [As VARIABLETYPE]]

You can use the ‘Public’-statement to declare public variables in module scope or class scope, making the variable accessible from everywhere.
See the manual for more information.


See also Class, Module, Dim, Private, Global


ReDim

ReDim Preserve VARIABLENAME[ARRAY] [,VARIABLENAME[ARRAY]]...

Preserve does not clear the array, when you change the size of the array by using ReDim.


Example

Sub Main()
    
  Dim i[10] As Integer
  
  i[0] = 99
  i[1] = 88
  i[2] = 77
  i[3] = 66
  i[4] = 55
  i[5] = 44
  
  ReDim Preserve i[20]
  
  MsgBox(i[0])
  
End Sub


Return

Return [EXPRESSION]

Returns a value (for functions only) and leaves the current function/sub.


Select

Select Case EXPRESSION...Case EXPRESSION...End Select
Select Case EXPRESSION...Case EXPRESSION To EXPRESSION...End Select
Select Case EXPRESSION...Case Is OPERATOR EXPRESSION...End Select
Select Case EXPRESSION...Case Else...End Select

It is used for Select Case, which introduces a multi-line conditional selection statement.


Example

Dim i As Double
Dim n As Integer

i = 4

Select Case i
Case 0
  n = 0
Case 1, 2
  n = 1122
Case 4 To 10
  n = 441000
Case Is = 9
  n = 9999
Case Else
  n = 999999
End Select


See also Select


Set

You may override the data type of an outlet pointing to an object of a ui file. See the manual for more information.


Example

Outlet someWidgetInUIFile As myControl Set ' myControl is a widget class, which replaces the original class used by the ui file before it gets loaded


Signal

Signal SIGNALNAME(ARGUMENTS)...End Signal

The difference between events and signals is that events are overriding the super class event function, but signal uses the signal/slot feature of Qt to connect different objects.


Slot

Slot SLOTNAME(ARGUMENTS)...End Slot


See also Signal


Static

Static Dim VARIABLENAME[ARRAY] [As VARIABLETYPE] [, VARIABLENAME[ARRAY] [As VARIABLETYPE]]

Before using variables, you must declare them. You must define the name and the data type of a variable. Static is a modifier to declare variables with a special feature: Static outside a class, but inside a procedure (sub or function) or method. If you use a ‘Static’-statement instead of a ‘Dim’-statement, the variable is declared as local static variable. The variable, once it has been declared, it is not destroyed by leaving the procedure. The next time the procedure is entered, the value of the variable still exists. Therefore, a local static variable is only one time declared when using recursive calls of a procedure.


Example

Sub test()
  Static Dim i As Integer = 0 
  MsgBox(i)
  i = i + 1 ' this value is not lost after the sub exited
End Sub

Sub Main()
  test()
  test()
  test()
End Sub


Step

Enables you to control the value of increment or decrement of a loop counter variable of a For-Next-Loop.


See also For


Sub

Sub SUBNAME(ARGUMENTS)...End Sub

Is a part of your program containing commands. A sub-procedure can have arguments, variables, expressions, or constants that are given to the sub-procedure when calling it.


Example

' sub example

Sub theMusic()
  MsgBox("represents cuba")
  MsgBox("your hips make a shift...")
  MsgBox("I'm the one to find you in the mood...")
  MsgBox("CUBA!")
  MsgBox("represents cuba")
  MsgBox("represents cuba")
End Sub

Sub Main()
  theMusic() ' first use of sub 
  theMusic() ' 2nd use 
  theMusic() ' 3rd use 
End Sub


Super

Reserved.


Then

If EXPRESSION Then...Else If EXPRESSION...Else...End If

A single decision is used to execute a set of statements if a condition is set ('If'-statement). If the condition is 'True' then the statements after the 'Then' are executed and the statements after the 'Else' are skipped. If the condition is 'False,' the statements after the 'Else' are executed.


Example

Dim i As Integer
Dim n As Integer 

If i 1 Then 
  n = 11111 
Else If i = 2 * 10 Then
  n = 22222 
Else 
  n = 33333 
End If


To

For VARIABLENAME = EXPRESSION To EXPRESSION [Step EXPRESSION]…Next

The statements that control decisions and loops are called control structures. Normally every command is executed only one time but in many cases it may be useful to run a command several times until a defined state has been reached. Loops repeat commands depending upon a condition. Some loops repeat commands while a condition is 'True', other loops repeat commands while a condition is 'False'. There are other loops repeating a fixed number of times and some repeat for all elements of a collection. The For-Next loop is useful when you know how often statements should be repeated. For-Next defines a loop that runs a specified number of times.


Example

Dim ctr As Integer

For ctr = 1 To 5 
  MsgBox("Z", i) 
Next


True

The boolean literal used for the true value.


Type

Type TYPENAME...End Type

Is a way of storing many variables inside one variable. A user defined data type is very useful when object-orientated programming is not available. It is like a class, many different variables are held together but without methods. Many kind of data types are allowed inside a user defined data type, even other user defined data types can be included.


Example

Type book
  bkname As String 
  isbn[1000] As Integer
End Type 

Type address
  books[50] As book
  age As Integer
  name As String 
End Type 

Dim j[10] As book

Sub Main()
  MsgBox(LBound(j, 1))
End Sub


UBound

UBound(VARIABLENAME [, Index])

Getting upper bound of an array. LBound is used for the upper bound.


Example

Type book
  bkname As String 
  isbn[1000] As Integer
End Type 

Type address
  books[50] As book
  age As Integer
  name As String 
End Type 

Dim j[10] As book

Sub Main()
  MsgBox(LBound(j, 1))
End Sub


See also UBound


Until

Do…Loop Until EXPRESSION
Do While EXPRESSION…Loop

The statements that control decisions and loops are called control structures. Normally every command is executed only one time but in many cases it may be useful to run a command several times until a defined state has been reached. Loops repeat commands depending upon a condition. Some loops repeat commands while a condition is ‘True,’ other loops repeat commands while a condition is ‘False.’ There are other loops repeating a fixed number of times and some repeat for all elements of a collection.
Use the following loops when you are not sure how often a command should be repeated: ‘Do’, ‘While’, ‘Loop’or ‘Until’. There are two different ways to use the keyword ‘While’ in order to test a condition within a ‘Do…Loop’-statement. You can test the condition before the commands inside the loop are executed or you can test the condition after the commands of the loop have been executed at least once. If the condition is ‘True’ ( in the following procedure ‘SubBefore’) the commands inside the loop execute.


Example

Sub SubBefore()
  Counter = 0
  myNumber = 20
  Do While myNumber > 10
    myNumber = myNumber - 1
    Counter = Counter + 1
  Loop
  MsgBox("Loop has been executed " & Counter & " time(s).")
End Sub

Sub SubAfter()
  Counter = 0
  myNumber = 9
  Do
    myNumber = myNumber - 1
    Counter = Counter + 1
  Loop While myNumber > 10
  MsgBox("Loop has been executed " & Counter & " time(s).")
End Sub


See also While, Loop, Until, For


While

While...End While

Do While EXPRESSION…Loop

Loop-statement. See Do fore more information.


See also Do, Loop


uiClass

_______Operators_______

 !

See also .


"

&

'

The comment symbol (') is used in many code lines in this book. Comments can explain a procedure or a statement. The compiler ignores all comments while compiling and running your program. To write a comment, use the symbol (') followed by the text of the comment. Comments are printed in green on screen.



Example

' this is a comment, too
Comments are extremely helpful when it comes to explaining your code to other programmers. So comments, normally, describe how your program works.


(

)

*

+

-

.

/

 :

<=

<>

=

==

===

>=

And

And operator


AndAlso

Flip

Mod

Not

Or

OrElse

Shl

Shr

Xor

\

^

_______Constants_______

-------Misc.-------

Alignment.AlignAbsolute

Alignment.AlignBottom

Aligns with the bottom.


Alignment.AlignCenter

Centers in both dimensions.


Alignment.AlignHCenter

Centers horizontally in the available space.


Alignment.AlignHorizontal_Mask

Combined.


Alignment.AlignJustify

Justifies the text in the available space.


Alignment.AlignLeading

Synonym for AlignLeft.


Alignment.AlignLeft

Aligns with the left edge.


Alignment.AlignRight

Aligns with the right edge.


Alignment.AlignTop

Aligns with the top.


Alignment.AlignTrailing

Synonym for AlignRight.


Alignment.AlignVCenter

Centers vertically in the available space.


Alignment.AlignVertical_Mask

Combined.


CaseInsensitive

CaseSensitive

See also CaseInsensitive


CheckState.Checked

The item is checked.


CheckState.PartiallyChecked

The item is partially checked. Items in hierarchical models may be partially checked if some, but not all, of their children are checked.


CheckState.Unchecked

The item is unchecked.


Dir.AllDirs

Dir.AllEntries

Dir.CaseSensitive

Dir.Dirs

Dir.Drives

Dir.Executable

Dir.Files

Dir.Hidden

Dir.Modified

Dir.NoDotAndDotDot

Dir.NoFilter

Dir.NoSymLinks

Dir.Readable

Dir.System

Dir.Writable

EchoMode.NoEcho

Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret.


EchoMode.Normal

Display characters as they are entered. This is the default.


EchoMode.Password

Display asterisks instead of the characters actually entered.


EchoMode.PasswordEchoOnEdit

Display characters as they are entered while editing otherwise display asterisks.


Flags.ItemIsDragEnabled

It can be dragged.


Flags.ItemIsDropEnabled

It can be used as a drop target.


Flags.ItemIsEditable

It can be edited.


Flags.ItemIsEnabled

The user can interact with the item.


Flags.ItemIsSelectable

It can be selected.


Flags.ItemIsTristate

The item is checkable with three separate states.


Flags.ItemIsUserCheckable

It can be checked or unchecked by the user.


Flags.NoItemFlags

It does not have any properties set.


InputDialog.NoEcho

InputDialog.Normal

InputDialog.Password

InputDialog.PasswordEchoOnEdit

MatchFlags.MatchCaseSensitive

The search is case sensitive.


MatchFlags.MatchContains

The search term is contained in the item.


MatchFlags.MatchEndsWith

The search term matches the end of the item.


MatchFlags.MatchExactly

Performs QVariant-based matching.


MatchFlags.MatchFixedString

Performs string-based matching. String-based comparisons are case-insensitive unless the MatchCaseSensitive flag is also specified.


MatchFlags.MatchRecursive

Searches the entire hierarchy.


MatchFlags.MatchRegExp

Performs string-based matching using a regular expression as the search term.


MatchFlags.MatchStartsWith

The search term matches the start of the item.


MatchFlags.MatchWildcard

Performs string-based matching using a string with wildcards as the search term.


MatchFlags.MatchWrap

Perform a search that wraps around, so that when the search reaches the last item in the model, it begins again at the first item and continues until all items have been examined.


MessageBox.Abort

MessageBox.AcceptRole

MessageBox.ActionRole

MessageBox.Apply

MessageBox.ApplyRole

MessageBox.Cancel

MessageBox.Close

MessageBox.Critical

MessageBox.DestructiveRole

MessageBox.Discard

MessageBox.Help

MessageBox.HelpRole

MessageBox.Ignore

MessageBox.Information

MessageBox.InvalidRole

MessageBox.No

MessageBox.NoButton

MessageBox.NoIcon

MessageBox.NoRole

MessageBox.NoToAll

MessageBox.Ok

MessageBox.Open

MessageBox.Question

MessageBox.RejectRole

MessageBox.Reset

MessageBox.ResetRole

MessageBox.RestoreDefaults

MessageBox.Retry

MessageBox.Save

MessageBox.SaveAll

MessageBox.Sheet

MessageBox.Warning

MessageBox.Yes

MessageBox.YesRole

MessageBox.YesToAll

MsgBox.Abort

MsgBox.Apply

MsgBox.Cancel

MsgBox.Close

MsgBox.Discard

MsgBox.Help

MsgBox.Ignore

MsgBox.No

MsgBox.NoButton

MsgBox.NoToAll

MsgBox.Ok

MsgBox.Open

MsgBox.Reset

MsgBox.RestoreDefaults

MsgBox.Retry

MsgBox.Save

MsgBox.SaveAll

MsgBox.Yes

MsgBox.YesToAll

QDialog.Accepted

QDialog.Rejected

QMdiArea.SubWindowView

QMdiArea.TabbedView

QTableWidget.MatchCaseSensitive

QTableWidget.MatchContains

QTableWidget.MatchEndsWith

QTableWidget.MatchExactly

QTableWidget.MatchFixedString

QTableWidget.MatchRecursive

QTableWidget.MatchRegExp

QTableWidget.MatchStartsWith

QTableWidget.MatchWildcard

QTableWidget.MatchWrap

SectionCaseInsensitiveSeps

SectionDefault

SectionIncludeLeadingSep

SectionIncludeTrailingSep

SectionSkipEmpty

SystemTray.Context

SystemTray.Critical

SystemTray.DoubleClick

SystemTray.Information

SystemTray.MiddleClick

SystemTray.NoIcon

SystemTray.Trigger

SystemTray.Unknown

SystemTray.Warning

TextAlignment.AlignAbsolute

TextAlignment.AlignBottom

Aligns with the bottom.


TextAlignment.AlignCenter

Centers in both dimensions.


TextAlignment.AlignHCenter

Centers horizontally in the available space.


TextAlignment.AlignHorizontal_Mask

Combined.


TextAlignment.AlignJustify

Justifies the text in the available space.


TextAlignment.AlignLeading

Synonym for AlignLeft.


TextAlignment.AlignLeft

Aligns with the left edge.


TextAlignment.AlignRight

Aligns with the right edge.


TextAlignment.AlignTop

Aligns with the top.


TextAlignment.AlignTrailing

Synonym for AlignRight.


TextAlignment.AlignVCenter

Centers vertically in the available space.


TextAlignment.AlignVertical_Mask

Combined.


TextInteractionFlags.LinksAccessibleByKeyboard

Links can be focused using tab and activated with enter.


TextInteractionFlags.LinksAccessibleByMouse

Links can be highlighted and activated with the mouse.


TextInteractionFlags.NoTextInteraction

No interaction with the text is possible.


TextInteractionFlags.TextBrowserInteraction

Combined.


TextInteractionFlags.TextEditable

The text is fully editable.


TextInteractionFlags.TextEditorInteraction

Combined.


TextInteractionFlags.TextSelectableByKeyboard

Text can be selected with the cursor keys on the keyboard. A text cursor is shown.


TextInteractionFlags.TextSelectableByMouse

Text can be selected with the mouse and copied to the clipboard using a context menu or standard keyboard shortcuts.


vbAbort

vbAbortRetryIgnore

vbCancel

vbCr

vbCrLf

vbCritical

vbDefaultButton1

vbDefaultButton2

vbDefaultButton3

vbExclamation

vbIgnore

vbInformation

vbLf

vbNo

vbOK

vbOKCancel

vbOKOnly

vbQuestion

vbRetry

vbRetryCancel

vbYes

vbYesNo

vbYesNoCancel

Contents



(C)opyright KBasic Software 2009-2010. All right reserved.