Back2BASIC

You are here: Home > Issues > Issue #1 > Introduction to PANORAMIC

Introduction to PANORAMIC

By jdebord

Introduction

PANORAMIC is a BASIC interpreter/compiler developed by the french programmer Jean-Jacques Druelle since 2007. It is designed for the easy creation of programs under Windows.

This freeware product is available in english and french. The current version is 0.9.19

Installation

The setup program can be downloaded here:

The setup installs PANORAMIC in "C:\Program Files\Panoramic Editor\V 0.9.19" and creates a shortcut on the desktop.

PANORAMIC is comprised of a single executable PANORAMIC_EDITOR.exe which can be copied to a different support (e. g. an USB flash drive).

The simplest example

Starting PANORAMIC by clicking on the shortcut displays the editor window. Choosing the option "File/New" (or clicking on the first icon) opens a new window in which we can type the classical "Hello world" program:

Reserved words like print are highlighted in blue. Line numbers at the left are added automatically by the editor. It is possible to disable this option by selecting "No Lines" in the menu.

The program is run by pressing F9 or clicking on the icon which shows a red lightning. The output displays a main window with our text:

An executable can be generated by selecting "File / Executable". The resulting file is huge (about 1.5 megabyte) but it can be compressed by UPX to about 1/3 of its original size. The executable is a stand-alone program which does not need any additional runtime or library.

Objects and properties

An application is comprised of several objects. In the previous example, we have a single object: the main window, which is an object of type Form.

PANORAMIC assigns a number to each object. By default, the main window has the number 0 (hence the title: "Form 0").

Each object has several properties. For instance, the main window has a caption property (its title) and a font property to format the printed text.

We can set a property by typing a specific keyword, followed by the object number, followed by the property value. For instance, we can change the window caption and the font as follows:

Note that the font color is expressed in the RGB (Red, Green, Blue) format, so that "255, 0, 0" specifies a bright red.

The output looks like this:

A complete listing of the available objects (including 2D and 3D graphics, sprites, multimedia...) together with the relevant properties and keywords, can be obtained by selecting "Help / User's Guide" in the editor menu.

Events and subprograms

An event occurs when the user interacts with an object, e. g. by clicking on a button. The program must then execute a defined piece of code which is a subprogram. Each subprogram is identified by a label, which must be declared before it is referenced. So, we will have a sequence of instructions like:

  label button1_click         ' declares the label
  ...................
  on_click 1, button1_click   ' when the button (object number 1) is clicked,
                              ' execute the subprogram identified by button1_click
  ...................
  end                         ' end of main program
  button1_click:              ' subprogram
  ...................         ' instructions to be executed
  return                      ' end of event processing

A more elaborate example

We will now apply the above considerations to a new program: a picture viewer. The code looks like this:

  ' ---------------------------------
  ' Main program
  ' ---------------------------------
  ' --- Declarations ---
  label button1_click
  dim filename$
  ' --- Object description ---
  left 0, 300
  top 0, 200
  width 0, 350
  height 0, 400
  caption 0, "Picture viewer"
  button 1
  left 1, 50
  top 1, 50
  width 1, 250
  caption 1, "Load picture"
  on_click 1, button1_click
  picture 2
  left 2, 50
  top 2, 100
  width 2, 250
  height 2, 250
  open_dialog 3
  end
  ' ---------------------------------
  ' Subprogram
  ' ---------------------------------
  button1_click:
    filename$ = file_name$(3)
    if filename$ <> "_" then file_load 2, filename$
  return

This application uses 4 objects:

The first line of the subprogram loads the name of the file selected with the open dialog into the string variable filename$. As with labels, variables defined by the user must be declared by means of the dim keyword. Here we have chosen to group the declarations at the beginning of the program, but this is not mandatory.

The second line of the subprogram loads the file into the picture. The test checks that the user has validated his choice by clicking the "Open" button in the dialog (an underscore is returned in filename$ if the user clicks the "Cancel" button).

When the program is run, the following window appears:

Clicking the button will open a dialog for selecting an image. Once the choice is validated this image appears in the window.

Conclusion

In this introductory article, we have described only the most elementary aspects of PANORAMIC. More examples can be found in the "Examples" subdirectory of the PANORAMIC installation directory.

Moreover, the user community has developed some very interesting applications. For instance, an IDE (Integrated Development Environment) entirely written in PANORAMIC is being developed. A french version of this software can be downloaded here, and an english translation will be made if there is enough demand.

PANORAMIC is very easy to use and seems especially interesting for those who want to create graphical applications while keeping the legendary simplicity of the BASIC language.

Acknowledgement

I am indebted to Jean-Jacques Druelle, author of PANORAMIC, and to the members of the french PANORAMIC forum, for reviewing this article and suggesting useful improvements.


| top |