Wimp Basic 2

January 5, 2014 | By

What is Wimp Basic ?

Wimp Basic is a total programming environment. It enables you to write WIMP applications without having to understand how the RISC OS windows environment works. Wimp Basic handles it all for you. And, it enables you to write applications quickly.

Is it compatible with ordinary Basic ?

Yes and no. Because Wimp Basic deals with so many areas for you, many commands, particularly those associated with windows and menus, are not present or are much simpler. The general algorithms used in Basic programs can be used but you will probably need to re-write the routines. Wimp Basic procedures are typically much smaller than their Basic equivalent. For example to open a window in Basic you have to setup blocks and a polling routine with bits all over your application. In Wimp Basic it takes one line eg OPEN Window$.
Who is Wimp Basic aimed at ?

Wimp Basic is aimed at the BASIC programmer who has not had the time or inclination to get to grips with the WIMP environment. It is aimed at those who want to write reasonably small applications in the shortest possible time. It is NOT aimed at those who want to write a major application such as a spreadsheet, DTP etc. No doubt someone will prove us wrong but that is not the market we are aiming Wimp Basic at.

What do I get ?

Wimp Basic is supplied as the editing environment (detailed below), WBModules (which contains the run time module that is required for your applications – 105k), a range of WB files to be used as tutorials (some producing useful applications) and an on line manual for quick and easy access of all information.

How do I write an application ?

The hardest part is having the idea. Using the supplied tutorials you will write your first application in 30 minutes !

Wimp Basic has various component parts. The Main window is shown below.

WB Main window

The Icon Bar sprite is selected from a menu and that is all you have to do.
The Icon Bar menu is attached from a list of available menus.
The Select procedure is what happens when you click on the Icon Bar sprite and the procedure is selected from a list of available procedures.

A typical Select procedure might be:

Rem Called when user clicks on iconbar icon
Open HelloWorld

That is all you type. WB handles everything else and when you click on the Icon Bar icon the window called ‘HelloWorld’ is opened on the screen.

The Quit function is equivalent to the normal pre Quit function. It enables you to do things like save data before quitting your application.
The Load Procedure is selected in the same way. This can be very simple or a bit more complex depending upon the file to be loaded.
The Startup procedure is usually used to set up parameters such as global variables.

The Window Creator

Windows are created graphically. In this instance Window refers to windows, dialogue boxes, error boxes etc. You create the window as you want to see it and give it a name, just like a variable. This name is used to manipulate the window, open it, move it etc.

In addition to creating windows this is where you create icons. These can be text icons, graphical icons or writable icons. Button types are assigned to the icon. For example, you might want an action to take place when an icon is clicked on, so you set Button type to Click and select a procedure to be actioned. Simple.

The Menu Creator

Menus are also created graphically. A menu entry can then have a sub menu or a procedure attached to it. Keyboard short cuts can also be added. See below. The menu was created by clicking into the header and typing the menu name. The two menu entries were also just type in and the sub menu selected from the list of menus available. Likewise the Procedure was selected from a list.

WB Menu creator

The Variables Editor

This is a list of global variables, defined in Groups. By default it contains a set of System variables dealing with the screen, printer and some other necessary variables. New groups and variables are added using a simple dialogue. Local variables are defined in each procedure.

The Code Editor

This is very similar to Edit and will be familiar to anyone who has used Edit. The main differences are that the WB Editor automatically colour codes your code to distinguish keywords, variables, REM statements etc.

If you write several procedures in the same Editor window they are automatically split into individual procedures so that they can be selected from a list. One other useful addition is the ability to search all procedures using the Search and Replace.

One advantage of the way you write code in WB is that procedures and functions can be complete units of re-usable code. These can be filed in a Library directory and re-used in other applications. The same applies to Windows and Menus. For example, you will probably only ever need one Program Info window, one Quit procedure, one Icon Bar menu will do for many applications etc.

The Sprite Viewer

This simply lists the available sprites and provides information. Paint or another editor is used to edit sprites and icons.

The Raw Event Handlers

This is for those who want to delve a little deeper. It enables you to assign procedures that are actioned when a particular Raw Event happens. Perhaps the most common Raw Event that most people will use is the Null event. If it means nothing to you don’t worry as you don’t have to use it.

What’s new in WimpBasic 2?

There are many new keywords and facilities. These include :-

  •     You can now define separate procedures for Select and Adjust on the iconbar.
  •     You can now specify the font to be used by PRINT statements.
  •     You can easily create a font menu for the user to select which font to use.
  •     Pane windows are supported with built in keywords.
  •     An optimise option is available to create faster applications.
  •     The window designer now has a grid lock facility.
  •     New keywords dealing with files and directories.
  •     New keywords to load, plot, scale and remove Draw files.
  •     A new automatic method for setting which filetypes your application will accept.

Filed in: Uncategorized

Comments are closed.