Table of Contents

STATIC OBJECTS

My

Implemented since KBasic V1.77.

Functions are

Abs , AddDays , AddHours , AddMinutes , AddMonths , AddSeconds , AddYears , Append , Asc , Boolean , Byte , Bin , CBool , CByte , CDbl , Chr , CInt , Compare , Contains , Count , Cos , Class , CSng , Currency , Date , Day , DayName , DayOfWeek , DayOfYear , DaysInMonth , DaysInYear , DateTime , Decimal , Decode , DiffDays , DiffSeconds , DoEvents , Double , Encode , EndsWith , Exp , File , FileCopy , FileLen , Fill , Fix , Format , Function , Hex , Hour , IndexOf , InputBox , Insert , InStr , InStRev , Int , IsDateValid , IsDateTimeValid , IsLeapYear , IsTimeValid , IsLinux , IsMac , IsNull , IsWindows , LastIndexOf , LCase , Left , LeftJustified , Len , Length , Line (Meta) , Log , Long , Lower , LTrim , Max , Mid (Builtin) , Min , Minute , Module , Month , MonthName , MsgBox , Now , Peek , Poke , Prepend , Print , Random , Randomize , ReadBinary , Remove , Replace , Reversed , Right , RightJustified , Rnd , Round , RTrim , Second , Section , SeekBinary , Sgn , Short , Simplified , Sin , Single , Size , Space , Split , StartsWith , Str , StrComp , String (Cast) , StrReverse , Sub , SubDays , SubHours , SubMinutes , SubMonths , SubSeconds , SubYears , Sqr , Tan , Time , Trim , Trimmed , Truncate , Type , UCase , Unicode , Upper , Utf8 , Utf16 , Val , Value , WeekNumber , WriteBinary, Year

Example

Print My.Abs(-1)

String

Implemented since KBasic V1.77.

Functions are

Append , Asc , Compare , Contains , Count , Decode , Encode , EndsWith , Fill , Format , IndexOf , Insert , InStr , InStRev , LastIndexOf , LCase , Left , LeftJustified , Len , Length , Lower , LTrim , Mid (Builtin) , Peek , Poke , Prepend , ReadBinary , Remove , Replace , Reversed , Right , RightJustified , RTrim , Section , SeekBinary , Simplified , Split , StartsWith , StrComp , StrReverse , Trim , Trimmed , Truncate , UCase , Unicode , Upper , Utf8 , Utf16 , Val , Value , WriteBinary

Example

Log String.Upper("lowered text")

DateTime

Implemented since KBasic V1.78.

Functions are

AddDays , AddHours , AddMinutes , AddMonths , AddSeconds , AddYears , Date , Day , DayName , DayOfWeek , DayOfYear , DaysInMonth , DaysInYear , DiffDays , DiffSeconds , Hour , IsDateValid , IsDateTimeValid , IsLeapYear , IsTimeValid , Minute , Month , MonthName , Now , Second , SubDays , SubHours , SubMinutes , SubMonths , SubSeconds , SubYears , Time , WeekNumber , Year

Example

Print DateTime.Now()

Utility

Implemented since KBasic V1.77.

Functions are

Bin , Format , Hex , Random , Randomize , Round

Example

Print Utility.Hex(255)

Cast

Implemented since KBasic V1.77.

If you need a different language to deal with different formats use Application.SetLanguage. If you do not set the language the current local language set by the operating system is used.

Example

Application.SetLanguage("English") ' sets for values like 23,345.45

Functions are

Boolean , String (Cast) , Byte , Short , Integer , Long , Single , Double , Decimal , DateTime , Currency , Date (Cast)

Example

Dim n As Integer = Cast.Integer("567")
Print n

Catching a cast exception (new style)

Try 
  date_ = Date(True) Throws CastException
  Print date_
Catch (CastException)
  Print "Could not convert expression"
End Catch

Literal

Implemented since KBasic V1.77.

Functions are

Returns a “\n” like kbCr does. Ought to be used for creating a multi-line messagebox string.

