Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
About The Best Formula In The World
Architecture details
Benchmarks
Books
By Reference Argument Passing
Compatibility between versions
Creating And Using Libraries
Database Datatype Mapping
Database Request Quoting
Date & time management
Dates and calendars
DBus and Gambas
Differences Between Shell And Exec
Differences From Visual Basic
Distributions & Operating Systems
Drag & Drop
DrawingArea Internal Behaviour
External functions datatype mapping
Frequently Asked Questions
Gambas Farm Server Protocol
Gambas Mailing List Netiquette
Gambas Markdown Syntax
Gambas Naming Conventions
Gambas Object Model
Gambas Scripting
Gambas Server Pages
Gambas Unit Testing
Gambas Wiki Markup Syntax
Getting Started With Gambas
Hall Of Fame
Image Management In Gambas
Including Help Comments in Source Code
Interpreter limits
Introduction
Just In Time Compiler
Just In Time Compiler (old version)
License
Localisation and Internationalization
Mailing Lists & Forums
Naming Conventions
Network Programming
ODBC Component Documentation
PCRE Pattern Syntax
Porting from Gambas 2 to Gambas 3
Previous News
Project Directory Structure
Release Notes
Reporting a problem, a bug or a crash
Rich Text Syntax
Screenshots
Text highlighting definition file syntax
The Program has stopped unexpectedly by raising signal #11
Variable Naming Convention
WebPage Syntax
Web site home page
What Is Gambas?
Window & Form Management
Window Activation & Deactivation
Window Life Cycle
XML APIs
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

Naming Conventions

The naming conventions are not required by the compiler. But programs which use the following naming conventions are easier to read by other programmers who want to understand the program.

Variable names

All private variable names of a class start with $

The first letter is lower case and should depend on the type of the variable:

Letter Type
a Array
b Boolean
c Collection
f Float
h Object (Handle)
i Integer, Long, Short, Byte.
n An integer storing a number of objects.
s String

Examples

PRIVATE $iLast AS Integer
PRIVATE $sLast AS String
PRIVATE $hEditor AS Object
PRIVATE $sOldVal AS String
PRIVATE $bFreeze AS Boolean

PUBLIC SUB Form_Resize()

  DIM iWidth AS Integer

Form element names

When placing a new form element. Gambas gives it a name like "Label1" "Label2" ...

Before you assign a method to the new element, you rename it to "btnStart" or "lstAddressSelect". The first two or three lower case letters should be given according to this definition:

Letter Type
btn Button, use btnOK btnCancel for OK, Cancel
chk CheckBox
cvw ColumnView
cmb ComboBox
dwg DrawingArea
dlg FontChooser
edt GambasEditor
frm Frame
grd GridView
spl HSplit
iv IconView
lbl Label
lbl TextLabel
lst ListBox
lvw ListView
pan Panel
img PictureBox
opt RadioButton
svw ScrollView
spb SpinBox
tab TabStrip
tim Timer
txa TextArea
txt TextBox
txv textview
tbt ToolButton
trv TreeView
spl VSplit

A project which uses this style is the Gambas IDE (under /app/src/gambas3 in the source tree). It contains lots of more prefixes for various controls.