DVX BASIC IDE Guide

DVX BASIC is a Visual BASIC development environment for the DVX GUI System. It provides a VB3-style integrated development environment with a code editor, form designer, project system, and a full interactive debugger -- all running natively on DOS under the DVX windowing system.

This guide covers every feature of the IDE: menus, toolbar, editor, form designer, project management, debugger, and auxiliary windows.

IDE Windows

The DVX BASIC IDE is modeled after Visual Basic 3.0. It consists of several floating windows arranged on the DVX desktop:

Debug Windows -- Locals, Call Stack, Watch, and Breakpoints windows that appear automatically when debugging.

The IDE compiles BASIC source into bytecode and runs it in an integrated virtual machine (VM). Programs execute in cooperative slices (10,000 VM steps per slice), yielding to the DVX event loop between slices so the GUI remains responsive.

File Menu

Edit Menu

Run Menu

View Menu

Window Menu

Tools Menu

Help Menu

Toolbar

Code Editor

Form Designer

Project System

Properties Panel

Toolbox

Debugger

Locals Window

Call Stack Window

Watch Window

Breakpoints Window

Immediate Window

Output Window

Find / Replace

Preferences

Keyboard Shortcuts

File Menu

  Menu Item              Shortcut   Description
  ---------              --------   -----------
  New Project...                    Create a new DVX BASIC project.
  Open Project...                   Open an existing .dbp project file.
  Save Project                      Save the current project file to disk.
  Close Project                     Close the current project (prompts to save unsaved changes).
  ---
  Project Properties...             Edit project metadata (name, author, version, startup form, icon, etc.).
  ---
  Add File...            Ctrl+O     Add a .bas or .frm file to the project. If no project is open, creates an implicit project from the file.
  Save File              Ctrl+S     Save the active file to disk.
  Save All                          Save all modified files in the project.
  ---
  Remove File                       Remove the selected file from the project (prompts to save if modified).
  ---
  Exit                              Close the IDE (prompts to save unsaved changes).

Edit Menu

Back to Overview

Edit Menu

  Menu Item    Shortcut   Description
  ---------    --------   -----------
  Cut          Ctrl+X     Cut selected text to the clipboard.
  Copy         Ctrl+C     Copy selected text to the clipboard.
  Paste        Ctrl+V     Paste text from the clipboard.
  ---
  Select All   Ctrl+A     Select all text in the active editor.
  ---
  Delete       Del        Delete the selected text or control (in the form designer).
  ---
  Find...      Ctrl+F     Open the Find/Replace dialog.
  Find Next    F3         Find the next occurrence of the search text.
  Replace...   Ctrl+H     Open the Find/Replace dialog with replace enabled.

Run Menu

Back to Overview

Run Menu

  Menu Item                Shortcut         Description
  ---------                --------         -----------
  Run                      F5               Compile and run the program. If paused at a breakpoint, resumes execution with debugging disabled (runs free).
  Debug                    Shift+F5         Compile and run with the debugger active. Breakpoints are active but execution does not pause at the first statement. If paused, resumes to the next breakpoint.
  Run Without Recompile    Ctrl+F5          Re-run the last compiled module without recompiling.
  Stop                     Esc              Stop the running program immediately.
  ---
  Step Into                F8               Execute one statement, stepping into SUB/FUNCTION calls. If idle, starts a debug session and breaks at the first statement.
  Step Over                Shift+F8         Execute one statement, stepping over SUB/FUNCTION calls.
  Step Out                 Ctrl+Shift+F8    Run until the current SUB/FUNCTION returns.
  Run to Cursor            Ctrl+F8          Run until execution reaches the line where the cursor is positioned.
  ---
  Toggle Breakpoint        F9               Toggle a breakpoint on the current editor line.
  ---
  Clear Output                              Clear the Output window.
  ---
  Save on Run                               Checkbox: when enabled, all modified files are saved automatically before compiling. Persisted in preferences.

View Menu

Back to Overview

View Menu

  Menu Item        Shortcut   Description
  ---------        --------   -----------
  Code             F7         Switch to Code view for the active file (or the file selected in the Project Explorer).
  Designer         Shift+F7   Switch to Design view for the active form file.
  ---
  Toolbar                     Checkbox: show or hide the toolbar. Persisted in preferences.
  Status Bar                  Checkbox: show or hide the status bar. Persisted in preferences.
  ---
  Menu Editor...   Ctrl+E     Open the Menu Editor dialog for the active form. Allows designing menu bars with captions, names, levels, checked state, and enabled state.

Window Menu

Back to Overview

Window Menu

  Menu Item          Description
  ---------          -----------
  Code Editor        Show or raise the Code Editor window.
  Output             Show or raise the Output window.
  Immediate          Show or raise the Immediate window.
  Locals             Show or raise the Locals debug window.
  Call Stack         Show or raise the Call Stack debug window.
  Watch              Show or raise the Watch debug window.
  Breakpoints        Show or raise the Breakpoints window.
  ---
  Project Explorer   Show or raise the Project Explorer window.
  Toolbox            Show or raise the Toolbox window.
  Properties         Show or raise the Properties panel.

Tools Menu

Back to Overview

Tools Menu

  Menu Item        Description
  ---------        -----------
  Preferences...   Open the Preferences dialog (editor settings and project defaults).
  ---
  Debug Layout     Checkbox: toggle a debug overlay that shows widget layout boundaries. Useful for diagnosing widget layout issues.

Help Menu

Back to Overview

Help Menu

  Menu Item            Description
  ---------            -----------
  About DVX BASIC...   Show the About dialog with version and copyright information.

Back to Overview

Toolbar

The toolbar is organized into four groups separated by vertical dividers. Each button has a tooltip showing its name and keyboard shortcut.

File Group

  Button   Shortcut   Action
  ------   --------   ------
  Open     Ctrl+O     Add a file to the project (same as File > Add File).
  Save     Ctrl+S     Save the active file.

Run Group

  Button   Shortcut   Action
  ------   --------   ------
  Run      F5         Compile and run the program.
  Stop     Esc        Stop the running program.

Debug Group

  Button          Shortcut         Action
  ------          --------         ------
  Debug           Shift+F5         Start or resume a debug session.
  Step Into       F8               Step into the next statement.
  Step Over       Shift+F8         Step over the next statement.
  Step Out        Ctrl+Shift+F8    Step out of the current procedure.
  Run to Cursor   Ctrl+F8          Run to the cursor position.

View Group

  Button   Shortcut   Action
  ------   --------   ------
  Code     F7         Switch to Code view.
  Design   Shift+F7   Switch to Design view.

Back to Overview

Code Editor

The Code Editor is the primary editing window for BASIC source code. It occupies the center of the screen, below the toolbar and above the Output and Immediate windows.

Object and Function Dropdowns

At the top of the Code Editor are two dropdown lists:

Function -- lists all event handlers (procedures) for the selected object. Implemented handlers are listed first (plain text); unimplemented handlers follow in brackets (e.g., [Click]). Selecting an unimplemented event creates a new event handler stub.

The editor shows one procedure at a time. Each procedure has its own buffer, and switching between them is instantaneous. The (General) section contains module-level declarations and code.

Syntax Highlighting

The editor applies real-time syntax coloring as you type. The following categories are highlighted in distinct colors:

  Category          Examples
  --------          --------
  Keywords          IF, THEN, FOR, NEXT, SUB, FUNCTION, DIM, PRINT, SELECT, CASE, DO, LOOP, WHILE, WEND, END, EXIT, CALL, GOSUB, GOTO, RETURN, DECLARE, CONST, TYPE, AND, OR, NOT, XOR, MOD, etc.
  Type names        INTEGER, LONG, SINGLE, DOUBLE, STRING, BOOLEAN, BYTE, TRUE, FALSE
  String literals   "Hello, World!"
  Comments          ' This is a comment, REM This is a comment
  Numbers           42, 3.14
  Operators         =, <, >, +, -, *, /, \, &

Editor Features

Line decorations -- breakpoint lines show a red dot in the gutter. The current debug line (when paused) is highlighted with a yellow background.

Back to Overview

Form Designer

The Form Designer provides a visual design surface for editing .frm files. Switch to it with Shift+F7 or the Design toolbar button. It opens in a separate window showing a WYSIWYG preview of the form.

Design Surface

Delete key -- removes the selected control from the form.

Form Properties

Forms have the following design-time properties: Name, Caption, Width, Height, Left, Top, Layout (VBox or HBox), Centered, AutoSize, and Resizable.

Properties Panel

Toolbox

Back to Overview

Project System

Project Files (.dbp)

A DVX BASIC project is stored as a .dbp file (DVX BASIC Project). The project file records:

File list -- relative paths (8.3 DOS names) of all .bas and .frm files in the project. Each entry tracks whether it is a form file.

Source Map

When the project is compiled, all files are concatenated into a single source stream. A source map tracks which lines belong to which file, enabling accurate error reporting and debugger navigation across multiple files. For .frm files, an injected BEGINFORM directive is prepended to the code section.

Project Operations

  Operation             Description
  ---------             -----------
  New Project           Creates a blank project with a name and directory. A default .frm file is added automatically.
  Open Project          Opens a .dbp file and loads all referenced files into memory.
  Save Project          Writes the .dbp file to disk.
  Close Project         Closes the project, prompting to save unsaved changes.
  Add File              Adds a .bas or .frm file to the project. Opening a file without a project auto-creates an implicit project.
  Remove File           Removes a file from the project (prompts to save if modified).
  Project Properties    Opens a dialog for editing project metadata (name, author, company, version, copyright, description, icon, startup form).

Project Explorer

The Project Explorer is a tree view window listing all project files. Double-click a file to open it: .bas files open in Code view, .frm files open in Design view. The selected file in the Project Explorer determines the target for View > Code and View > Designer commands.

Back to Overview

Properties Panel

The Properties panel (Window > Properties) has two sections:

Property list -- a two-column ListView below the tree showing property names and values for the selected control. Double-click a property value to edit it via an InputBox dialog. Changes take effect immediately in the designer preview.

Each control type exposes different properties (e.g., Caption, Text, Width, Height, MaxWidth, MaxHeight, Weight, Alignment, Enabled, Visible, and type-specific properties like DataSource and DataField for data-bound controls).

Form Designer

Back to Overview

Toolbox

The Toolbox (Window > Toolbox) is a floating palette of buttons, one for each available control type. Controls are loaded dynamically from the widget plugin registry -- any widget DXE that provides a basName appears in the toolbox.

