Hubbry Logo
GambasGambasMain
Open search
Gambas
Community hub
Gambas
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Gambas
Gambas
from Wikipedia
Gambas
Gambas Logo
Gambas Logo
Gambas 3 Logo
Gambas 3 Logo
Gambas 2 Logo
Gambas 2 Logo
Gambas 3.3.4 running on Fedora 16 with Xfce
Designed byBenoît Minisini
First appeared1999; 26 years ago (1999)
Stable release
3.20.0 / January 10, 2025; 9 months ago (2025-01-10)[1]
OSLinux, FreeBSD; versions for
Mac OS X[2] and Haiku[3] drafted; Microsoft Windows through Cygwin and WSL
LicenseGNU GPLv2+
Websitegambaswiki.org/website
Influenced by
Visual Basic, Java[4]

Gambas is an object-oriented dialect of the BASIC programming language, and an integrated development environment that accompanies it.[5] Designed to run on Linux and other Unix-like computer operating systems,[6] its name is a recursive acronym for Gambas Almost Means BASIC. Gambas is also the word for prawns in the Spanish, French, and Portuguese languages, from which the project's logos are derived.

History

[edit]

Gambas was developed by the French programmer Benoît Minisini, with its first release coming in 1999. Benoît had grown up with the BASIC language, and decided to make a free software development environment that could quickly and easily make programs with user interfaces.[4]

The Gambas 1.x versions were first released on January 4, 2005,[7] and featured an interface made up of several different separate windows for forms and IDE dialogues in a similar fashion to the interface of earlier versions of the GIMP. It could also only develop applications using Qt and was more oriented towards the development of applications for KDE.[8] The last release of the 1.x versions was Gambas 1.0.19.

Gambas 2.7 with Russian interface

The first of the 2.x versions was released on January 2, 2008, after three to four years of development. It featured a major redesign of the interface, now with all forms and functions embedded in a single window, as well as some changes to the Gambas syntax, although for the most part code compatibility was kept. It featured major updates to existing Gambas components as well as the addition of some new ones, such as new components that could use GTK+ or SDL for drawing or utilize OpenGL acceleration. Gambas 2.x versions can load up and run Gambas 1.x projects, with occasional incompatibilities; the same is true for Gambas 2.x to 3.x, but not from Gambas 1.x to 3.x.

The next major iteration of Gambas, the 3.x versions, was released on December 31, 2011.[9] A 2015 benchmark published on the Gambas website showed Gambas 3.8.90 scripting as being faster to varying degrees than Perl 5.20.2 and the then-latest 2.7.10 version of Python in many tests.[10] Version 3.16.0 released on April 20, 2021, featured full support for Wayland using the graphical components, as well as parity between the Qt 5 and GTK 3 components.[11]

Features

[edit]
Gambas 2.7.0 running on Fedora Linux with Blackbox

Gambas is designed to build graphical programs using the Qt (currently Qt 4.x or 5.x since 3.8.0) or the GTK toolkit (GTK 3.x also supported as of 3.6.0); the Gambas IDE is written in Gambas.[12][13] Gambas includes a GUI designer to aid in creating user interfaces in an event-driven style,[14] but can also make command line applications,[15] as well as text-based user interfaces using the ncurses toolkit.[16] The Gambas runtime environment is needed to run executables.

Functionality is provided by a variety of components, each of which can be selected to provide additional features.[17] Drawing can be provided either through Qt and GTK toolkits, with an additional component which is designed to switch between them.[18] Drawing can also be provided through the Simple DirectMedia Layer (originally version 1.x, with 2.x added as of 3.7.0),[19] which can also be utilized for audio playback through a separate sound component (a component for the OpenAL specification has also been added). GPU acceleration support is available through an OpenGL component, as well as other hardware functionally provided by various other components.[18] There are also components for handling other specialized tasks.[17]

With Gambas, developers can also use databases such as MySQL or PostgreSQL, build KDE (Qt) and GNOME GTK applications with DCOP, translate Visual Basic programs to Gambas and run them under Linux, build network solutions, and create CGI web applications. The IDE also includes a tool for the creation of installation packages, supporting GNU Autotools, slackpkg, pacman, RPM, and debs (the latter two then tailored for specific distributions such as Fedora/RHEL/CentOS, Mageia, Mandriva, OpenSUSE and Debian, Ubuntu/Mint). Support for AppImage building was mainlined with version 3.19.0.

Gambas since version 3.2 IDE has integrated profiler and it started to use just-in-time compilation technology.

Differences from Visual Basic

[edit]

Gambas is intended to provide a similar experience as developing in Microsoft Visual Basic, but it is not a free software clone of the popular proprietary program.[20][21] The author of Gambas makes it clear that there are similarities to Visual Basic, such as syntax for BASIC programs and the integrated development environment; Gambas was written from the start to be a development environment of its own and seeks to improve on the formula.[22][23][24]

Its object model, each class being represented in a file, as well as the archiver to package the program is all inspired by the Java programming language.[25] Gambas is intended to be an alternative for former Visual Basic developers who have decided to migrate to Linux. There are also other important distinctions between Gambas and Visual Basic. One notable example is that in Gambas array indexes always start with 0, whereas Visual Basic indexes can start with 0 or 1.[26] Gambas also supports the += and -= shorthand not found in classic Visual Basic. Both of these are features of Visual Basic .NET however.