Don't write “Literal.Return”, but “Return” only.

Example

MsgBox "Hello" & Return & "World"

Dim b As Boolean = True

Debug

Implemented since KBasic V1.77.

Functions are

Example

  Log File ' prints out current code file
  Log Debug.Line ' prints out current code line
  Log Debug.IsWindows

The Qt documentation in C++ of this class (QMenuBar) can be read here: http://doc.trolltech.com/4.3/qmenubar.html

You may use one MenuBar object in your application only. Name your menubar “myMenuBar” in the project window's file, which you would like to have used by the compiler for building your application.

KBasic adds two menus to your menubar at the end, if the project type property is set to “MDI Application”. First one is the window menu, which is for handling the window list and the help menu creating two menu entries 'Contents' and 'About'. To translate those menu entries, take a look at the translate dialog in the KBasic IDE.

It is possible to completely replace those automatically created menu entries, by providing user created menu items.

For the Windows Menu

“Close” → MainWindow.Close()
“Close All” → MainWindow.CloseAll()
“Tile” → MainWindow.Tile()
“Cascade” → MainWindow.Cascade()
“Next” → MainWindow.SetFocusNext()
“Previous” → MainWindow.SetFocusPrevious()

For the Records Menu

“Add Filter” → Application.CurrentForm().AddFilter(”=”)
“Add NotFilter” → Application.CurrentForm().AddFilter(”<>”)
“Clear Filter” → Application.CurrentForm().ClearFilter
“Set Filter” → Application.CurrentForm().SetFilter(”=”)
“Set NotFilter” → Application.CurrentForm().SetFilter(”<>”)
“Sort Ascending” → Application.CurrentForm().SortAscending()
“Sort Descending” → Application.CurrentForm().SortDescending()
“Seek” → Application.CurrentForm.Seek(…)
“Requery” → Application.CurrentForm.Requery()

Use the following static function of the class MenuBar to get the menubar item of the current menubar.

Dim i As MenuBarItem = MenuBar.MenuBarItem("File")
i.Enabled = True

Events are

Sub Contents_OnEvent()
  Print "Contents clicked"
End Sub

Sub About_OnEvent()
  Print "About clicked"
End Sub

The following functions are implemented since KBasic V1.6 (l)

The following functions are implemented since KBasic V1.6 (m)

Shows a context menu.

The last used menu is expected as menubaritem.

Creates a context menu.

The last used menu is expected as parent menubaritem.

Creates a top-level menu for the menubar.

Creates a child menu for a top-level menu, a context menu or other child menu.

The last used menu is expected as parent menubaritem.

Events in class myEvent:

The following functions are implemented since KBasic V1.6 (n)

The following functions are implemented since KBasic V1.77

Creates a top-level menu for the menubar.


ToolBar

The Qt documentation in C++ of this class (QToolBar) can be read here: http://doc.trolltech.com/4.3/qtoolbar.html

You may use one ToolBar object in your application only. Name your toolbar “myToolBar” in the project window's file, which you would like to have used by the compiler for building your application.

Use the following static function of the class ToolBar to get the toolbar item of the desired toolbar.

Dim i As ToolBarItem = ToolBar.ToolBarItem("File")
i.Enabled = True

Use the following static function of the class ToolBar to add custom controls. Implemented since KBasic V1.6 (k).

The following functions are implemented since KBasic V1.6 (l)

The following functions are implemented since KBasic V1.6 (n)


StatusBar

Implemented since KBasic V1.6 (k).

Available for MDI projects only.

Methods:


Math

Enables you to directly use the math functions commonly used in BASIC applications. It declares a set of functions to compute common mathematical operations and transformations.

Methods are

The following functions can be emulated by existing math functions:

Sekans(X) = 1 / Cos(X) 
Kosekans(X) = 1 / Sin(X) 
Kotangens(X) = 1 / Tan(X) 
Arkussinus(X) = Atn(X / Sqr(-X * X + 1)) 
Arkuskosinus(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1) 
Arkussekans(X) = Atn(X / Sqr(X * X – 1)) + Sgn((X) – 1) * (2 * Atn(1)) 
Arkuskosekans(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) - 1) * (2 * Atn(1)) 
Arkuskotangens(X) = Atn(X) + 2 * Atn(1) 
HSin(X) = (Exp(X) – Exp(-X)) / 2  
HCos(X) = (Exp(X) + Exp(-X)) / 2 
HTan(X) = (Exp(X) – Exp(-X)) / (Exp(X) + Exp(-X)) 
HSekans(X) = 2 / (Exp(X) + Exp(-X)) 
HKosekans(X) = 2 / (Exp(X) – Exp(-X)) 
HKotangens(X) = (Exp(X) + Exp(-X)) / (Exp(X) – Exp(-X)) 
HArkussinus(X) = Log(X + Sqr(X * X + 1)) 
HArkuskosinus(X) = Log(X + Sqr(X * X - 1)) 
HArkustangens(X) = Log((1 + X) / (1 – X)) / 2 
HArkussekans(X) = Log((Sqr(-X * X + 1) + 1) / X) 
HArkuskosekans(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X) 
HArkuskotangens(X) = Log((X + 1) / (X – 1)) / 2 
LogN(X) = Log(X) / Log(N) 

CMath

Enables you to directly use the C library math functions commonly used in C/C++ applications. It declares a set of functions to compute common mathematical operations and transformations.

Implemented since KBasic V1.6 (n).

Methods are

Trigonometric functions:

Hyperbolic functions:

Exponential and logarithmic functions:

Power functions

Rounding, absolute value and remainder functions:

Print CMath.atan(232.23)

Not implemented yet:

modf, ldexp and frexp


Application

The Qt documentation in C++ of this class (QApplication) can be read here: http://doc.trolltech.com/4.3/qapplication.html

Application Settings:

Only works, if MDI project:

Works everytime:

The following link lists all available stylesheets properties: http://doc.trolltech.com/4.3/stylesheet.html

Properties:

Maybe used only, if there is a mainwindow (see properties of project. Additionally, myMenuBar menubar class must be created):

Methods:

Maybe used only, if there is a mainwindow (see properties of project. Additionally, myMenuBar menubar class must be created):

Closes forms only related to the mainwindow. Forms like dialogs, toolbox windows and dock windows are not closed. See CloseAllWindows.

Implemented since KBasic V1.74

Possible values are TabbedView, SubWindowView

Only available for MDI applications.

Only available for MDI applications.

Maybe a file in the project directory or an absolute path.

Might be a String containing binary data. See the binary project example for using.