Click a tool to select it (the active tool name is stored in the designer state), then click on the form to place a new instance. Click the same tool again to deselect it and return to pointer mode.

Available Controls

  VB Name         Description
  -------         -----------
  CommandButton   Push button that triggers a Click event.
  Label           Static text label.
  TextBox         Single-line text input field.
  TextArea        Multi-line text editor.
  CheckBox        On/off checkbox.
  OptionButton    Radio button (mutually exclusive within a group).
  ListBox         Scrollable list of items.
  ComboBox        Drop-down combo box.
  DropDown        Simple drop-down list.
  PictureBox      Canvas for drawing and images.
  Image           Static image display.
  ImageButton     Clickable image button.
  Frame           Grouping container with a labeled border.
  VBox            Vertical layout container.
  HBox            Horizontal layout container.
  WrapBox         Flow layout container that wraps items to the next row.
  Splitter        Resizable split between two child panes.
  ScrollPane      Scrollable container for large content.
  TabStrip        Tabbed container with multiple pages.
  ListView        Multi-column list with headers.
  TreeView        Hierarchical tree control.
  ProgressBar     Progress indicator bar.
  HScrollBar      Horizontal slider/scrollbar.
  SpinButton      Numeric up/down spinner.
  Line            Horizontal or vertical separator line.
  Spacer          Invisible spacing element for layout.
  Timer           Non-visual timer that fires periodic events.
  Toolbar         Toolbar container for buttons.
  StatusBar       Status bar at the bottom of a form.
  Terminal        ANSI terminal emulator control.
  Data            Data control for binding to a database.
  DBGrid          Data-bound grid for displaying database query results.

Form Designer

Back to Overview

Debugger

The DVX BASIC IDE includes a full interactive debugger. The debugger operates as a state machine with three states:

  State          Description
  -----          -----------
  DBG_IDLE       No program loaded or running.
  DBG_RUNNING    Program is executing (VM running in slices).
  DBG_PAUSED     Execution is paused at a breakpoint or step point. The IDE GUI is fully interactive.

Starting a Debug Session

F5 (Run) -- compiles and runs without the debugger. No breakpoints are active. If already paused, resumes execution with debugging disabled.

Breakpoints

Setting Breakpoints

Click in the line number gutter to toggle a breakpoint on that line.

Breakpoint Validation

Not every line can have a breakpoint. The IDE validates the line content and silently refuses to set breakpoints on:

END SUB and END FUNCTION lines

Breakpoint Storage

Each breakpoint records the project file index, the code line number within the file, the procedure index, and the procedure name (as Object.Event). When the project is compiled, breakpoints are converted to concatenated source line numbers that match the VM's OP_LINE opcodes.

Visual Indicators

The current debug line (when paused) has a yellow background.

Breakpoint Adjustment on Edit

When lines are added or removed in the editor, breakpoints below the edit point are automatically shifted to stay on the correct line.

Stepping

  Action          Shortcut         Behavior
  ------          --------         --------
  Step Into       F8               Execute one statement. If the statement is a SUB/FUNCTION call, step into it.
  Step Over       Shift+F8         Execute one statement. If the statement is a SUB/FUNCTION call, execute the entire call and break at the next line in the current scope.
  Step Out        Ctrl+Shift+F8    Run until the current SUB/FUNCTION returns to its caller.
  Run to Cursor   Ctrl+F8          Run until execution reaches the line under the cursor.

The Debug Run Loop

When a program is running in debug mode, the IDE enters a cooperative loop:

When the user resumes (F5/Shift+F5/F8/etc.), the state transitions back to DBG_RUNNING and the loop continues.

Stopping

Press Esc or click the Stop toolbar button at any time to halt execution. The VM is destroyed, debug state resets to DBG_IDLE, and the IDE restores the designer windows that were hidden at run start.

Locals Window

Call Stack Window

Watch Window

Breakpoints Window

Back to Overview

Locals Window

When the debugger pauses, the Locals and Call Stack windows are auto-opened (if not already visible). The Watch and Breakpoints windows can be opened manually from the Window menu.

Shows variables for the current execution scope. Displayed as a three-column ListView:

  Column   Content
  ------   -------
  Name     Variable name (internal mangled names like static variable placeholders are filtered out).
  Type     Data type: Integer, Long, Single, Double, String, Boolean, Array, UDT. Array types show the element type (e.g., Integer()).
  Value    Current value. Strings are shown in quotes. Booleans as True/False. Arrays show bounds and element count (e.g., Integer(0 To 9) [10]). Uninitialized arrays show (uninitialized).

The Locals window displays:

Form-scoped variables for the current form (if the program is executing within a form context).

Up to 64 variables are displayed. The window is resizable.

Call Stack Window

Back to Overview

Call Stack Window

Shows the current call chain as a two-column ListView:

  Column      Content
  ------      -------
  Procedure   Procedure name (or (module) for module-level code).
  Line        Line number where execution is paused (shown for the topmost frame).

The current location is shown first, followed by each caller in the call stack (walking from the deepest frame back to the module entry point). Up to 32 frames are displayed.

Watch Window

Back to Overview

Watch Window

Allows monitoring arbitrary expressions while debugging. The window has a text input at the top and a two-column ListView below:

  Column       Content
  ------       -------
  Expression   The watch expression text.
  Value        Evaluated result (or <error> if evaluation fails). Blank when not paused.

Adding Watch Expressions

Type an expression in the text input and press Enter. Up to 16 watch expressions can be active at once.

Watch Expression Syntax

Watch expressions support:

Arbitrary BASIC expressions (compiled and evaluated against the paused VM's state): x + y * 2, Len(name$)

Editing and Deleting

Press Delete to remove the selected watch expression.

Breakpoints Window

Back to Overview

Breakpoints Window

Lists all set breakpoints as a three-column ListView:

  Column      Content
  ------      -------
  File        Project file path.
  Procedure   Procedure name (Object.Event format, or (General)).
  Line        Code line number within the file.

Press Delete to remove selected breakpoints (multi-select is supported).

Debugger

Back to Overview

Immediate Window

The Immediate window is an interactive REPL at the bottom-right of the screen. Type a line of BASIC and press Enter to evaluate it. Results appear inline below your input.

Expression Evaluation

If the input is not a recognized statement keyword, it is automatically wrapped in a PRINT statement. For example, typing 2 + 2 evaluates as PRINT 2 + 2 and displays 4.

You can also type full statements:

LET x = 42 -- explicit assignment (see below).

Parse or runtime errors are displayed inline with an Error: prefix.

Inspecting Variables While Paused

When the debugger is paused at a breakpoint, the Immediate window has access to the running VM's state. Global variable values are copied into the evaluation VM, so expressions like count or name$ & " test" display live values.

Assigning Variables While Paused

When paused, you can modify variables in the running program directly from the Immediate window using assignment syntax:

variableName = newValue

The optional LET keyword is also accepted:

LET variableName = newValue

Assignment works for:

Combined -- items(0).price = 9.99

The new value is written directly into the VM's live variable slot (local, global, or form scope). A confirmation message is displayed, and the Locals and Watch windows update automatically to reflect the change.

If the assignment target cannot be resolved (unknown variable, out-of-bounds index, wrong type), an error message is displayed.

Back to Overview

Output Window

The Output window is a read-only TextArea at the bottom-left of the screen. It displays:

Compile errors -- if compilation fails, the error message and location are shown.

The output buffer holds up to 32,768 characters. Use Run > Clear Output to clear it.

INPUT statements prompt the user via a modal InputBox dialog; the prompt text is also echoed to the Output window.

Back to Overview

Find / Replace

Open with Ctrl+F (Find) or Ctrl+H (Replace). The Find/Replace dialog is modeless -- it stays open while you continue editing.

Dialog Controls

  Control                    Description
  -------                    -----------
  Find input                 The text to search for.
  Replace checkbox + input   Enable replacement mode and enter replacement text.
  Scope                      Radio group: Function, Object, File, or Project. Default is Project.
  Direction                  Radio group: Forward or Backward.
  Match Case                 Checkbox: case-sensitive search.

Buttons

  Button        Action
  ------        ------
  Find Next     Find the next occurrence. Wraps across procedures, files, and the entire project depending on the scope setting.
  Replace       Replace the current match and find the next one.
  Replace All   Replace all occurrences within the selected scope.
  Close         Close the dialog.

Keyboard Shortcut

F3 repeats the last search (Find Next) without opening the dialog.

Back to Overview

Preferences

Open via Tools > Preferences. Settings are saved to dvxbasic.ini in the app's config directory.

Editor Section

  Setting                                      Description                                                                               Default
  -------                                      -----------                                                                               -------
  Skip comments/strings when renaming          When renaming a control or form, skip occurrences inside comments and string literals.     On
  Require variable declaration (OPTION EXPLICIT)   When enabled, variables must be declared with DIM before use.                          Off
  Tab width                                    Number of spaces per tab stop (1-8).                                                      3
  Insert spaces instead of tabs                When enabled, pressing Tab inserts spaces. When disabled, inserts a real tab character.     On

New Project Defaults Section

These fields set the default values for new project metadata:

  Field         Description                              Default
  -----         -----------                              -------
  Author        Default author name.                     (empty)
  Company       Default company name.                    (empty)
  Version       Default version string.                  1.0
  Copyright     Default copyright notice.                (empty)
  Description   Default project description (multi-line).   (empty)

Back to Overview

Keyboard Shortcuts

  Shortcut         Action
  --------         ------
  Ctrl+O           Add File
  Ctrl+S           Save File
  Ctrl+A           Select All
  Ctrl+X           Cut
  Ctrl+C           Copy
  Ctrl+V           Paste
  Ctrl+F           Find
  Ctrl+H           Replace
  Ctrl+E           Menu Editor
  F3               Find Next
  F5               Run
  Shift+F5         Debug
  Ctrl+F5          Run Without Recompile
  Esc              Stop
  F7               Code View
  Shift+F7         Design View
  F8               Step Into
  Shift+F8         Step Over
  Ctrl+Shift+F8    Step Out
  Ctrl+F8          Run to Cursor
  F9               Toggle Breakpoint
  Del              Delete

DVX BASIC 1.0 -- Copyright 2026 Scott Duensing

Data Types

DVX BASIC supports the following data types. Each type has a corresponding type suffix character that can be appended to variable names.

Primary Types

  Type       Size       Suffix   Range / Description
  ----       ----       ------   -------------------
  Integer    2 bytes    %        -32768 to 32767
  Long       4 bytes    &        -2147483648 to 2147483647
  Single     4 bytes    !        32-bit float, approximately 7 digits precision
  Double     8 bytes    #        64-bit float, approximately 15 digits precision
  String     variable   $        Variable-length, reference-counted, dynamic string
  Boolean    2 bytes    (none)   True (-1) or False (0)

Internal Types

These types are not directly declarable but are used internally by the runtime.

  Internal Type   Description
  -------------   -----------
  Array           Reference-counted multi-dimensional array (up to 8 dimensions)
  UDT             User-defined type instance (created with TYPE...END TYPE)
  Object          Opaque host object (form reference, control reference)
  Ref             ByRef pointer to a variable slot (used for ByRef parameters)

Type Suffixes

Type suffixes can be appended to variable names to declare their type implicitly:

count%  = 42         ' Integer
total&  = 100000     ' Long
rate!   = 3.14       ' Single
pi#     = 3.14159265 ' Double
name$   = "Hello"    ' String

Numeric Literals

  Form               Example          Description
  ----               -------          -----------
  Decimal integer    42               Values -32768..32767 are Integer; larger are Long
  Hex integer        &HFF             Hexadecimal literal
  Long suffix        42&, &HFF&       Force Long type
  Floating-point     3.14, 1.5E10     Double by default
  Single suffix      3.14!            Force Single type
  Double suffix      3.14#            Force Double type

Type Promotion

When mixing types in expressions, values are automatically promoted to a common type: Integer -> Long -> Single -> Double. Strings are not automatically converted to numbers (use VAL and STR$).

See also: Conversion Functions

Operators

Operators listed from highest precedence (evaluated first) to lowest precedence (evaluated last).

  Precedence     Operator                  Description
  ----------     --------                  -----------
  1 (highest)    ^                         Exponentiation
  2              - (unary)                 Negation
  3              *  /  \  MOD              Multiply, float div, integer div, modulus
  4              +  -                      Addition, subtraction
  5              &                         String concatenation
  6              =  <>  <  >  <=  >=       Comparison (returns Boolean)
  7              NOT                       Logical/bitwise NOT
  8              AND                       Logical/bitwise AND
  9              XOR                       Logical/bitwise XOR
  10             OR                        Logical/bitwise OR
  11             EQV                       Logical/bitwise equivalence
  12 (lowest)    IMP                       Logical/bitwise implication

String Concatenation

Use & to concatenate strings. The + operator also concatenates when both operands are strings.

result$ = "Hello" & " " & "World"
result$ = firstName$ & " " & lastName$

Statements

Multiple statements can appear on one line separated by :. Lines can be continued with _ at the end. Comments start with ' or REM.

Declaration Statements (DIM, REDIM, CONST, TYPE)

Conditional Statements (IF, SELECT CASE)

Loop Statements (FOR, DO, WHILE)

Procedures (SUB, FUNCTION, DEF FN)

Flow Control (EXIT, CALL, GOTO, GOSUB, ON)

Input/Output (PRINT, INPUT, DATA/READ)

Miscellaneous Statements

Declaration Statements

DIM

Declares variables and arrays with an explicit type.

DIM variable AS type
DIM variable(upperBound) AS type
DIM variable(lower TO upper) AS type
DIM variable(dim1, dim2, ...) AS type
DIM variable AS UdtName
DIM variable AS STRING * n
DIM SHARED variable AS type

Examples:

Dim name As String
Dim count As Integer
Dim values(100) As Double
Dim matrix(1 To 10, 1 To 10) As Single
Dim Shared globalFlag As Boolean
Dim record As PersonType
Dim fixedStr As String * 20
Note: DIM SHARED makes a variable accessible from all procedures without passing it as a parameter.

REDIM

Reallocates a dynamic array, optionally preserving existing data.

REDIM array(newBounds) AS type
REDIM PRESERVE array(newBounds) AS type
ReDim items(newSize) As String
ReDim Preserve scores(1 To newCount) As Integer

CONST

Declares a named constant. The value must be a literal (integer, float, string, or boolean).

CONST name = value
Const MAX_SIZE = 100
Const PI = 3.14159265
Const APP_NAME = "DVX App"
Const DEBUG_MODE = True

TYPE...END TYPE

Defines a user-defined type (record/structure).

TYPE TypeName
    fieldName AS type
    ...
END TYPE
Type PersonType
    firstName As String
    lastName  As String
    age       As Integer
End Type

Dim p As PersonType
p.firstName = "Scott"
p.age = 30

UDT fields can themselves be UDTs (nested types).

DECLARE

Forward-declares a SUB or FUNCTION. Required when a procedure is called before it is defined.

DECLARE SUB name ([BYVAL] param AS type, ...)
DECLARE FUNCTION name ([BYVAL] param AS type, ...) AS returnType

DECLARE LIBRARY

Declares external native functions from a dynamically loaded library. This allows BASIC programs to call functions exported by DXE libraries.

DECLARE LIBRARY "libraryName"
    DECLARE SUB name ([BYVAL] param AS type, ...)
    DECLARE FUNCTION name ([BYVAL] param AS type, ...) AS returnType
END DECLARE
Declare Library "rs232"
    Declare Function ComOpen(ByVal port As Integer) As Integer
    Declare Sub ComClose(ByVal port As Integer)
    Declare Sub ComSend(ByVal port As Integer, ByVal data$ As String)
End Declare

STATIC

Declares a local variable that retains its value between calls.

STATIC variable AS type
Sub Counter()
    Static count As Integer
    count = count + 1
    Print count
End Sub

OPTION

Sets compiler options. Must appear before any executable code.

OPTION BASE 0          ' Arrays start at index 0 (default)
OPTION BASE 1          ' Arrays start at index 1
OPTION COMPARE BINARY  ' Case-sensitive string comparisons (default)
OPTION COMPARE TEXT    ' Case-insensitive string comparisons
OPTION EXPLICIT        ' All variables must be declared with DIM

DEFtype Statements

Set the default type for variables based on their first letter.

DEFINT letterRange
DEFLNG letterRange
DEFSNG letterRange
DEFDBL letterRange
DEFSTR letterRange
DefInt I-N     ' Variables starting with I through N default to Integer
DefStr S       ' Variables starting with S default to String

Assignment

Assigns a value to a variable, array element, or UDT field.

variable = expression
array(index) = expression
udt.field = expression
LET variable = expression

The LET keyword is optional and supported for compatibility.

SWAP

Exchanges the values of two variables.

SWAP variable1, variable2
Swap a, b

ERASE

Frees the memory of an array and resets it.

ERASE arrayName

Conditional Statements

IF...THEN...ELSE...END IF

Conditional execution. Supports single-line and multi-line forms.

Single-line form

IF condition THEN statement
IF condition THEN statement ELSE statement

Multi-line form

IF condition THEN
    statements
ELSEIF condition THEN
    statements
ELSE
    statements
END IF
If x > 10 Then
    Print "Large"
ElseIf x > 5 Then
    Print "Medium"
Else
    Print "Small"
End If

If ready Then Print "Go!"

SELECT CASE

Multi-way branch based on an expression value.

SELECT CASE expression
    CASE value
        statements
    CASE value1, value2
        statements
    CASE low TO high
        statements
    CASE IS operator value
        statements
    CASE ELSE
        statements
END SELECT
Select Case grade
    Case 90 To 100
        Print "A"
    Case 80 To 89
        Print "B"
    Case Is >= 70
        Print "C"
    Case 60, 65
        Print "D (borderline)"
    Case Else
        Print "F"
End Select

CASE items can be combined with commas. The IS keyword allows comparison operators: <, >, <=, >=, =, <>.

Loop Statements

FOR...NEXT

Counted loop with an optional step value.

FOR variable = start TO limit [STEP step]
    statements
NEXT [variable]
For i = 1 To 10
    Print i
Next i

For x = 10 To 0 Step -2
    Print x
Next

The variable name after NEXT is optional. Use EXIT FOR to break out early.

DO...LOOP

General-purpose loop with pre-test, post-test, or infinite forms.

DO [WHILE condition | UNTIL condition]
    statements
LOOP [WHILE condition | UNTIL condition]
' Pre-test
Do While count < 10
    count = count + 1
Loop

' Post-test
Do
    line$ = ReadLine()
Loop Until line$ = "quit"

' Infinite loop (exit with EXIT DO)
Do
    DoEvents
    If done Then Exit Do
Loop

WHILE...WEND

Simple pre-test loop (legacy form; prefer DO...LOOP).

WHILE condition
    statements
WEND
While Not EOF(1)
    Line Input #1, line$
    Print line$
Wend

Procedures

SUB...END SUB

Defines a subroutine (no return value).

SUB name ([BYVAL] param AS type, ...)
    statements
END SUB
Sub Greet(ByVal name As String)
    Print "Hello, " & name
End Sub

Parameters are passed ByRef by default. Use ByVal for value semantics. Use EXIT SUB to return early.

FUNCTION...END FUNCTION

Defines a function with a return value.

FUNCTION name ([BYVAL] param AS type, ...) AS returnType
    statements
    name = returnValue
END FUNCTION
Function Square(ByVal n As Double) As Double
    Square = n * n
End Function

Assign to the function name to set the return value. Use EXIT FUNCTION to return early.

DEF FN

Defines a single-expression function.

DEF FNname(params) = expression
Def FnSquare(x) = x * x
Print FnSquare(5)     ' prints 25

Flow Control

EXIT

Exits the current block early.

EXIT FOR
EXIT DO
EXIT SUB
EXIT FUNCTION

CALL

Explicitly calls a subroutine or function. The return value (if any) is discarded.

CALL name
CALL name(args)

Normally you can omit CALL and just use the name directly.

GOTO / GOSUB / RETURN

GOTO label
GOSUB label
RETURN

GOSUB pushes the return address, executes code at the label, and RETURN jumps back. At module level, RETURN returns from a GOSUB. Inside a SUB/FUNCTION, RETURN returns from the procedure.

GoSub Initialize
Print "Done"
End

Initialize:
    count = 0
    name$ = ""
Return

ON...GOTO / ON...GOSUB

Computed branch based on an integer expression.

ON expression GOTO label1, label2, ...
ON expression GOSUB label1, label2, ...

If the expression evaluates to 1, control goes to the first label; 2, the second; and so on. If out of range, execution falls through.

Input/Output Statements

PRINT

Outputs text to the console or to a file channel.

PRINT [expression] [{; | ,} expression] ...
PRINT #channel, expression
PRINT USING format$; expression [; expression] ...

? is an alias for PRINT

Special functions inside PRINT:

TAB(n) -- advance to column n

Print "Name:"; Tab(20); name$
Print Using "###.##"; total
Print #1, "Written to file"

INPUT

Reads a line of text from the user or from a file channel.

INPUT variable
INPUT "prompt"; variable
INPUT #channel, variable
Input "Enter your name: "; name$
Input #1, line$

DATA / READ / RESTORE

Inline data pool for constants.

DATA value1, value2, "string", ...
READ variable1, variable2, ...
RESTORE

DATA statements define a pool of values. READ reads the next value from the pool into a variable. RESTORE resets the read pointer to the beginning.

Data 10, 20, 30, "Hello"
Read a, b, c, msg$
Print a; b; c; msg$
Restore

Miscellaneous Statements

Error Handling

ON ERROR GOTO label     ' Enable error handler
ON ERROR GOTO 0          ' Disable error handler
RESUME                   ' Retry the statement that caused the error
RESUME NEXT              ' Continue at the next statement after the error
ERROR n                  ' Raise a runtime error with error number n

The ERR keyword returns the current error number in expressions.

On Error GoTo ErrorHandler
Open "missing.txt" For Input As #1
Exit Sub

ErrorHandler:
    Print "Error number:"; Err
    Resume Next

SHELL

Executes an operating system command.

SHELL "command"

When used as a function, returns the exit code of the command.

Shell "DIR /B"
exitCode = Shell("COPY A.TXT B.TXT")

SLEEP

Pauses execution for a specified number of seconds.

SLEEP seconds

RANDOMIZE

Seeds the random number generator.

RANDOMIZE seed
RANDOMIZE TIMER          ' Seed from system clock

END

Terminates program execution immediately.

END

File I/O

OPEN

Opens a file for reading, writing, or appending.

OPEN filename$ FOR INPUT AS #channel
OPEN filename$ FOR OUTPUT AS #channel
OPEN filename$ FOR APPEND AS #channel
OPEN filename$ FOR RANDOM AS #channel [LEN = recordSize]
OPEN filename$ FOR BINARY AS #channel
  Mode      Description
  ----      -----------
  INPUT     Open for sequential reading. File must exist.
  OUTPUT    Open for sequential writing. Creates or truncates.
  APPEND    Open for sequential writing at end of file.
  RANDOM    Open for random-access record I/O.
  BINARY    Open for raw binary I/O.

CLOSE

Closes an open file channel.

CLOSE #channel

PRINT #

Writes text to a file.

PRINT #channel, expression

INPUT #

Reads comma-delimited data from a file.

INPUT #channel, variable

LINE INPUT #

Reads an entire line from a file into a string variable.

LINE INPUT #channel, variable$

WRITE #

Writes comma-delimited data to a file. Strings are enclosed in quotes, numbers are undecorated. Each statement writes a newline at the end.

WRITE #channel, expr1, expr2, ...
Write #1, "Scott", 42, 3.14
' Output: "Scott",42,3.14

GET / PUT

Read and write records in RANDOM or BINARY mode files.

GET #channel, [recordNum], variable
PUT #channel, [recordNum], variable

SEEK

Sets the file position. As a function, returns the current position.

SEEK #channel, position      ' Statement: set position
pos = SEEK(channel)           ' Function: get current position

String Functions

  Function                          Returns   Description
  --------                          -------   -----------
  ASC(s$)                           Integer   ASCII code of first character of s$
  CHR$(n)                           String    Character with ASCII code n
  FORMAT$(value, fmt$)              String    Formats a numeric value using format string
  HEX$(n)                           String    Hexadecimal representation of n
  INSTR(s$, find$)                  Integer   Position of find$ in s$ (1-based), 0 if not found
  INSTR(start, s$, find$)          Integer   Search starting at position start
  LCASE$(s$)                        String    Converts s$ to lowercase
  LEFT$(s$, n)                      String    Leftmost n characters of s$
  LEN(s$)                           Integer   Length of s$
  LTRIM$(s$)                        String    Removes leading spaces from s$
  MID$(s$, start [, length])        String    Substring from position start (1-based)
  RIGHT$(s$, n)                     String    Rightmost n characters of s$
  RTRIM$(s$)                        String    Removes trailing spaces from s$
  SPACE$(n)                         String    String of n spaces
  STR$(n)                           String    Converts number n to string
  STRING$(n, char)                  String    String of n copies of char
  TRIM$(s$)                         String    Removes leading and trailing spaces from s$
  UCASE$(s$)                        String    Converts s$ to uppercase
  VAL(s$)                           Double    Converts string s$ to a numeric value

MID$ Assignment

MID$ can also be used on the left side of an assignment to replace a portion of a string:

Mid$(s$, 3, 2) = "XY"    ' Replace 2 characters starting at position 3

Math Functions

  Function   Returns   Description
  --------   -------   -----------
  ABS(n)     Double    Absolute value of n
  ATN(n)     Double    Arctangent of n (in radians)
  COS(n)     Double    Cosine of n (radians)
  EXP(n)     Double    e raised to the power n
  FIX(n)     Integer   Truncates n toward zero (removes fractional part)
  INT(n)     Integer   Largest integer less than or equal to n (floor)
  LOG(n)     Double    Natural logarithm (base e) of n
  RND[(n)]   Double    Random number between 0 (inclusive) and 1 (exclusive)
  SGN(n)     Integer   Sign of n: -1, 0, or 1
  SIN(n)     Double    Sine of n (radians)
  SQR(n)     Double    Square root of n
  TAN(n)     Double    Tangent of n (radians)
  TIMER      Double    Number of seconds since midnight
Note: RND with a negative argument seeds and returns. RND(0) returns the previous value. Use RANDOMIZE to seed the generator.

Conversion Functions

  Function   Returns   Description
  --------   -------   -----------
  CDBL(n)    Double    Converts n to Double
  CINT(n)    Integer   Converts n to Integer (with banker's rounding)
  CLNG(n)    Long      Converts n to Long
  CSNG(n)    Single    Converts n to Single
  CSTR(n)    String    Converts n to its String representation

File I/O Functions

  Function                    Returns   Description
  --------                    -------   -----------
  EOF(channel)                Boolean   True if file pointer is at end of file
  FREEFILE                    Integer   Next available file channel number
  INPUT$(n, #channel)         String    Reads n characters from the file
  LOC(channel)                Long      Current read/write position in the file
  LOF(channel)                Long      Length of the file in bytes
  SEEK(channel)               Long      Current file position (function form)
  LBOUND(array [, dim])       Integer   Lower bound of an array dimension
  UBOUND(array [, dim])       Integer   Upper bound of an array dimension

Miscellaneous Functions

  Function          Returns   Description
  --------          -------   -----------
  DATE$             String    Current date as "MM-DD-YYYY"
  TIME$             String    Current time as "HH:MM:SS"
  ENVIRON$(name$)   String    Value of environment variable name$
  ERR               Integer   Current runtime error number (0 if no error)

Form and Control Statements

DVX BASIC supports Visual Basic-style forms and controls for building graphical user interfaces. Forms are defined in .frm files and loaded at runtime.

Loading and Unloading Forms

LOAD FormName
UNLOAD FormName

LOAD creates the form and its controls in memory. UNLOAD destroys the form and frees its resources.

Showing and Hiding Forms

FormName.Show [modal]
FormName.Hide
Me.Show [modal]
Me.Hide

Pass vbModal (1) to Show for a modal dialog.

Form2.Show vbModal
Me.Hide

Property Access

Read and write control properties using dot notation:

ControlName.Property = value
value = ControlName.Property
Text1.Text = "Hello"
label1.Caption = "Name: " & name$
x = Text1.Left

Method Calls

ControlName.Method [args]
List1.AddItem "New entry"
List1.Clear

Me Keyword

Me refers to the current form. Use it to access the form's own properties, controls, and methods from within event handlers.

Me.Caption = "Updated Title"
Me.Text1.Text = ""
Me.Hide

Control Arrays

Multiple controls can share a name with unique indices. Access individual controls with parenthesized indices:

Option1(0).Value = True
Label1(idx).Caption = "Item " & Str$(idx)
Me.Label1(i).Visible = True

DoEvents

Yields control to the DVX event loop, allowing the GUI to process pending events. Call this in long-running loops to keep the UI responsive.

DOEVENTS
For i = 1 To 10000
    ' process data
    If i Mod 100 = 0 Then DoEvents
Next

MsgBox

Displays a message box dialog. Can be used as a statement (discards result) or as a function (returns the button clicked).

MSGBOX message$ [, flags]
result = MSGBOX(message$ [, flags])
MsgBox "Operation complete"
answer = MsgBox("Continue?", vbYesNo + vbQuestion)
If answer = vbYes Then
    ' proceed
End If

InputBox$

Displays an input dialog and returns the user's text entry.

result$ = INPUTBOX$(prompt$ [, title$ [, default$]])
name$ = InputBox$("Enter your name:", "Name Entry", "")

Event Handler Convention

Event handlers are named ControlName_EventName and defined as SUBs:

Sub Command1_Click()
    MsgBox "Button clicked!"
End Sub

Sub Form_Load()
    Me.Caption = "My App"
End Sub

Sub Text1_Change()
    Label1.Caption = "You typed: " & Text1.Text
End Sub

Common Events

  Event          Description
  -----          -----------
  Click          Control was clicked
  DblClick       Control was double-clicked
  Change         Control value/text changed
  KeyPress       Key was pressed (receives key code)
  KeyDown        Key went down (receives key code and shift state)
  KeyUp          Key was released
  MouseDown      Mouse button pressed
  MouseUp        Mouse button released
  MouseMove      Mouse moved over control
  GotFocus       Control received input focus
  LostFocus      Control lost input focus
  Form_Load      Form is being loaded
  Form_Unload    Form is being unloaded
  Form_Resize    Form was resized
  Timer          Timer interval elapsed

SQL Functions

DVX BASIC includes built-in SQLite database support through a set of SQL functions. All functions use database handles and result set handles (integers) returned by SQLOpen and SQLQuery.

Opening and Closing Databases

SQLOpen

Opens a SQLite database file and returns a database handle.

db = SQLOPEN(path$)
db = SQLOpen(App.Data & "\mydata.db")

SQLClose

Closes an open database.

SQLCLOSE db

Executing SQL

SQLExec

Executes a SQL statement that does not return data (INSERT, UPDATE, DELETE, CREATE TABLE, etc.). Can be used as a statement or as a function returning a Boolean success flag.

SQLEXEC db, sql$
ok = SQLEXEC(db, sql$)
SQLExec db, "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)"
SQLExec db, "INSERT INTO users (name) VALUES ('Scott')"
ok = SQLExec(db, "DELETE FROM users WHERE id = 5")

SQLAffected

Returns the number of rows affected by the last INSERT, UPDATE, or DELETE.

count = SQLAFFECTED(db)

Querying Data

SQLQuery

Executes a SELECT query and returns a result set handle.

rs = SQLQUERY(db, sql$)
rs = SQLQuery(db, "SELECT id, name FROM users ORDER BY name")

SQLNext

Advances to the next row in the result set. Can be used as a statement or as a function returning True if a row is available.

SQLNEXT rs
hasRow = SQLNEXT(rs)

SQLEof

Returns True if there are no more rows in the result set.

done = SQLEOF(rs)

Reading Fields

SQLField$

Returns a field value as a string. The field can be specified by column index (0-based) or by column name.

value$ = SQLFIELD$(rs, columnIndex)
value$ = SQLFIELD$(rs, "columnName")
name$ = SQLField$(rs, "name")
first$ = SQLField$(rs, 0)

SQLFieldInt

Returns a field value as an integer.

value = SQLFIELDINT(rs, columnIndex)

SQLFieldDbl

Returns a field value as a double.

value# = SQLFIELDDBL(rs, columnIndex)

SQLFieldCount

Returns the number of columns in the result set.

count = SQLFIELDCOUNT(rs)

Result Set Cleanup

SQLFreeResult

Frees a result set. Always call this when done iterating a query.

SQLFREERESULT rs

Error Information

SQLError$

Returns the last error message for the database.

msg$ = SQLERROR$(db)

Complete SQL Example

Dim db As Long
Dim rs As Long

db = SQLOpen(App.Data & "\contacts.db")
SQLExec db, "CREATE TABLE IF NOT EXISTS contacts (name TEXT, phone TEXT)"
SQLExec db, "INSERT INTO contacts VALUES ('Alice', '555-1234')"

rs = SQLQuery(db, "SELECT name, phone FROM contacts")
Do While Not SQLEof(rs)
    SQLNext rs
    Print SQLField$(rs, "name"); Tab(20); SQLField$(rs, "phone")
Loop
SQLFreeResult rs
SQLClose db

App Object

The App object provides read-only properties for the application's directory paths.

  Property      Returns   Description
  --------      -------   -----------
  App.Path      String    Directory containing the application's executable
  App.Config    String    Directory for application configuration files
  App.Data      String    Directory for application data files (databases, etc.)
configFile$ = App.Config & "\settings.ini"
dbPath$ = App.Data & "\myapp.db"
Print "Running from: " & App.Path

INI Functions

DVX BASIC provides built-in functions for reading and writing standard INI configuration files.

IniRead

Reads a value from an INI file. Returns the default value if the key is not found.

value$ = INIREAD(file$, section$, key$, default$)
name$ = IniRead(App.Config & "\app.ini", "User", "Name", "Unknown")
fontSize = Val(IniRead(App.Config & "\app.ini", "Display", "FontSize", "12"))

IniWrite

Writes a value to an INI file. Creates the file, section, or key if they do not exist.

INIWRITE file$, section$, key$, value$
IniWrite App.Config & "\app.ini", "User", "Name", "Scott"
IniWrite App.Config & "\app.ini", "Display", "FontSize", Str$(fontSize)

Predefined Constants

The following constants are predefined by the compiler and available in all programs.

MsgBox Button Style Flags

  Constant        Value   Description
  --------        -----   -----------
  vbOKOnly        0       OK button only (default)
  vbOKCancel      1       OK and Cancel buttons
  vbYesNo         2       Yes and No buttons
  vbYesNoCancel   3       Yes, No, and Cancel buttons
  vbRetryCancel   4       Retry and Cancel buttons

MsgBox Icon Flags

Add an icon flag to the button style to display an icon in the message box.

  Constant        Value   Description
  --------        -----   -----------
  vbInformation   &H10    Information icon
  vbExclamation   &H20    Warning icon
  vbCritical      &H30    Error/critical icon
  vbQuestion      &H40    Question mark icon

MsgBox Return Values

  Constant   Value   Description
  --------   -----   -----------
  vbOK       1       User clicked OK
  vbCancel   2       User clicked Cancel
  vbYes      3       User clicked Yes
  vbNo       4       User clicked No
  vbRetry    5       User clicked Retry

Show Mode Flags

  Constant   Value   Description
  --------   -----   -----------
  vbModal    1       Show form as modal dialog

Boolean Constants

  Constant   Value   Description
  --------   -----   -----------
  True       -1      Boolean true
  False      0       Boolean false

Common Properties, Events, and Methods

Every control in DVX BASIC inherits a set of common properties, events, and methods. These are handled by the form runtime before dispatching to widget-specific interface descriptors.

Common Properties

  Property     Type      R/W   Description
  ----------   -------   ---   -------------------------------------------
  Name         String    R     The control's name (e.g. "Command1"). Read-only at runtime.
  Left         Integer   R/W   X position in pixels relative to the parent container.
  Top          Integer   R/W   Y position in pixels relative to the parent container.
  Width        Integer   R/W   Current width in pixels. Setting this changes the minimum width constraint.
  Height       Integer   R/W   Current height in pixels. Setting this changes the minimum height constraint.
  MinWidth     Integer   R/W   Minimum width for layout. Alias for Width in the setter.
  MinHeight    Integer   R/W   Minimum height for layout. Alias for Height in the setter.
  MaxWidth     Integer   R/W   Maximum width cap (0 = no limit, stretch to fill).
  MaxHeight    Integer   R/W   Maximum height cap (0 = no limit, stretch to fill).
  Weight       Integer   R/W   Layout weight. 0 = fixed size, >0 = share extra space proportionally.
  Visible      Boolean   R/W   Whether the control is visible.
  Enabled      Boolean   R/W   Whether the control accepts user input.
  BackColor    Long      R/W   Background color as a 32-bit ARGB value.
  ForeColor    Long      R/W   Foreground (text) color as a 32-bit ARGB value.
  TabIndex     Integer   R     Accepted for VB compatibility but ignored. DVX has no tab order.

Common Events

These events are wired on every control loaded from a .frm file. Controls created dynamically at runtime via code only receive Click, DblClick, Change, GotFocus, and LostFocus; the keyboard, mouse, and scroll events below require the control to be defined in the .frm file.

  Event       Parameters                                    Description
  ---------   -------------------------------------------   -------------------------------------------
  Click       (none)                                        Fires when the control is clicked.
  DblClick    (none)                                        Fires when the control is double-clicked.
  Change      (none)                                        Fires when the control's value or text changes.
  GotFocus    (none)                                        Fires when the control receives keyboard focus.
  LostFocus   (none)                                        Fires when the control loses keyboard focus.
  KeyPress    KeyAscii As Integer                           Fires when a printable key is pressed. KeyAscii is the ASCII code.
  KeyDown     KeyCode As Integer, Shift As Integer          Fires when any key is pressed down. KeyCode is the scan code; Shift indicates modifier keys.
  KeyUp       KeyCode As Integer, Shift As Integer          Fires when a key is released.
  MouseDown   Button As Integer, X As Integer, Y As Integer Fires when a mouse button is pressed over the control.
  MouseUp     Button As Integer, X As Integer, Y As Integer Fires when a mouse button is released over the control.
  MouseMove   Button As Integer, X As Integer, Y As Integer Fires when the mouse moves over the control.
  Scroll      Delta As Integer                              Fires when the control is scrolled (mouse wheel or scrollbar).

Common Methods

  Method     Parameters   Description
  --------   ----------   -------------------------------------------
  SetFocus   (none)       Gives keyboard focus to this control.
  Refresh    (none)       Forces the control to repaint.

Form

Data Binding

FRM File Format

Data Binding

DVX BASIC provides VB3-style data binding through three properties that can be set on most controls:

  Property     Set On        Description
  ----------   -----------   -------------------------------------------
  DataSource   Any control   Name of the Data control to bind to (e.g. "Data1").
  DataField    Any control   Column name from the Data control's recordset to display.

How It Works

When a bound control loses focus (LostFocus), its current text is written back to the Data control's record cache, and Update is called automatically to persist changes.

Master-Detail Binding

For hierarchical data (e.g. orders and order items), use two Data controls:

A detail Data control with its MasterSource set to the master's name, MasterField set to the key column in the master, and DetailField set to the foreign key column in the detail table.

When the master record changes, the detail Data control automatically re-queries using the master's current value for filtering. All controls bound to the detail are refreshed.

DBGrid Binding

Set the DBGrid's DataSource to a Data control name. The grid auto-populates columns from the query results and refreshes whenever the Data control refreshes.

Example

VERSION DVX 1.00
Begin Form frmData
    Caption      = "Data Binding Example"
    AutoSize     = False
    Width        = 400
    Height       = 280
    Begin Data Data1
        DatabaseName = "myapp.db"
        RecordSource = "customers"
    End
    Begin Label lblName
        Caption = "Name:"
    End
    Begin TextBox txtName
        DataSource = "Data1"
        DataField  = "name"
    End
    Begin Label lblEmail
        Caption = "Email:"
    End
    Begin TextBox txtEmail
        DataSource = "Data1"
        DataField  = "email"
    End
End

Sub Data1_Reposition ()
    Print "Current record changed"
End Sub

Sub Data1_Validate (Cancel As Integer)
    If txtName.Text = "" Then
        MsgBox "Name cannot be empty!"
        Cancel = 1
    End If
End Sub

Data

DBGrid

Menu System

Menus are defined in the .frm file using Begin Menu blocks. Each menu item has a name, caption, and nesting level. Menu items fire Click events dispatched as MenuName_Click.

FRM Syntax

Begin Form Form1
    Caption = "Menu Demo"

    Begin Menu mnuFile
        Caption = "&File"
        Begin Menu mnuOpen
            Caption = "&Open"
        End
        Begin Menu mnuSave
            Caption = "&Save"
        End
        Begin Menu mnuSep1
            Caption = "-"
        End
        Begin Menu mnuExit
            Caption = "E&xit"
        End
    End

    Begin Menu mnuEdit
        Caption = "&Edit"
        Begin Menu mnuCopy
            Caption = "&Copy"
        End
        Begin Menu mnuPaste
            Caption = "&Paste"
        End
    End
End

Menu Item Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Caption    String    The text displayed. Use & for accelerator key. Set to "-" for a separator.
  Checked    Boolean   Whether the menu item shows a checkmark.
  Enabled    Boolean   Whether the menu item is enabled (default True).

Nesting

Menu items are nested by placing Begin Menu blocks inside other Begin Menu blocks:

Level 2+: submenu items.

A level-0 menu that contains children becomes a top-level menu header. A non-level-0 menu that contains children becomes a submenu.

Event Dispatch

Each clickable menu item (not headers, not separators) receives a unique numeric ID at load time. When clicked, the form's onMenu handler maps the ID to the menu item's name and fires MenuName_Click.

Sub mnuOpen_Click ()
    MsgBox "Open was clicked"
End Sub

Sub mnuExit_Click ()
    Unload Form1
End Sub

Form

FRM File Format

Control Arrays

DVX BASIC supports VB-style control arrays. Multiple controls can share the same name, differentiated by an Index property. When an event fires on a control array element, the element's index is passed as the first parameter.

Defining Control Arrays in FRM

Begin CommandButton Command1
    Caption = "Button A"
    Index   = 0
End
Begin CommandButton Command1
    Caption = "Button B"
    Index   = 1
End
Begin CommandButton Command1
    Caption = "Button C"
    Index   = 2
End

Event Handler Convention

When a control has an Index property (>= 0), the event handler receives Index As Integer as the first parameter, before any event-specific parameters.

Sub Command1_Click (Index As Integer)
    Select Case Index
        Case 0
            MsgBox "Button A clicked"
        Case 1
            MsgBox "Button B clicked"
        Case 2
            MsgBox "Button C clicked"
    End Select
End Sub

Accessing Array Elements in Code

Use the indexed form ControlName(Index) to access a specific element:

Command1(0).Caption = "New Text"
Command1(1).Enabled = False
Note: Control array elements share the same event handler Sub. The runtime prepends the Index argument automatically. If you define parameters on the Sub, Index comes first, followed by the event's own parameters (e.g. KeyPress would be Sub Ctrl1_KeyPress (Index As Integer, KeyAscii As Integer)).

Common Properties, Events, and Methods

FRM File Format

FRM File Format

The .frm file is a text file that describes a form's layout, controls, menus, and code. It follows a format compatible with VB3 .frm files, with DVX-specific extensions.

Structure

VERSION DVX 1.00
Begin Form FormName
    form-level properties...

    Begin Menu mnuFile
        Caption = "&File"
        Begin Menu mnuOpen
            Caption = "&Open"
        End
    End

    Begin TypeName ControlName
        property = value
        ...
    End

    Begin Frame Frame1
        Caption = "Group"
        Begin TypeName ChildName
            ...
        End
    End
End

BASIC code follows...

Sub FormName_Load ()
    ...
End Sub

Rules

Blank lines are ignored in the form section.

Common FRM Properties

  Property                  Applies To        Description
  -----------------------   ---------------   -------------------------------------------
  Caption                   Form, controls    Display text or window title.
  Text                      TextBox, ComboBox Initial text content.
  MinWidth / Width          Controls          Minimum width. Both names are accepted.
  MinHeight / Height        Controls          Minimum height. Both names are accepted.
  MaxWidth                  Controls          Maximum width (0 = no cap).
  MaxHeight                 Controls          Maximum height (0 = no cap).
  Weight                    Controls          Layout weight for flexible sizing.
  Left                      Form, controls    X position (used by Form when Centered=False; informational for controls).
  Top                       Form, controls    Y position.
  Index                     Controls          Control array index (-1 or absent = not in array).
  Visible                   Controls          Initial visibility.
  Enabled                   Controls          Initial enabled state.
  Layout                    Form              "VBox" or "HBox".
  AutoSize                  Form              Auto-fit window to content.
  Resizable                 Form              Allow runtime resizing.
  Centered                  Form              Center window on screen.
  DatabaseName              Data              SQLite database file path.
  RecordSource              Data              Table name or SQL query.
  DataSource                Bound controls    Name of the Data control.
  DataField                 Bound controls    Column name in the recordset.

Form

Common Properties, Events, and Methods

Menu System

Control Arrays

Form

VB Equivalent: Form -- DVX Widget: Window + VBox/HBox root

The Form is the top-level container representing a DVX window. It is declared in the .frm file with Begin Form FormName. All controls are children of the form's content box, which uses either VBox (default) or HBox layout.

Form Properties

  Property    Type      Default          Description
  ----------  -------   --------------   -------------------------------------------
  Name        String    "Form1"          The form's name, used for event dispatch and Load statement.
  Caption     String    (same as Name)   Window title bar text.
  Width       Integer   400              Window width in pixels. Setting this disables AutoSize.
  Height      Integer   300              Window height in pixels. Setting this disables AutoSize.
  Left        Integer   0                Initial X position. Used when Centered is False.
  Top         Integer   0                Initial Y position. Used when Centered is False.
  Layout      String    "VBox"           Content box layout: "VBox" (vertical) or "HBox" (horizontal).
  AutoSize    Boolean   True             When True, the window shrink-wraps to fit its content.
  Resizable   Boolean   True             Whether the user can resize the window at runtime.
  Centered    Boolean   True             When True, the window is centered on screen. When False, Left/Top are used.

Form Events

  Event         Parameters              Description
  -----------   ---------------------   -------------------------------------------
  Load          (none)                  Fires after the form and all controls are created. This is the default event.
  Unload        (none)                  Fires when the form is being closed or unloaded.
  QueryUnload   Cancel As Integer       Fires before Unload. Set Cancel = 1 to abort the close.
  Resize        (none)                  Fires when the window is resized by the user.
  Activate      (none)                  Fires when the window gains focus.
  Deactivate    (none)                  Fires when the window loses focus.

Form Methods

  Statement           Description
  ------------------  -------------------------------------------
  Load FormName       Load the form (creates the window and controls, fires Load event).
  Unload FormName     Unload the form (fires Unload, destroys window).
  FormName.Show       Make the form visible.
  FormName.Show 1     Show as modal dialog (blocks until closed).
  FormName.Hide       Hide the form without unloading it.

Example

Sub Form_Load ()
    Form1.Caption = "Hello World"
    Print "Form loaded!"
End Sub

Sub Form_QueryUnload (Cancel As Integer)
    If MsgBox("Really quit?", 4) <> 6 Then
        Cancel = 1
    End If
End Sub

Sub Form_Resize ()
    Print "Window resized"
End Sub

Common Properties, Events, and Methods

FRM File Format

Terminal

DVX Extension -- DVX Widget: ansiterm (ANSI terminal emulator)

A VT100/ANSI terminal emulator widget. Supports ANSI escape sequences, scrollback buffer, and serial communication. Default size is 80 columns by 25 rows.

Type-Specific Properties

  Property     Type      Description
  ----------   -------   -------------------------------------------
  Cols         Integer   Number of character columns (read-only).
  Rows         Integer   Number of character rows (read-only).
  Scrollback   Integer   Number of scrollback lines (write-only).

Type-Specific Methods

  Method             Description
  ------             -----------
  Clear              Clear the terminal screen.
  Poll               Process pending comm data and update the display.
  Write text$        Write text (with ANSI escape processing) to the terminal.

No default event.

Serial Communication

Use the comm.bas library to connect a Terminal to a serial link:

Dim link As Integer
link = CommOpen(1, 115200)
CommHandshake link
CommAttach link, "Terminal1"

See comm.bas for the full communications API.

Common Properties, Events, and Methods

Frame

VB Equivalent: Frame -- DVX Widget: frame (titled VBox container)

A container with a titled border. Child controls are placed inside the frame using VBox layout. In the .frm file, nest Begin/End blocks inside the Frame block.

Type-Specific Properties

  Property   Type     Description
  --------   ------   -------------------------------------------
  Caption    String   The title displayed in the frame border.

Container: Yes

Default Event: Click

Example

Begin Frame Frame1
    Caption = "Options"
    Begin CheckBox Check1
        Caption = "Option A"
    End
    Begin CheckBox Check2
        Caption = "Option B"
    End
End

Common Properties, Events, and Methods

HBox

DVX Extension -- DVX Widget: hbox (horizontal layout container)

A container that arranges its children horizontally, left to right. Use Weight on children to distribute extra space.

Container: Yes

Default Event: Click

No type-specific properties.

Common Properties, Events, and Methods

VBox

VBox

DVX Extension -- DVX Widget: vbox (vertical layout container)

A container that arranges its children vertically, top to bottom. No title or border. Use Weight on children to distribute extra space.

Container: Yes

Default Event: Click

No type-specific properties.

Common Properties, Events, and Methods

HBox

CommandButton

VB Equivalent: CommandButton -- DVX Widget: button | Name Prefix: Command

A push button that triggers an action when clicked. Created with wgtButton(parent, text).

Type-Specific Properties

  Property   Type     Description
  --------   ------   -------------------------------------------
  Caption    String   The text displayed on the button. Use & for accelerator keys (e.g. "&OK").

No additional type-specific properties beyond common properties and Caption.

Default Event: Click

Example

Begin Form Form1
    Caption = "Button Demo"
    Begin CommandButton Command1
        Caption = "&Click Me!"
    End
End

Sub Command1_Click ()
    MsgBox "Button was clicked!"
End Sub

Common Properties, Events, and Methods

PictureBox

VB Equivalent: PictureBox -- DVX Widget: canvas | Name Prefix: Picture

A drawing surface (canvas). Supports drawing lines, rectangles, circles, text, and individual pixels. Can save and load BMP images. The default canvas size is 64x64 pixels.

Colors are specified as 0x00RRGGBB integers (e.g. &HFF0000 for red).

Type-Specific Methods

  Method                                        Description
  ------                                        -----------
  Clear color%                                  Fill the entire canvas with the specified color.
  DrawLine x0%, y0%, x1%, y1%, color%           Draw a line between two points.
  DrawRect x%, y%, w%, h%, color%               Draw a rectangle outline.
  DrawText x%, y%, text$                        Draw text at the given position.
  FillCircle cx%, cy%, radius%, color%          Draw a filled circle.
  FillRect x%, y%, w%, h%, color%               Draw a filled rectangle.
  GetPixel(x%, y%)                              Returns the color at a pixel.
  Load path$                                    Load a BMP image onto the canvas.
  Resize w%, h%                                 Resize the canvas to new dimensions.
  Save path$                                    Save the canvas as a BMP file.
  SetPenColor color%                            Set the drawing color for subsequent operations.
  SetPenSize size%                              Set the pen/brush size in pixels.
  SetPixel x%, y%, color%                       Set the color of a single pixel.

Default Event: Click

Example

Picture1.Resize 200, 150
Picture1.Clear &HFFFFFF
Picture1.SetPenSize 2
Picture1.DrawRect 10, 10, 180, 130, &H000000
Picture1.FillCircle 100, 75, 40, &HFF0000
Picture1.DrawText 60, 130, "Hello!"
Picture1.Save "output.bmp"

Common Properties, Events, and Methods

CheckBox

VB Equivalent: CheckBox -- DVX Widget: checkbox

A toggle control with a label. Checked state is exposed as a Boolean.

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Caption    String    The text displayed next to the checkbox.
  Value      Boolean   True if checked, False if unchecked.

Default Event: Click

Example

Begin CheckBox Check1
    Caption = "Enable feature"
End

Sub Check1_Click ()
    If Check1.Value Then
        Label1.Caption = "Feature ON"
    Else
        Label1.Caption = "Feature OFF"
    End If
End Sub

Common Properties, Events, and Methods

ComboBox

VB Equivalent: ComboBox -- DVX Widget: combobox (editable text field + drop-down list, max 256 chars)

A combination of a text input and a drop-down list. The user can type text or select from the list. Supports the same AddItem/RemoveItem/Clear/List methods as ListBox.

Type-Specific Properties

  Property    Type      Description
  ---------   -------   -------------------------------------------
  Text        String    The text in the editable field.
  ListIndex   Integer   Index of the currently selected list item (-1 = none).
  ListCount   Integer   Number of items in the drop-down list (read-only).

Type-Specific Methods

Same as ListBox: AddItem, RemoveItem, Clear, List.

See ListBox for details

Default Event: Click

Common Properties, Events, and Methods

Data

VB Equivalent: Data -- DVX Widget: data (database record navigator)

A data access control that connects to a SQLite database and provides record navigation. Other controls can bind to a Data control via their DataSource and DataField properties.

See Data Binding for details

Type-Specific Properties

  Property       Type      R/W   Description
  ------------   -------   ---   -------------------------------------------
  DatabaseName   String    R/W   Path to the SQLite database file.
  RecordSource   String    R/W   Table name or SQL SELECT query for the recordset.
  KeyColumn      String    R/W   Primary key column name (used for UPDATE/DELETE operations).
  Caption        String    R/W   Text displayed on the navigator bar.
  BOF            Boolean   R     True if the current position is before the first record (read-only).
  EOF            Boolean   R     True if the current position is past the last record (read-only).
  MasterSource   String    R/W   Name of a master Data control (for master-detail binding).
  MasterField    String    R/W   Column in the master recordset to filter by.
  DetailField    String    R/W   Column in this recordset that matches the master field.

Type-Specific Methods

  Method         Parameters   Description
  ------------   ----------   -------------------------------------------
  MoveFirst      (none)       Navigate to the first record.
  MoveLast       (none)       Navigate to the last record.
  MoveNext       (none)       Navigate to the next record.
  MovePrevious   (none)       Navigate to the previous record.
  AddNew         (none)       Add a new blank record.
  Delete         (none)       Delete the current record.
  Refresh        (none)       Re-query the database and reload records.
  Update         (none)       Write pending changes to the database.

Type-Specific Events

  Event        Parameters          Description
  ----------   -----------------   -------------------------------------------
  Reposition   (none)              Fires after the current record changes (navigation). This is the default event.
  Validate     Cancel As Integer   Fires before writing a record. Set Cancel = 1 to abort.

Common Properties, Events, and Methods

Data Binding

DBGrid

DBGrid

VB Equivalent: DBGrid -- DVX Widget: dbgrid

A data-bound grid that displays records from a Data control in a tabular format. Columns are auto-generated from the query results. Bind it using the DataSource property.

Type-Specific Properties

  Property     Type      Description
  ----------   -------   -------------------------------------------
  DataSource   String    Name of the Data control that supplies records.
  GridLines    Boolean   Show or hide grid lines between cells.

Type-Specific Methods

  Method    Parameters   Description
  -------   ----------   -------------------------------------------
  Refresh   (none)       Reload and redraw the grid from the Data control.

Type-Specific Events

  Event      Parameters   Description
  --------   ----------   -------------------------------------------
  Click      (none)       Fires when a cell is clicked.
  DblClick   (none)       Fires when a cell is double-clicked. This is the default event.

Common Properties, Events, and Methods

Data

Data Binding

DropDown

DVX Extension -- DVX Widget: dropdown (non-editable drop-down list)

A read-only drop-down list. Unlike ComboBox, the user cannot type free text; they can only select from the provided items. Supports AddItem/RemoveItem/Clear/List.

Type-Specific Properties

  Property    Type      Description
  ---------   -------   -------------------------------------------
  ListIndex   Integer   Index of the currently selected item.
  ListCount   Integer   Number of items (read-only).

Type-Specific Methods

Same as ListBox: AddItem, RemoveItem, Clear, List.

See ListBox for details

Default Event: Click

Common Properties, Events, and Methods

ImageButton

DVX Extension -- DVX Widget: imagebutton

A button that displays an image instead of text. Like Image, it requires pixel data at creation time and is typically loaded via the Picture property.

Type-Specific Properties

  Property      Type      Description
  -----------   -------   -------------------------------------------
  Picture       String    Path to a BMP file to load (write-only).
  ImageWidth    Integer   Width of the loaded image in pixels (read-only).
  ImageHeight   Integer   Height of the loaded image in pixels (read-only).

Default Event: Click

Common Properties, Events, and Methods

Image

VB Equivalent: Image -- DVX Widget: image

A static image display control. Loads BMP images from file. Cannot be placed via the designer toolbox (requires pixel data at creation time); typically created in code or loaded via the Picture property.

Type-Specific Properties

  Property      Type      Description
  -----------   -------   -------------------------------------------
  Picture       String    Path to a BMP file to load (write-only).
  ImageWidth    Integer   Width of the loaded image in pixels (read-only).
  ImageHeight   Integer   Height of the loaded image in pixels (read-only).

Default Event: Click

Common Properties, Events, and Methods

Label

VB Equivalent: Label -- DVX Widget: label

A static text label. Supports left, center, and right alignment.

Type-Specific Properties

  Property    Type   Description
  ---------   ----   -------------------------------------------
  Caption     String The text displayed by the label.
  Alignment   Enum   Text alignment: Left (default), Center, or Right.

Default Event: Click

Example

Begin Label Label1
    Caption   = "Hello, World!"
    Alignment = "Center"
End

Common Properties, Events, and Methods

ListBox

VB Equivalent: ListBox -- DVX Widget: listbox

A scrollable list of selectable items. Items are managed via methods (AddItem, RemoveItem, Clear). Supports single and multi-select modes.

Type-Specific Properties

  Property    Type      Description
  ---------   -------   -------------------------------------------
  ListIndex   Integer   Index of the currently selected item (-1 = no selection).
  ListCount   Integer   Number of items in the list (read-only).

Type-Specific Methods

  Method            Parameters                                Description
  ---------------   ---------------------------------------   -------------------------------------------
  AddItem           Text As String                            Add an item to the end of the list.
  RemoveItem        Index As Integer                          Remove the item at the given index.
  Clear             (none)                                    Remove all items from the list.
  List              Index As Integer                          Return the text of the item at the given index.
  SelectAll         (none)                                    Select all items (multi-select mode).
  ClearSelection    (none)                                    Deselect all items.
  SetMultiSelect    Multi As Boolean                          Enable or disable multi-select mode.
  SetReorderable    Reorderable As Boolean                    Enable or disable drag-to-reorder.
  IsItemSelected    Index As Integer                          Returns True if the item at Index is selected.
  SetItemSelected   Index As Integer, Selected As Boolean     Select or deselect a specific item.
  SetItems          Items As String                           Bulk-load items from a pipe-delimited string (e.g. "Red|Green|Blue").

Default Event: Click

Example

Sub Form_Load ()
    List1.AddItem "Apple"
    List1.AddItem "Banana"
    List1.AddItem "Cherry"
End Sub

Sub List1_Click ()
    Dim idx As Integer
    idx = List1.ListIndex
    If idx >= 0 Then
        Label1.Caption = "Selected: " & List1.List(idx)
    End If
End Sub

Common Properties, Events, and Methods

ComboBox

DropDown

ListView

VB Equivalent: ListView -- DVX Widget: listview

A multi-column list with column headers. Supports sorting, multi-select, and drag-to-reorder.

Type-Specific Properties

  Property    Type      R/W   Description
  ---------   -------   ---   -------------------------------------------
  ListIndex   Integer   R/W   Index of the currently selected row (-1 = none).

Type-Specific Methods

  Method                                        Description
  ------                                        -----------
  AddItem text$                                 Add a row (sets first column text).
  Clear                                         Remove all rows.
  ClearSelection                                Deselect all rows.
  GetCell$(row%, col%)                          Returns the text of a cell.
  IsItemSelected(index%)                        Returns True if the row is selected.
  RemoveItem index%                             Remove a row by index.
  RowCount()                                    Returns the number of rows.
  SelectAll                                     Select all rows.
  SetCell row%, col%, text$                     Set the text of a cell.
  SetColumns spec$                              Define columns. Pipe-delimited "Name,Width|Name,Width" (width in characters).
  SetItemSelected index%, selected              Select or deselect a row.
  SetMultiSelect multi                          Enable or disable multi-select.
  SetReorderable reorderable                    Enable or disable row reordering.
  SetSort col%, dir%                            Sort by column. dir: 0=none, 1=ascending, 2=descending.

Default Event: Click

Example

ListView1.SetColumns "Name,20|Size,10|Type,15"
ListView1.AddItem "readme.txt"
ListView1.SetCell 0, 1, "1024"
ListView1.SetCell 0, 2, "Text"
ListView1.SetSort 0, 1

Common Properties, Events, and Methods

ProgressBar

VB Equivalent: ProgressBar -- DVX Widget: progressbar

A horizontal progress indicator bar.

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Value      Integer   Current progress value (0-100).

No type-specific events or methods. No default event.

Common Properties, Events, and Methods

OptionButton

VB Equivalent: OptionButton -- DVX Widget: radio (radio group + radio button) | Name Prefix: Option

A radio button for mutually exclusive choices. DVX uses a radio group container; individual OptionButtons are children of the group. The Value property returns the button's index within its group.

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Caption    String    The text displayed next to the radio button.
  Value      Integer   The index of this radio button within its group (read-only).

Type-Specific Methods

  Method        Parameters          Description
  -----------   -----------------   -------------------------------------------
  SetSelected   Index As Integer    Select the radio button at the given index within the group.

Default Event: Click

Common Properties, Events, and Methods

ScrollPane

DVX Extension -- DVX Widget: scrollpane | Name Prefix: Scroll

A scrollable container. Place child controls inside and the ScrollPane automatically provides scrollbars when the content exceeds the visible area.

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  NoBorder   Boolean   When True, suppresses the border around the scroll pane.

Container: Yes

No default event.

Common Properties, Events, and Methods

Line

VB Equivalent: Line -- DVX Widget: separator

A visual separator line. The underlying widget supports both horizontal and vertical orientations. The default (via BASIC) is horizontal.

No type-specific properties, events, or methods.

Common Properties, Events, and Methods

HScrollBar

VB Equivalent: HScrollBar -- DVX Widget: slider | Name Prefix: HScroll

A horizontal slider/scrollbar control. The value ranges between a minimum and maximum set at creation time (default 0 to 100).

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Value      Integer   The current slider position (clamped to min/max range).

Default Event: Change

Example

Begin HScrollBar HScroll1
    MinWidth = 200
End

Sub HScroll1_Change ()
    Label1.Caption = "Value: " & Str$(HScroll1.Value)
End Sub

Common Properties, Events, and Methods

Spacer

DVX Extension -- DVX Widget: spacer

An invisible layout spacer. Takes up space in the layout without rendering anything. Useful for pushing controls apart. Give it a Weight to absorb extra space.

No type-specific properties, events, or methods.

Common Properties, Events, and Methods

SpinButton

DVX Extension -- DVX Widget: spinner | Name Prefix: Spin

A numeric input with up/down buttons. Supports integer mode (default) and real-number mode with configurable decimal places.

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Value      Integer   Current integer value (in integer mode).
  RealMode   Boolean   True to use floating-point mode; False for integer mode.
  Decimals   Integer   Number of decimal places shown in real mode.

Type-Specific Methods

  Method     Parameters                       Description
  --------   ------------------------------   -------------------------------------------
  SetRange   Min As Integer, Max As Integer   Set the allowed value range.
  SetStep    Step As Integer                  Set the increment per button click.

Default Event: Change

Common Properties, Events, and Methods

Splitter

DVX Extension -- DVX Widget: splitter

A resizable split pane. Holds exactly two child widgets separated by a draggable divider. Default orientation is vertical (top/bottom split).

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Position   Integer   Position of the divider in pixels from the top (or left).

Container: Yes

No default event.

Common Properties, Events, and Methods

StatusBar

VB Equivalent: StatusBar -- DVX Widget: statusbar

A horizontal container styled as a status bar, typically placed at the bottom of a form. At the C API level it accepts child widgets, but it is not registered as a container in the form runtime, so child controls cannot be nested inside it in .frm files. Set its Caption property to display status text.

No type-specific properties, events, or methods.

Common Properties, Events, and Methods

TabStrip

VB Equivalent: TabStrip -- DVX Widget: tabcontrol

A tabbed container. Each tab page is a separate container that holds child controls. Switching tabs shows one page and hides others.

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  TabIndex   Integer   Index of the active tab (0-based). Note: this property name collides with the common VB-compatibility TabIndex property, which shadows it at runtime. Use the SetActive method instead to switch tabs.

Type-Specific Methods

  Method                   Description
  ------                   -----------
  AddPage title$           Add a new tab page with the given title.
  GetActive()              Returns the index of the active tab.
  SetActive index%         Switch to the tab at the given index. This is the recommended way to change tabs at runtime (the TabIndex property is shadowed by the common property handler).

Container: Yes

Default Event: Click

Warning: The TabIndex property is shadowed by the common property handler at runtime. Use the SetActive method to change tabs programmatically.

Common Properties, Events, and Methods

TextBox

VB Equivalent: TextBox -- DVX Widget: textbox (single-line text input, max 256 chars)

A single-line text input field. Supports data binding via DataSource and DataField properties.

Type-Specific Properties

  Property     Type     Description
  ----------   ------   -------------------------------------------
  Text         String   The text content of the input field.
  DataSource   String   Name of a Data control for data binding.
  DataField    String   Column name for data binding.

Default Event: Change

Example

Begin TextBox Text1
    Text = "Enter text here"
End

Sub Text1_Change ()
    Label1.Caption = "You typed: " & Text1.Text
End Sub

Common Properties, Events, and Methods

Data Binding

TextArea

VB Equivalent: TextArea (DVX extension) -- DVX Widget: textarea (multi-line text input, max 4096 chars)

A multi-line text editing area. This is a DVX extension with no direct VB3 equivalent (VB uses a TextBox with MultiLine=True). Supports line numbers, auto-indent, find/replace, and tab configuration.

Type-Specific Properties

  Property     Type      R/W   Description
  ----------   -------   ---   -------------------------------------------
  Text         String    R/W   The full text content.
  CursorLine   Integer   R     Current cursor line number (0-based).

Type-Specific Methods

  Method                                          Description
  ------                                          -----------
  FindNext needle$, caseSensitive, forward        Search for text. Returns True if found.
  GetWordAtCursor()                               Returns the word under the cursor.
  GoToLine line%                                  Scroll to and position cursor at the given line.
  ReplaceAll needle$, replacement$, caseSensitive Replace all occurrences. Returns count of replacements.
  SetAutoIndent enabled                           Enable or disable automatic indentation.
  SetCaptureTabs enabled                          When True, Tab key inserts a tab/spaces instead of moving focus.
  SetShowLineNumbers show                         Show or hide the line number gutter.
  SetSyntaxMode mode$                             Activate built-in syntax highlighting. Modes: "dhs" (help source), "bas" (BASIC). Pass "" to disable.
  SetTabWidth width%                              Set the tab stop width in characters.
  SetUseTabChar useChar                           When True, Tab inserts a tab character; when False, inserts spaces.

Default Event: Change

Example

TextArea1.SetShowLineNumbers True
TextArea1.SetAutoIndent True
TextArea1.SetTabWidth 4
TextArea1.SetCaptureTabs True

' Search for text
If TextArea1.FindNext("TODO", False, True) Then
    Print "Found at line"; TextArea1.CursorLine
End If

' Replace all occurrences
Dim count As Integer
count = TextArea1.ReplaceAll("old", "new", False)
Print "Replaced"; count; "occurrences"

Common Properties, Events, and Methods

Timer

VB Equivalent: Timer -- DVX Widget: timer (non-visual)

A non-visual control that fires its event at a regular interval. The Timer widget is invisible at runtime -- it has no on-screen representation.

Type-Specific Properties

  Property   Type      Description
  --------   -------   -------------------------------------------
  Enabled    Boolean   True to start the timer, False to stop it.
  Interval   Integer   Timer interval in milliseconds (write-only from BASIC).

Type-Specific Methods

  Method   Parameters   Description
  ------   ----------   -------------------------------------------
  Start    (none)       Start the timer.
  Stop     (none)       Stop the timer.

Type-Specific Events

  Event   Parameters   Description
  -----   ----------   -------------------------------------------
  Timer   (none)       Fires each time the interval elapses. This is the default event.
Note: The Timer control fires the Timer event instead of Change. The onChange callback on the underlying widget is remapped automatically.

Example

Begin Timer Timer1
    Interval = 1000
    Enabled  = True
End

Dim counter As Integer

Sub Timer1_Timer ()
    counter = counter + 1
    Label1.Caption = "Ticks: " & Str$(counter)
End Sub

Common Properties, Events, and Methods

Toolbar

VB Equivalent: Toolbar -- DVX Widget: toolbar

A horizontal container styled as a toolbar, with compact padding and spacing. Place buttons, labels, or other controls inside.

Container: Yes

No type-specific properties, events, or methods.

Common Properties, Events, and Methods

TreeView

VB Equivalent: TreeView -- DVX Widget: treeview

A hierarchical tree of expandable/collapsible nodes. Supports multi-select and drag-to-reorder. Items are accessed by depth-first index (0-based).

Type-Specific Methods

  Method                                  Description
  ------                                  -----------
  AddChildItem parentIndex%, text$        Add a child node under the node at the given index.
  AddItem text$                           Add a root-level node.
  Clear                                   Remove all nodes.
  GetItemText$(index%)                    Returns the text of the node at the given index.
  IsExpanded(index%)                      Returns True if the node at the given index is expanded.
  IsItemSelected(index%)                  Returns True if the node at the given index is selected.
  ItemCount()                             Returns the total number of nodes (all levels).
  SetExpanded index%, expanded            Expand or collapse the node at the given index.
  SetItemSelected index%, selected        Select or deselect the node at the given index.
  SetMultiSelect multi                    Enable or disable multi-select mode.
  SetReorderable reorderable              Enable or disable node reordering.

Default Event: Click

Example

TreeView1.AddItem "Animals"
TreeView1.AddChildItem 0, "Cat"
TreeView1.AddChildItem 0, "Dog"
TreeView1.AddItem "Plants"
TreeView1.AddChildItem 3, "Oak"
TreeView1.SetExpanded 0, True
Print "Items:"; TreeView1.ItemCount()

Common Properties, Events, and Methods

WrapBox

DVX Extension -- DVX Widget: wrapbox

A container that arranges children in a flowing layout, wrapping to the next row when the available width is exceeded. Similar to CSS flexbox with flex-wrap: wrap.

Type-Specific Properties

  Property    Type   Description
  ---------   ----   -------------------------------------------
  Alignment   Enum   Horizontal alignment of items: Left, Center, or Right.

Container: Yes

Default Event: Click

Common Properties, Events, and Methods