Gambas also outlived two other attempts at implementing a Visual Basic style interface for Qt and GTK on Linux,[27][28] those being HBasic[29][30] and GNOME Basic,[31][32] as well as the platform independent KBasic/Basic for Qt.[33][34] Similar style IDEs have since been developed as well for FreeBASIC, namely VisualFBEditor,[35] and QB64, namely InForm.[36]

Adoption

[edit]
DONKEY.GB

Several programs and many forms of example code have been written using and for Gambas. Freecode (formerly Freshmeat) listed 23 applications that were developed using Gambas,[37] while the Gambas wiki listed 82;[38] several other specialized sites list Gambas applications and code.[39][40][41]

A Gambas written application, named Gambas3 ShowCase, acted as a software center to download or install Gambas 3 applications.[42] It has since been discontinued following the launch of the first party Gambas Software Farm integrated into the IDE since 3.7.1, which contains nearly 500 applications and demos.[43][44] Several community sites, including community forums and mailing lists, also exist for Gambas.[45]

Notable applications written in Gambas include Xt7-player-mpv, a GUI frontend for mpv player contained in a number of Linux software repositories,[46][47][48] and I-Nex, a program for displaying hardware data.[49][50][51] The comisat Games Collection are early examples of video games written in Gambas.[52]

Availability

[edit]

Gambas is included in the repositories of a number of Linux distributions, such as Debian, Fedora, Slackware, Arch Linux, Mageia, PCLinuxOS, Linux Mint and Ubuntu.[53] A Microsoft Windows version of Gambas was run under the Cygwin environment, although this version was significantly less tested than its Linux counterparts and was command-line only; Cooperative Linux and derivatives have also been used,[54] as well as specialized Linux virtual machines.[55][56] An independent contributor, François Gallo, also worked on porting Gambas 3.x to Mac OS X and FreeBSD, based on using local versions of the X11 system.[57] A build for Haiku has also been worked on by Francois Revol.[58] Gambas from version 3.2 can run on Raspberry Pi, and offers just-in-time compilation there from version 3.12. It can also be run from the cloud using rollApp.[59]

In November 2013, the future portability of Gambas was discussed, listing the main concerns being Linux kernel features utilized in the interpreter, components using Linux specific software and libraries, and primarily X11-tying in the Qt, GTK and desktop integration components. However, partly due to the need to upgrade to newer toolkits such as GTK 3 (added as of 3.6.0) and Qt 5 (as of 3.8.0), future versions would be less X11 tied, making projects like Cygwin or utterly native versions on other platforms more possible. Benoît Minisini stated that he intended to "encapsulate" X11 specific code to aid in any attempt to replace it,[60] with the X11 support in the desktop component moved to its own component as of 3.6.0.

On October 27, 2016, a screenshot and setup guide was released from the main page for running Gambas fully through Cygwin, including most components, graphical toolkits, and the complete IDE.[61][62] The relevant patches were mainlined as of version 3.9.2.[63] This replaces the prior recommended method of using freenx forwarding from a Linux server.[64] It has also been successfully run using the Windows Subsystem for Linux.[65][66] This was usually done using an X terminal emulator such Mobaxterm on Windows,[67] as WSL did not support X11 graphics directly until Windows 11.[68]

Example code

[edit]

A "Hello, World!" program with graphical user interface.

Public Sub Main()
    Message("Hello, World!")
End

Program that computes a 100-term polynomial 500000 times, and repeats it ten times (used for benchmarking).

Private Sub Test(X As Float) As Float

    Dim Mu As Float = 10.0
    Dim Pu, Su As Float
    Dim I, J, N As Integer
    Dim aPoly As New Float[100]

    N = 500000

    For I = 0 To N - 1
        For J = 0 To 99
           Mu =  (Mu + 2.0) / 2.0
           aPoly[J] = Mu
        Next
        Su = 0.0
        For J = 0 To 99
            Su = X * Su + aPoly[J]
        Next
        Pu += Su
    Next

    Return Pu

End

Public Sub Main()

    Dim I as Integer

    For I = 1 To 10
        Print Test(0.2)
    Next

End

See also

[edit]

References

[edit]

Further reading

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Gambas is a free and open-source object-oriented dialect of the language, accompanied by an (IDE) that facilitates graphical application development, primarily for and other operating systems. Developed by French programmer Benoît Minisini since 1999, it draws inspiration from while incorporating modern object-oriented features like inheritance and polymorphism, and is released under the GNU General Public License. The name "Gambas" is a playful standing for "Gambas Almost Means BASIC," reflecting its roots in the accessible syntax of BASIC interpreters. The project began as an effort to create a Visual Basic-like tool for , with the first public release occurring in 2002 and version 1.0 in 2005; subsequent major versions include Gambas 3 (2012) and the current stable series, Gambas 3.21.0, released in late 2025. Gambas supports a compact with approximately 250-350 keywords and functions, enabling rapid development of desktop applications through its visual form editor, syntax-highlighted code editor, and built-in . Key components include a that processes code at high speeds (around 920,000 lines per second on modern hardware), an interpreter for runtime execution, and libraries for GUI toolkits such as Qt and , as well as database connectivity to systems like , , and . Notable features emphasize ease of use for beginners and power for advanced users, including full support, tools, process control, error management, and scripting capabilities, allowing applications to integrate seamlessly with desktop environments like , , and . Gambas programs can be packaged for distribution via formats compatible with , , and other repositories, and it extends to cross-platform potential through efforts for , , and even Windows via or WSL. With over 860 classes and 10,000 symbols in its , Gambas remains a lightweight yet versatile platform (interpreter size ~654 KB on 64-bit systems), actively maintained to support contemporary development needs in ecosystems.