More Methods (not related to application's mainwindow):

Maybe used anytime:

It points to the kbasic runtime when you don't create an exe, and the pcode is executed by kbrun.exe.

If you create a standalone application using the exe-creator in the tools menu, it points to the exe file somewhere else.

It points to the kbasic runtime when you don't create an exe, and the pcode is executed by kbrun.exe.

If you create a standalone application using the exe-creator in the tools menu, it points to the exe file somewhere else.

Implemented since KBasic V1.81

Returns the same values as DirectoryName. Provided for VB6 compatibility.

Maybe a file in the project directory or an absolute path.

Must be an absolute path name, meaning with “c:\…\…\…” on Windows.

Returns the arguments as given to the application as one single string.

The following functions are implemented since KBasic V1.6 (l)

Maybe a file in the project directory or an absolute path.

Might be a String containing binary data. See the binary project example for using.

Must be an absolute path name, meaning with “c:\…\…\…” on Windows.

Even forms not related to the mainwindow are closed.

Returns true if layout has been set from right to left.

This function is particularly useful for applications with many top-level windows.

Possible values are Motif, CDE, Windows, Cleanlooks, Plastique, WindowsXP, WindowsVista, DotNetStandard, DotNetOffice.

WindowsVista is only available on Windows Vista.

Some examples

Application.X = 0 ' set the mainwindow to all left
Application.Stop() ' halts your program and exits it immediately

Implemented since KBasic V1.73

Might be an URL to a file of a website or a local file as well.

  ' show kbasic website xml file
  MsgBox Application.LoadURLAsString("www.kbasic.com/kbasic_pad.xml"), 0, "www.kbasic.com/kbasic_pad.xml"

Returns information about, if mp3 or mpeg or other media files are supported.

  Dim ss As Strings = Application.AvailableMimeTypes()
   For Each s As String In ss
     Print s;" ";
   Next
  MsgBox Application.IsMimeTypeAvailable("audio\mp3")

Implemented since KBasic V1.76

Possible values are http://doc.trolltech.com/4.4/qlocale.html#Language-enum

Might be a String containing binary data. See the binary project example for using.

Might be a String containing binary data. See the binary project example for using.

Implemented since KBasic V1.77

Might be an URL to a file of a website or a local file as well.

  MsgBox Application.LoadURLAsBinary("file:///C:/myimage.png")

Possible values are http://doc.trolltech.com/4.4/qlocale.html#Country-enum

Implemented since KBasic V1.8

Returns a binary string containing a standard icon of the operating system.

Possible values are http://doc.trolltech.com/4.4/qstyle.html#StandardPixmap-enum

Application.SetIcon(Application.StandardIcon("BrowserReload"))

Implemented since KBasic V1.82

Prints html code to the printer. Must be a complete html. Currently, only text is printed.

Creates a pdf file named “FileName” with the content of “Html”.

Only works on Mac OS X yet. Currently, only text is printed.

Implemented since KBasic V1.83

Implemented since KBasic V1.89(q)


MainWindow

The Qt documentation in C++ of this class (QMainWindow) can be read here: http://doc.trolltech.com/4.3/qmainwindow.html

Implemented since KBasic V1.75.

Properties:

Maybe used only, if there is a mainwindow (see properties of project. Additionally, myMenuBar menubar class must be created):

If true form’s size may be changed by user.

Implemented since KBasic V1.89(q).

If true form’s size may be changed by user. Allows only growing the width and height.

Implemented since KBasic V1.89(q).

If true form’s size may be changed by user. Allows only shrinking the width and height.

Implemented since KBasic V1.89(q).

Methods:

Maybe used only, if there is a mainwindow (see properties of project. Additionally, myMenuBar menubar class must be created):

Closes forms only related to the mainwindow. Forms like dialogs, toolbox windows and dock windows are not closed. See CloseAllWindows of Application.

Implemented since KBasic V1.74

Possible values are TabbedView, SubWindowView

Only available for MDI applications.

Only available for MDI applications.

Maybe a file in the project directory or an absolute path.

Might be a String containing binary data. See the binary project example for using.

Implemented since KBasic V1.76.


Forms

The Qt documentation in C++ of this class (QMainWindow) can be read here: http://doc.trolltech.com/4.3/qmainwindow.html

It is the controller of your forms.

It opens and closes the forms (or activate or deactivate them). There are two types of objects in kbasic: visual objects, and non-visual objects. A visual object is a control and visible at runtime and lets users interact with your application; it has a screen position, a size and a foreground color. Examples of visual objects are forms and buttons. An invisible object is not visible at runtime, such as a timer. Some objects can contain other components, such as an application window containing a button. With KBasic, you add visual objects/controls to your forms to assemble applications.

Projects keep your work together. When developing an appication in kbasic, you work mainly with projects. A project is a collection of files that make up your application. You create a project ot manage and organize these files. KBasic provides an easy yet sophisticated system to manage the collection fo files that make up a project. The project window shows each item in a project. Starting a new application with KBasic begins with the creation fo a project. So before you can construct an application, you need to create a new project. A project consists of many separate files collected in one project directory, where one *.kbasic_project file is and many other files:

The Forms class may only be used, if project's main form is set to “Main()” (see properties of project). Additionally, myMenuBar menubar class must be created and the project type property must be set to “MDI Application”. If you are not sure about how to set all settings, create a new project with type MDI application.

Open a form

Opening is easy use the following code:

  Dim f As FORMNAME = New FORMNAME : f.Open()

E.g. if you form is named Form1 you have to write

  Dim f As Form1 = New Form1 : f.Open()

' OR

Forms.Open("FORMNAME") ' for this call you must setup mainwindow in projects properties

Since KBasic V1.6 (k) all forms are automatically declared as global variables accessable from everywhere. So if you would have a form named 'myForm', you could use it like this

' code somewhere in your module or other form module

myForm.Open ' if myForm is already opened, it is shown and get the focus only
myForm.Caption = "hello"

Methods:

Returns the name of the form, which has got the focus currently.

Returns the name of the first form in the form list. Only opened forms are in this list and only normal forms (forms which are not DockWindows or Dialogs).

Example

Dim n As String

n = Forms.First()

If n <> "" Then

  Do
    Dim f As Form
    f = Forms.Form(n)
    ' place your code here
    
    n = Forms.Next()
  Loop While n <> ""

End If

Returns the name of the next form in the form list and only normal forms (forms which are not DockWindows or Dialogs).. If it returns and empty string, there is no further form.

Sets the focus to the form you wish.

Events in 'Event' class:

It is possible that FormName is ””, which means no form has got focus right now. If so, you ought to set the menubar and toolbar entries disabled or enabled as it is expected to work, when no form has got focus.


Sounds

Implemented since KBasic V1.75.

The Qt documentation in C++ of this class can be read here: http://doc.trolltech.com/4.4/phonon.html

Sounds is a list of Sound.

Methods Of Sounds:


Pixmaps

The Qt documentation in C++ of this class (QPixmap) can be read here: http://doc.trolltech.com/4.3/qixmap.html

See the paint project examples for seeing how to use the pixmaps class.

Pixmaps is a list of Pixmap.

Methods Of Pixmaps:

Read Painter for the usage of Pixmaps.


Colors

The Qt documentation in C++ of this class (QColor) can be read here: http://doc.trolltech.com/4.3/qcolor.html

Colors is a list of Color.

Methods Of Colors:

Alpha = 0 means fully transparent, Alpha = 255 means fully visible

Predefined colors are:

Color.White, Color.Black, Color.Red, Color.DarkRed, Color.Green, Color.DarkGreen, Color.Blue, Color.DarkBlue, Color.Cyan, Color.DarkCyan, Color.Magenta, Color.DarkMagenta, Color.Yellow, Color.DarkYellow, Color.Gray, Color.DarkGray, Color.LightGray, Color.Color0, Color.Color1, and Color.Transparent.

Beware that you use the predefined color objects for property control colors with the right syntax.

Background = Color.Red ' !Wrong!
Background = "Color.Red" ' right
Background = "Red" ' right

Fonts

The Qt documentation in C++ of this class (QFont) can be read here: http://doc.trolltech.com/4.3/qfont.html

Fonts is a list of Font.

Methods Of Fonts:


Painter

The Qt documentation in C++ of this class (QPainter) can be read here: http://doc.trolltech.com/4.3/qpainter.html

You might want to use it to override the event methods of Control, when you would like to implement your own controls for display data or interact with the user. You must override OnPaint(…) and use the following functions.

Example

Your form contains of Box1 (control type Box).

Sub Box1_OnPaint(X As Integer, Y As Integer, Width As Integer, Height As Integer)
  Painter.DrawRect(11, 22, 33, 44)
End Sub

Use the following paint functions:

The Qt documentation says

The StartAngle and SpanAngle must be specified in 1/16th of a degree, i.e. a full circle equals 5760 (16 * 360). Positive values for the angles mean counter-clockwise while negative values mean the clockwise direction. Zero degrees is at the 3 o'clock position.



Possible values for BrushStyle are:



Possible values for PenStyle are:



Possible values for PenCapStyle are:



Possible values for PenCapStyle are:



Implemented since KBasic V1.74

Implemented since KBasic V1.77

Same as DrawBinary above. Provided for your convinience.

Same as DrawBinary above. Provided for your convinience.

Same as DrawBinary above. Provided for your convinience.

Drawing in binary string.

Get the binary string after drawing.


OpenDialog

The Qt documentation in C++ of this class (QFileDialog) can be read here: http://doc.trolltech.com/4.3/qfiledialog.html

Implemented since KBasic V1.6 (m).

Methods:

Dim filenames As Strings = OpenDialog.GetFiles()
If filenames.Length > 0 Then
  Dim s As String
  For Each s In filenames
    Print s
  Next
End If

For V2.x

GetFile() GetFileWith(…) GetFiles() GetFilesWith(…)


SaveDialog

The Qt documentation in C++ of this class (QFileDialog) can be read here: http://doc.trolltech.com/4.3/qfiledialog.html

Implemented since KBasic V1.6 (m).

Methods:

Dim filename As String = SaveDialog.GetFile()
If filename Then
  Print filename
End If

ColorDialog

The Qt documentation in C++ of this class (QColorDialog) can be read here: http://doc.trolltech.com/4.3/qcolordialog.html

Implemented since KBasic V1.77.

Methods:

If ColorDialog.GetColor() Then
  Print ColorDialog.Red, ColorDialog.Green, ColorDialog.Blue, ColorDialog.Alpha 
End If

FontDialog

The Qt documentation in C++ of this class (QFontDialog ) can be read here: http://doc.trolltech.com/4.3/qfontdialog.html

Implemented since KBasic V1.77.

Methods:

If FontDialog.GetFont() Then
  Print FontDialog.Name, FontDialog.Size
End If

ProgressDialog

The Qt documentation in C++ of this class (QProgressDialog) can be read here: http://doc.trolltech.com/4.3/qprogressdialog.html

Implemented since KBasic V1.77.

Methods:

Properties:

ProgressDialog.Maximum = 100
ProgressDialog.Caption = "Large Operation"
ProgressDialog.CancelCaption = "Cancel"
ProgressDialog.Show()

Do While True

  Application.DoEvents()

  If ProgressDialog.Canceled() Then 
    Exit Loop
  End If

  ProgressDialog.Value = ProgressDialog.Value + 1
  ' do calculation

  If ProgressDialog.Value = 100 Then Exit Loop   

Loop			

ProgressDialog.Hide()

InputDialog

The Qt documentation in C++ of this class (QInputDialog) can be read here: http://doc.trolltech.com/4.3/qinputdialog.html

Implemented since KBasic V1.77.

Methods:

Returns true, if the user pressed “Okay” and value is valid.

Echo might be

NormalDisplay characters as they are entered. This is the default.
NoEchoDo not display anything. This may be appropriate for passwords where even the length of the password should be kept secret.
PasswordDisplay asterisks instead of the characters actually entered.
PasswordEchoOnEditDisplay characters as they are entered while editing otherwise display asterisks.
Dim s As String = InputDialog.GetString("Input some value")
If InputDialog.Ok() Then
  Print s
End If

MessageBox

The Qt documentation in C++ of this class (QMessageBox) can be read here: http://doc.trolltech.com/4.3/qmessagebox.html

Implemented since KBasic V1.77.

Methods:

Possible values for buttons are

Ok, Open, Save, Cancel, Close, Discard, Apply, Reset, RestoreDefaults, Help, SaveAll, Yes, YesToAll, No, NoToAll, Abort, Retry, Ignore

Example

Select MessageBox.Show("Your choice", "Select one button", "Ok;Cancel;Save", "", "DetailedText", "EDIT_CUT.png")
  Case "Ok"
    Print "Ok"
  Case "Cancel"
    Print "Cancel"
End Select  

Select MessageBox.Critical("Your choice", "Select one button", "Ok;Cancel;Save")
  Case "Ok"
    Print "Ok"
  Case "Cancel"
    Print "Cancel"
End Select    

SystemTray

Implemented since KBasic V1.74b.

The Qt documentation in C++ of this class (QSystemTrayIcon) can be read here: http://doc.trolltech.com/4.3/qsystemtrayicon.html

This class provides an icon for an application in the system tray.

The Qt documentation says that modern operating systems usually provide a special area on the desktop, called the system tray or notification area, where long-running applications can display icons and short messages.

The SystemTray class can be used on the following platforms:

On Windows, the system tray icon size is 16×16; on X11, the preferred size is 22×22. The icon will be scaled to the appropriate size as necessary.

The icon is initially invisible.

Methods:

Possible values are NoIcon, Information, Warning, Critical

TimeOut = 1000 means 1 second. On Windows, the TimeOut is usually ignored by the system when the application has focus.

Properties:

The menu will pop up when the user requests the context menu for the system tray icon by clicking the mouse button. You need to have at least an empty menubar created in your project.

Events in the event class:

Event may contain

or

UnknownUnknown reason
ContextThe context menu for the system tray entry was requested
DoubleClickThe system tray entry was double clicked
TriggerThe system tray entry was clicked
MiddleClickThe system tray entry was clicked with the middle mouse button

Not implemented yet:


Log

It is recommended to use this class to print out log information during your program's execution. It supports Unicode text.

Implemented since KBasic V1.6 (q).

Methods:

Example

Log "Hello World"  ' use of the shortcut call of the Log.Print

Not implemented yet:


Actions

Implemented since KBasic V1.76.

Methods

Events in 'Event' class:

Not implemented yet:

Actions{“FILE_OPEN”}.SetEnabled(True)

Actions{“FILE_OPEN”}.Enabled = True Actions{“FILE_OPEN”}.Enabled = Not Actions{“FILE_OPEN”}.Enabled


Preferences

Implemented since KBasic V1.76.

Predefined preferences

It is used to determine which language translation should be used on application startup.

Methods

Not implemented yet:


Dir

Implemented since KBasic V1.76.

An object to access and manipulate the directories of your system.


File

Implemented since KBasic V1.76.

An object to access and manipulate the files of your system.


Process

Implemented since KBasic V1.77.

Methods:

Process.Run("explorer") ' starts the explorer on Windows

Not implemented yet:

QProcess::startDetached


DatabaseDialog

Implemented since KBasic V1.79. Only works for MySQL or PostgreSQL.

Methods:

If DatabaseDialog.GetDatabase() Then
  Print DatabaseDialog.Driver, DatabaseDialog.Name
End If

Database

Implemented since KBasic V1.79.

Functions are

Write

Database.DefaultOptions

don't write

Options = "DefaultOptions"

Clears alle tables of the current databases. All data is lost!

Always use it for opening sqlite databases.

Not supported yet:


Table

Implemented since KBasic V1.79.

Functions are

Creates a new table from project definition table file. A table definition with the same name must be in the project file list.

All create table methods automatically add a field “kbrecordid” to the table as unique record id. If you need another field as primary key, use a custom SQL statement and execute it with Query.Run(“SQL statement”)

Before V1.89, it returns “kbrecordid” always.

Not implemented yet:


Records

Implemented since KBasic V1.79.

Functions are

First record is at Position = 1.

Returns -1, if length could not be returned.

First record is at Position = 1.

All following functions are not implemented yet:

Currently, it returns the value of “kbrecordid” always.

Currently, it returns “kbrecordid” always.

Records{RecordId, "name"} = "hello"
Records{RecordId, "age"} = 43

Print Records{RecordId, "name"}
Print Records{RecordId, "age"}

Query

Implemented since KBasic V1.79.

Functions are

Runs a sql statement from project definition query file, if file name is given, else it runs QueryNameOrSql as sql statement. A query definition with the same name must be in the project file list.

Check out Records as well.

Useful for running generic database commands, e.g. having a sqlite database:

       Dim a As Dictionary = Query.Command("PRAGMA database_list;")
       
       Dim ss As Strings = a.Keys()
       dim i as integer
       For i=0 to ss.length()
         Print( ss.String(i))
         Print( a.String(ss.String(i)))
       Next