Introduction

Overview

Gambas is an object-oriented of the language, accompanied by an (IDE) designed for . Developed by French Benoît Minisini, development of which began in 1999, with the first public release in 2002 as a free and open-source alternative inspired by , targeting graphical desktop applications on and other operating systems. The language compiles to for interpretation, enabling quick prototyping due to the fast compilation process (around 920,000 lines per second on modern hardware), while the IDE provides tools for visual design, debugging, and project management. Key characteristics of Gambas include its support for GTK+ and Qt toolkits, allowing developers to create cross-compatible graphical user interfaces. It features over 860 built-in classes and components that facilitate multimedia handling via SDL and , database interactions with systems like , , , and ODBC, as well as networking protocols including and . These elements promote with and polymorphism, all within a BASIC-like syntax for . As of November 2025, the current stable version is Gambas 3.21.0, which introduces enhancements such as optimized processing up to 20 times faster, improved just-in-time () compilation for better interpreter speed, and various bug fixes addressing memory issues and debugger stability. These updates refine the platform's performance and reliability for modern application development.

Etymology

The name Gambas serves as a for "Gambas Almost Means BASIC," underscoring its roots as an object-oriented of the BASIC programming language. This construction was devised by Benoît Minisini, the French developer who created the project in 1999, to playfully nod to its BASIC heritage while distinguishing it as a modern evolution. The term "gambas" also carries a linguistic , as it translates to "" or "" in Spanish, French, and . Minisini selected this name to infuse humor and whimsy, evoking the lightweight and approachable nature of seafood as a for the language's simplicity and ease of use. Through this etymological choice, Minisini aimed to position Gambas as a fun, accessible open-source alternative to proprietary tools like , emphasizing an inviting entry point for developers seeking straightforward programming on and systems.

History

Origins

Gambas was conceived by Benoît Minisini, a French from the suburbs of who had been passionate about programming since childhood, beginning with BASIC on computers like the and Atari 520 STE at age 12. Minisini's early experiences with BASIC shaped his affinity for simple, accessible languages, but by the late , he grew frustrated with the absence of a -like tool for , where rapid (GUI) development was cumbersome compared to Windows environments. The initial motivation for Gambas stemmed from Minisini's desire to create an open-source, Linux-native alternative to Visual Basic, enabling quick GUI application development without proprietary dependencies or the quirks of the original. He envisioned a complete development environment inspired by BASIC's ease but extended with object-oriented features, akin to or .NET, to meet his personal needs for visual and straightforward programming. As a solo project, Minisini began by sketching ideas on paper before implementing the core components in 1999, starting with a and a simple form designer to facilitate immediate GUI prototyping. The first release occurred in 2002. Early development posed significant challenges, as Minisini built everything from scratch to ensure independence from , initially focusing on the Qt toolkit for cross-platform GUI support while prioritizing coherence and reliability for users.

Version Timeline

Gambas achieved its first stable release with version 1.0 on January 10, 2005, marking a milestone in providing basic stability for creating graphical user interfaces and applications on systems. This version established the core interpreter and IDE framework, enabling developers to build Visual Basic-style programs with improved reliability over earlier prototypes. The release of Gambas 2.0 in early 2008 represented a significant advancement, with enhancements to capabilities and expanded component libraries that facilitated more complex application development. This version refined the language's syntax and integration with external libraries, broadening its appeal for desktop software creation. A pivotal shift occurred with Gambas 3.0 in January 2012, which underwent a major rewrite to boost performance through optimized bytecode interpretation and increased in its component architecture. This overhaul allowed for better extensibility and efficiency, laying the groundwork for subsequent iterative improvements in the 3.x series.
VersionRelease DateKey Developments
3.19.0February 16, 2024Interpreter optimizations for faster execution and reduced memory usage.
3.20.0Early 2025Enhancements to the development environment, including improved tools and updated packaging support.
3.21.0October 13, 2025Bug fixes across components, along with initial Qt6 support for modern GUI rendering.
Over the course of its evolution, Gambas transitioned from exclusive reliance on the Qt toolkit in early versions to dual support for both Qt and starting in the mid-3.x series, enabling greater compatibility with diverse desktop environments like and . Additionally, later 3.x releases introduced experimental Just-in-Time () compilation, beginning with version 3.12.0, to accelerate code execution by translating Gambas to native on the fly. As of November 2025, the project remains actively developed under Benoît Minisini's leadership, with efforts progressing toward a potential Gambas 4.0 that prioritizes expanded cross-platform capabilities, including better Windows and macOS integration via ongoing component refinements; however, no firm release date has been set.

Language Features

Syntax and Core Elements

Gambas employs a BASIC-like syntax that emphasizes readability and simplicity, featuring keywords such as PRINT for output, IF...THEN...ELSE for conditional statements, and FOR...NEXT for iteration loops. The language is case-insensitive for keywords and identifiers, allowing developers to write Print or print interchangeably while maintaining consistency in code style. This design draws from traditional BASIC dialects, enabling straightforward procedural programming without mandatory semicolons for statement termination or explicit type declarations in all cases. Core data types in Gambas include the for dynamic typing, which can hold any value and defaults to NULL, accommodating automatic similar to . Other fundamental types encompass (32-bit signed, range -2,147,483,648 to 2,147,483,647, default 0), (variable-length , default NULL), (true/false, 1 byte, default FALSE), and Date (8 bytes for date and time, default NULL). Conversion between types occurs seamlessly via built-in functions like CInt, CStr, and CBool, facilitating flexible data handling without explicit casting in many operations. Control structures support modular code organization through subroutines, declared as PUBLIC SUB or PRIVATE SUB for accessible or module-restricted procedures, respectively, with optional typed parameters (e.g., AS String). Error handling utilizes a TRY...CATCH...FINALLY block, where TRY encloses potentially erroneous code, CATCH processes exceptions, and FINALLY ensures cleanup execution regardless of errors. Arrays are declared using DIM, such as DIM arrayName AS New Type[dimension], supporting multi-dimensional structures with zero-based indexing. Built-in functions provide essential operations, including string manipulation with Left$ (extracts prefix characters), Mid$ (substrings), and InStr (substring position); mathematical utilities like Abs (absolute value), Sqr (square root), and Max (greater of two values); and basic file I/O via OPEN (file access), LINE INPUT (line reading), and CLOSE (resource release). A distinctive feature is event-driven programming support, where custom events declared with EVENT are triggered using RAISE EVENT, optionally returning a boolean to indicate handler cancellation.

Object-Oriented Capabilities

Gambas provides robust support for through its class-based system, where classes serve as blueprints for creating objects that encapsulate data and behavior. An object in Gambas is instantiated using the NEW operator and consists of , variables, methods, and , allowing developers to model real-world entities effectively. is implemented via the Inherits keyword, enabling a class to derive from a parent class and inherit its methods, , constants, and , with a maximum inheritance depth of 16 levels to prevent excessive hierarchies. This mechanism promotes , as child classes can override inherited methods to provide specialized implementations while maintaining compatible signatures, thus supporting polymorphism through virtual method dispatching. For example, a derived class can redefine a parent's Draw method to handle specific rendering without altering the base behavior elsewhere in the program. Encapsulation is achieved primarily through visibility modifiers for methods and variables: Public (the default, accessible from outside the class) and Private (restricted to within the class only), ensuring internal state management while exposing necessary interfaces. Properties, however, are always public, providing controlled access to data via getter and setter methods if needed. This design hides implementation details, reducing complexity and enhancing maintainability in larger projects. Built-in classes number over 100, including the Collection class for dynamic key-value storage, Stream for input/output operations, and Timer for handling asynchronous events like periodic tasks. These object-oriented features integrate seamlessly with Gambas components, which are reusable class libraries extending core functionality; for instance, the gb.db component provides classes for database connectivity to systems like MySQL and PostgreSQL, while graphics components such as gb.qt offer classes for UI elements and rendering.

GUI and Component Integration

Gambas facilitates the creation of graphical user interfaces through its integrated development environment, which includes a visual form designer enabling developers to build forms using a drag-and-drop interface for widgets such as buttons, textboxes, labels, and other controls. This designer allows for intuitive placement, resizing, and alignment of elements on forms, streamlining the process of prototyping and refining user interfaces without manual coding for layout. The designer supports properties editing panels for customizing appearance, behavior, and data binding directly within the IDE, promoting rapid application development similar to traditional BASIC environments. Event handling in Gambas GUI applications is tied directly to controls via a convention-based system, where developers define methods named after the control and event, such as Button1_Click() for responding to a button click or TextBox1_Change() for detecting text modifications. These events, including Click, Change, KeyPress, and MouseDown, are raised automatically by the underlying toolkit and executed in the context of the form's class, allowing for responsive, event-driven programming. This approach integrates seamlessly with Gambas's object-oriented features, where controls are instances of classes that can inherit and extend event behaviors. The component system in Gambas extends GUI capabilities through pre-built, loadable libraries that provide specialized classes for common tasks, enhancing integration without requiring external dependencies. For multimedia, the gb.media component offers classes like VideoPlayer for playback of audio and video files using GStreamer, supporting formats such as MP4 and WAV. Networking is handled by the gb.net component, which includes classes for HTTP requests via HttpClient, socket communications with Socket, and email via SmtpClient. Database integration is supported by gb.db, enabling connections to systems like MySQL, PostgreSQL, and SQLite through unified classes such as Connection and Result, abstracting vendor-specific details for SQL operations. These components are selected in the project settings and compiled into the application, ensuring modular and extensible GUI development. Gambas achieves cross-toolkit support for GUIs via an in its gb.form and related components, allowing developers to write toolkit-agnostic code while selecting the underlying implementation at . The gb.gtk component leverages GTK+ version 3 for native integration on GNOME-based desktops, providing widgets with theming and accessibility features. Alternatively, gb.gui.qt dynamically loads Qt5 or Qt6 based on the runtime environment, such as , offering high-performance rendering and advanced effects like animations. This selection is configured in the project properties, ensuring compatibility across desktops without code changes, though performance and appearance may vary slightly between toolkits. For deployment, Gambas compiles projects into standalone using the gba3 archiver, which bundles from forms, classes, and modules into a single marked as . The resulting application embeds the Gambas interpreter via memory-mapped access to the archive, eliminating the need for a separate runtime installation and enabling distribution as self-contained binaries on systems. This process preserves information if needed and supports icon embedding for desktop integration, facilitating easy sharing and execution of GUI applications.

Development Environment

IDE Structure

The Gambas (IDE) features a modular layout centered around several key components that facilitate , authoring, graphical interface , and . The primary interface includes a and at the top for , a Project Browser (also known as the Project Explorer) on the left displaying a of project files such as forms, modules, classes, and resources, and a central workspace for editing forms or . This structure allows developers to navigate and organize projects efficiently, with the ability to switch between and views seamlessly. The code editor, integrated into the central workspace, provides for Gambas BASIC code and auto-completion suggestions based on language keywords, class members, and project-specific elements to streamline coding. When event handlers or procedures, the editor supports indentation, underlining, and context-aware prompts, enhancing during development. The form designer, also in the central area, enables drag-and-drop placement of controls from a built-in toolkit (e.g., buttons, labels, text boxes), with resizing handles, alignment tools, and a properties panel for configuring attributes like position, size, and events. This visual tool is particularly suited for of graphical user interfaces. The , accessible via toolbar buttons or keyboard shortcuts like F5 for execution, offers breakpoints, variable inspection, tracing, and runtime highlighting directly within the IDE, allowing step-by-step . In version 3.21.0 (released November 2025), the panel can be undocked and placed on another screen, and it highlights values that have changed. Gambas supports multiple project types, including console applications for text-based programs, graphical applications with form-based UIs, and libraries for reusable code modules, selectable during project creation. Projects are organized hierarchically in the Project Explorer using modules for grouping procedures and functions, and classes for object-oriented structures, enabling modular development and easy file management without imposing rigid hierarchies. Built-in tools include an incremental compiler that translates Gambas source code into architecture-independent bytecode for efficient execution, an interpreter console for interactive testing of code snippets in console projects, and an integrated profiler introduced in version 3.2 for analyzing performance metrics such as execution time and function calls. These tools are invoked directly from the IDE's menus or toolbars, supporting a streamlined workflow from writing to optimization. Customization options encompass editor color themes that adapt to system dark mode preferences for better visibility, and extensibility through the component system, where developers can load plugins as shared libraries (e.g., gb.qt for Qt-based GUIs) to add new classes or features without modifying the core IDE. An integrated help browser provides context-sensitive documentation, including class references and examples, accessible via F1 or menu navigation to assist during development. integration includes basic support added in version 3.20, with enhancements in 3.21.0 (November 2025) for committing individual files and cherry-picking commits, enabling repository pulls, pushes, and options like rebasing directly from the IDE's project menu.

Tools and Workflow

The development workflow in Gambas typically begins with creating a new through the IDE, where developers select a project type such as a graphical application or console program. Forms and user interfaces are then designed visually using drag-and-drop tools, allowing components like buttons and text fields to be placed and configured without manual coding for layout. Event-driven code is written in response to user interactions, such as button clicks, leveraging the IDE's code editor for and auto-completion. The is subsequently compiled and tested within the IDE, with options to run in debug mode or generate a standalone for distribution. Debugging tools in Gambas include setting breakpoints by pressing F9 on a line, which pauses execution for inspection, and variable watches that monitor expression values, stopping the program when changes occur. Step-through execution is supported via shortcuts such as F8 for single-stepping into , F5 for running or continuing execution, and SHIFT + F5 for running to the current line, enabling precise traversal of paths. An error console displays runtime outputs, including Print, , and messages, along with stack traces for unhandled exceptions to facilitate rapid issue identification. For testing and profiling, Gambas provides the gb.test component, a framework for and that allows creation of automated test suites to verify program functionality. Profiling tools, enabled via the IDE's "Debugging > Enable Profiling" menu or the .Profile property, analyze runtime performance by measuring memory usage, complexity, and function call frequencies and durations, with results saved to a profile file limited to 512 MiB by default. Collaboration features support exporting projects as .gambas archive files for sharing via or , and importing them into other instances of the IDE to continue development. Components can be shared through the Gambas contrib directory in the source repository or by packaging them as installable libraries, allowing reuse across projects without full source disclosure. Best practices in Gambas emphasize by encapsulating functionality into reusable classes and modules to promote maintainability and . Developers should also account for cross-platform differences, such as varying desktop environments, by testing on multiple supported systems and using conditional compilation directives where necessary.

Availability

Supported Platforms

Gambas primarily supports distributions, where it is available through native packages for major releases such as 20.04, 22.04, 24.04, and 24.10; 11 and 12; ; and Leap 15.6; ; and . It compiles and runs reliably on these systems, leveraging the standard package managers like APT, DNF, or Pacman for straightforward integration. and provide packages through their standard repositories. Support extends to other Unix-like operating systems, including , , and , where Gambas 3 compiles successfully, though some components like gb. may require adjustments. Solaris has experimental ports, but functionality remains unconfirmed, while macOS has limited support; compilation is not officially supported and may encounter stability issues. Windows lacks native support; however, experimental compatibility is achieved through or (WSL), allowing Gambas to operate in a Unix-like environment. Gambas targets common architectures including x86, , and , with dedicated ports enabling deployment on devices like the for embedded applications. There is no official support for mobile platforms such as Android or as of 2025, due to limitations in the underlying C library features required for compilation and execution. The runtime environment depends on graphical libraries such as GTK+ (version 2.16 or 3.4) or Qt (version 4.5 or 5.3) for GUI development, alongside core dependencies like libffi and for rendering. These ensure compatibility with desktop environments while maintaining a minimal installed footprint, typically under 50 MB for the core interpreter and essential components on Debian-based systems. Gambas supports cross-compilation, permitting the creation of standalone Linux executables on other Unix-like systems using tools like the built-in compiler, which generates native binaries without runtime dependencies beyond standard libraries. This facilitates development workflows across compatible environments, with installation methods detailed separately via distribution repositories.

Installation Methods

Gambas can be installed via binary packages, which are the recommended method for most users on supported Linux distributions, as they handle dependencies automatically. Binary packages are provided through distribution repositories or official builds hosted on the openSUSE Build Service. For Debian-based systems like Ubuntu, users can add the appropriate repository and install using the package manager; for example, on Ubuntu 24.04 or later, add the stable repository with echo 'deb http://download.opensuse.org/repositories/home:/gambas:/stable/xUbuntu_24.04/ /' | sudo tee /etc/apt/sources.list.d/home:gambas:stable.list, import the signing key via curl -fsSL https://download.opensuse.org/repositories/home:/gambas:/stable/xUbuntu_24.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_gambas_stable.gpg > /dev/null, then run sudo apt-get update followed by sudo apt-get install gambas3. Users should select the repository path matching their specific Ubuntu version from the openSUSE Build Service. Similar steps apply to other distributions such as Arch Linux, openSUSE, and Debian, where repositories are added to pacman.conf, zypper, or apt sources, respectively, before installing the gambas3 package. For newer versions on Ubuntu, a Personal Package Archive (PPA) may be available, such as the Gambas stable PPA, to access updates beyond the default repositories. Source tarballs for stable releases are also downloadable from SourceForge, though compilation is required after extraction. For users needing the latest development features or custom builds, installation from source code is possible by cloning the Git repository from GitLab. Prerequisites include development tools like gcc, g++, automake (version 1.11.1 or later), autoconf (version 2.68 or later), libtool (version 2.4 or later), and libraries such as libffi-dev, libbz2-dev, libcairo2-dev (version 1.6.0 or later), with exact dependencies varying by distribution and listed in the project's .gitlab-ci.yml file for reference. After installing prerequisites—for instance, on with sudo apt-get install build-essential g++ automake autoconf libtool libffi-dev libbz2-dev libcairo2-dev and additional libraries as needed—clone the repository using git clone https://gitlab.com/gambas/gambas.git, navigate to the directory, run ./reconf-all to generate configuration scripts, then ./configure -C (optionally with flags like --enable-nonfree for certain components), followed by make -j$(nproc) for compilation and sudo make install for installation. Stable versions can be obtained as tarballs from the official website instead of Git for a release-specific build. Version management in Gambas distinguishes between stable releases (e.g., 3.21) available via binary packages or tagged commits, and development branches from the master, which may introduce experimental features but require recompilation for updates. Distributions typically provide stable versions through their package managers, allowing seamless updates with commands like [sudo](/page/Sudo) apt-get upgrade gambas3 on Debian-based systems, while users pull changes with [git](/page/Git) pull before rebuilding. Post-installation setup involves launching the Gambas IDE with the gambas3 command and configuring GUI toolkits if needed for development. Gambas supports both and Qt toolkits for creating graphical user interfaces, selectable during project creation in the IDE or by including specific components like gb.gtk or gb.qt. Additional contrib components, such as extensions for databases or web views, can be downloaded directly within the IDE using the built-in component manager under the Tools menu, which connects to the online repository hosted on the project's servers. No further system-wide configuration is typically required, as toolkit dependencies are resolved during installation. Common installation issues often stem from unresolved dependencies on older distributions, where missing libraries like libgtk-3-dev or qtbase5-dev prevent compilation or runtime errors occur. Troubleshooting involves running sudo apt --fix-broken install on Debian-based systems to repair package conflicts, verifying and installing all prerequisites from the .gitlab-ci.yml file, or enabling / repositories in with sudo add-apt-repository universe before retrying. For source builds on legacy systems, users may need to adjust configure flags or use a containerized environment to match supported platforms.

Adoption and Community

Usage and Impact

Gambas primarily appeals to a niche of hobbyists, educators, and small-scale developers who value its accessible BASIC-inspired syntax for creating graphical user interfaces on systems. This targeted adoption stems from its design as a lightweight alternative to more complex environments, enabling quick prototyping without steep learning curves. The language's impact lies in bridging the gap for BASIC-style (RAD) tools on open-source platforms, where it supports (OOP) in an intuitive manner. In educational contexts, Gambas serves as an effective entry point for teaching OOP principles and GUI design to novice programmers, fostering hands-on learning through its . Adoption has remained steady yet gradual, with some interest in integrations for hobbyist electronics and embedded projects. This reflects Gambas' compatibility with architectures, allowing seamless deployment in low-resource scenarios like IoT prototypes. The release of Gambas 3.21.0 in late 2025 continues to support ongoing community engagement. Despite these strengths, Gambas' ecosystem lags behind established languages such as Python or , resulting in minimal commercial uptake and reliance on community-driven components. Its user base is a small but dedicated worldwide, gauged from forum and distribution patterns, underscoring its role as a specialized rather than mainstream tool. Metrics include over 10,000 cumulative forum posts across dedicated communities and consistent activity on hosting platforms like .

Resources and Projects

The Gambas project maintains several official resources to support developers and users. The Gambas wiki at https://gambaswiki.org/ serves as the central documentation hub, offering language references, tutorials, code snippets, and an application repository that catalogs over 70 medium- to large-scale applications and demos written in Gambas. Mailing lists hosted at https://lists.gambas-basic.org/ facilitate discussions, with dedicated lists for general user queries, bug tracker notifications, and Git commit updates. Community-driven sites extend these official channels. The Gambas One forum at https://gambas.one/ acts as the primary English-language platform for discussions, troubleshooting, and sharing user experiences. The SourceForge project page at https://sourceforge.net/projects/gambas/ hosts downloads, file releases, and a discussion archive, serving as a longstanding hub for the community. User-contributed resources include tutorials scattered across the and external , such as A Beginner's Guide to Gambas by John W. Rittinghouse, which introduces core concepts for newcomers. Notable projects built with Gambas demonstrate its versatility across domains. Desktop utilities like the BumbleBee Launcher and MV1SysTray provide system integration tools, while educational software such as MyEduBase for student management and Multiple Diploma Builder for certification handling support learning environments. Math tools, including the Azeotrope Chemical Calculator, enable scientific computations. Simple 2D games like Tetris, Checkers, and Tic Tac Toe showcase graphical capabilities. Specific standouts include KediCAD, a CAD application for 2D and 3D design similar to AutoCAD, and Xt7-player-mpv, a GUI frontend for the mpv media player included in various Linux distributions. Contributions to the Gambas project follow a structured process using and . Developers the main repository at https://gitlab.com/gambas/gambas, implement changes in their branch, and submit merge requests for review, adhering to guidelines for code organization and testing. This workflow ensures external code pieces and artifacts are integrated efficiently. The support ecosystem around Gambas includes third-party libraries and components for specialized needs, though options remain limited compared to more mainstream languages. Web integration is handled through built-in components like gb.web for basic server-side functionality, with community extensions for HTTP handling. Hardware interfacing is supported via gb.serial for serial communication, enabling projects with devices like , as demonstrated in wiki examples for visualization and control.

Examples

Simple Script Example

To illustrate the core syntax of Gambas in a non-graphical , consider a basic console script that prompts the user for their name and age, performs string concatenation for a personalized , applies conditional logic to validate the input, and incorporates handling for invalid such as empty name, non-numeric age entries, or out-of-range ages. This example highlights Gambas's interpreted nature, where the script is dynamically compiled to upon execution, enabling without manual compilation steps. The following code defines a complete, standalone script saved as greeting.gbs:

gambas

#!/usr/bin/env gbs3 Public Sub Main() Try Dim sName As String = Input("Enter your name: ") If sName = "" Then Throw "No name provided." End If Dim sAge As [String](/page/String) = Input("Enter your age: ") If Not IsNumber(sAge) Then Throw "Age must be a number." End If Dim iAge As Integer = Val(sAge) If iAge < 0 Or iAge > 150 Then Throw "Invalid age entered." End If Print "Hello, " & sName & "! You are " & Str(iAge) & " years old." Catch Print "Error occurred: " & Error.Text End End

#!/usr/bin/env gbs3 Public Sub Main() Try Dim sName As String = Input("Enter your name: ") If sName = "" Then Throw "No name provided." End If Dim sAge As [String](/page/String) = Input("Enter your age: ") If Not IsNumber(sAge) Then Throw "Age must be a number." End If Dim iAge As Integer = Val(sAge) If iAge < 0 Or iAge > 150 Then Throw "Invalid age entered." End If Print "Hello, " & sName & "! You are " & Str(iAge) & " years old." Catch Print "Error occurred: " & Error.Text End End

This script begins with a shebang line (#!/usr/bin/env gbs3) to specify the Gambas scripter interpreter, allowing direct execution as a shell script. The Public Sub Main() declares the entry point subroutine, which Gambas automatically invokes when running the script. The Try block initiates protected execution, encompassing the core logic. Dim sName As String = Input("Enter your name: ") declares a string variable sName and assigns it the result of the Input function, which reads a line from standard input after displaying the prompt. The subsequent If sName = "" Then Throw "No name provided." End If uses an If conditional to check for an empty string, raising a custom error with Throw if unmet, demonstrating basic control flow and explicit error raising. Similarly, Dim sAge As String = Input("Enter your age: ") captures the age as a string, followed by If Not IsNumber(sAge) Then Throw "Age must be a number." End If to validate that the input is numeric before conversion. Then, Dim iAge As Integer = Val(sAge) performs the numeric conversion with Val; non-numeric inputs are already caught. The If iAge < 0 Or iAge > 150 Then Throw "Invalid age entered." End If applies another conditional for range validation. If validation passes, Print "Hello, " & sName & "! You are " & Str(iAge) & " years old." outputs the greeting, employing the & operator for string concatenation and Str to convert the integer back to a string for inclusion. The Catch block handles any exceptions raised within Try, accessing the error details via Error.Text and printing them. This structure ensures the script terminates gracefully rather than crashing on errors like non-numeric input. The purpose of this minimal script is to showcase Gambas's interpreted execution model, where the gbs3 command compiles the source to temporary , caches it for reuse, and runs it via the underlying interpreter (gbx3), recompiling only on changes for efficiency. Basic error handling via Try...Catch prevents abrupt halts, promoting robust console applications. To execute, make the file executable with chmod +x greeting.gbs and run ./greeting.gbs, or invoke directly with gbs3 greeting.gbs; for persistent bytecode, convert the script to a full using gbs3 --convert-script and compile via gbc3.

GUI Application Example

A simple yet illustrative GUI application in Gambas is a basic form that allows user input via a text box and displays a dynamic greeting upon button activation, demonstrating core concepts like event handling and control manipulation. This example leverages Gambas' visual form designer and its integration with toolkits such as Qt or GTK+ for cross-platform rendering. To build this application, launch the Gambas IDE and create a new graphical project by selecting "Graphical application" (typically using the Qt backend for broader compatibility). A default main form (FMain) is automatically generated, serving as the primary window. Open the form in the designer view, then access the toolbox (via F6) to drag and drop three controls: a TextBox for input, a Button for interaction, and a Label for output display. Arrange them vertically—place the Label at the top (e.g., at position X=10, Y=10), the TextBox below it (X=10, Y=50, Width=200), and the Button adjacent to the TextBox (X=220, Y=50, Width=80). Set the Button's Text property to "Greet" and ensure the form's Title is "Hello Gambas". These steps utilize the IDE's property editor (F4) for precise control placement and styling without manual coding. Next, implement the logic in the form's class file (FMain.class). In the Form_Open event, which triggers when the form loads, initialize the Label's text to prompt user input:

gambas

Public Sub Form_Open() Label1.Text = "Enter your name below:" End

Public Sub Form_Open() Label1.Text = "Enter your name below:" End

This sets a static message upon startup, showcasing assignment and control properties. For interactivity, double-click the in the to auto-generate the Button1_Click event handler. Add the following code to read from the TextBox and update the Label dynamically:

gambas

Public Sub Button1_Click() If TextBox1.Text <> "" Then Label1.Text = "Hello, " & TextBox1.Text & "! Welcome to Gambas." Else Label1.Text = "Please enter a name." End If End

Public Sub Button1_Click() If TextBox1.Text <> "" Then Label1.Text = "Hello, " & TextBox1.Text & "! Welcome to Gambas." Else Label1.Text = "Please enter a name." End If End

This snippet employs conditional logic (If statement) to validate input, concatenation (& operator) for building strings, and property access (e.g., .Text) to link controls. The empty string check prevents blank greetings, highlighting basic error handling. Running the project (F5) launches a windowed application where users type into the TextBox and click the to see the update in real-time. This event-driven model—where the button click raises an event processed by the handler—exemplifies Gambas' object-oriented approach to GUI development, similar to but extended for environments. The application can be extended by adding features like focus events (e.g., TextBox1_Focus to clear prior input) or persistence via the gb.db component, but this core example establishes foundational workflow for more complex interfaces.

References

  1. https://gambaswiki.org/wiki/doc/whatisgambas
  2. https://gambaswiki.org/wiki/doc/distro
  3. https://gambaswiki.org/wiki/comp/gb.gtk
  4. https://gambaswiki.org/wiki/doc/release/3.21.0
  5. https://gambaswiki.org/wiki/doc/release/3.20.0
  6. https://gambaswiki.org/wiki/doc/oldnews
  7. https://gambaswiki.org/wiki/doc/release/3.12.0
  8. https://gambaswiki.org/wiki/lang
  9. https://gambaswiki.org/wiki/tutorial/variables
  10. https://gambaswiki.org/wiki/lang/type
  11. https://gambaswiki.org/wiki/lang/type/variant
  12. https://gambaswiki.org/wiki/lang/type/integer
  13. https://gambaswiki.org/wiki/tutorial/functions
  14. https://gambaswiki.org/wiki/lang/catch
  15. https://gambaswiki.org/wiki/lang/dim
  16. https://gambaswiki.org/wiki/lang/instr
  17. https://gambaswiki.org/wiki/lang/raise
  18. https://gambaswiki.org/wiki/doc/object-model
  19. https://gambaswiki.org/wiki/lang/extends
  20. https://gambaswiki.org/wiki/lang/vardecl
  21. https://gambaswiki.org/wiki/comp/gb
  22. https://en.wikibooks.org/wiki/Programming_Gambas_from_Zip/Graphical_Applications
  23. https://gambaswiki.org/wiki/def/eventhandler
  24. https://gambaswiki.org/wiki/comp/gb.media
  25. https://gambaswiki.org/wiki/comp/gb.db
  26. https://gambaswiki.org/wiki/comp/gb.gui.qt
  27. https://gambaswiki.org/wiki/doc/arch
  28. https://gambaswiki.org/wiki/doc/startIDE
  29. https://gambaswiki.org/wiki/howto/ide
  30. https://gambaswiki.org/wiki/doc/release/3.2.0
  31. https://gambaswiki.org/wiki/doc/release/3.8.2
  32. https://gambaswiki.org/wiki/ide/debugger-shortcuts
  33. https://gambaswiki.org/wiki/doc/unittesting
  34. https://gambaswiki.org/wiki/install
  35. https://gambaswiki.org/wiki/doc/release
  36. https://gambaswiki.org/wiki/doc/forum
  37. https://gambaswiki.org/wiki/app
  38. https://gambaswiki.org/wiki/app/kedicad
  39. https://gambaswiki.org/wiki/app/arduino2
  40. https://gambaswiki.org/wiki/doc/scripting
  41. https://gambaswiki.org/wiki/howto/getstarted
Add your contribution
Related Hubs
User Avatar
No comments yet.