[Jaffa Software]

WIMP programming in BASIC

Steve Mumford looks at two packages designed to simplify the task

One of the great advantages of the original BBC Micro was its implementation of BASIC - it supported structured programming making it clear and easy to understand, plus a well-written reference guide to the language was supplied with the machine.

It provided a great opportunity for those who wanted to try their hand at programming, and I'm sure there are a lot of people out there who tapped in their first serious programs at a keyboard. From BBC BASIC, you could access most of the machine's major functions, so there was little need to progress to another language unless performance was critical.

Times change, and due to the increased overheads and relative complexities of WIMP systems such as RISC OS, writing your own WIMP-based program is a more demanding task. Due to all the extra housework which needs to be done, a lot of effort can be sunk into creating the raw multitasking framework of the program before even the tiniest amount of flesh can be added. That's where systems like WimpBASIC 2 (from Clares) and WimpWorks 2 (Jaffa Software) come into play - both in their second incarnation, they provide prewritten code libraries, window, menu and event editors that allow the programmer to concentrate on the problem they want to solve without having to worry about writing run-of-the-mill maintenance code.

The good news is that both Clares and Jaffa Software are happy for you to release and distribute any applications that you create with their software, commercial or freeware, as long as suitable reference is made to the tools used and no attempt is made to reverse-engineer the code or support models.

One of WimpWorks' advantages is that the code that it generates is completely stand-alone, and no extra module directories need to be included, this is because it converts your code into "real" BASIC, while WimpBASIC's libraries are held in a separate modules folder, which might prove to be a little cumbersome for some.

Getting Started

Installation of either package is straightforward - WimpWorks copies directly to a hard disc, and WimpBASIC requests registration details before personalising the installation disc. Copy protection for this application is provided on a 'credit' basis with two credits supplied as standard, the extra credit being provided in case of hard disc corruption. An uninstall option is available in case you want to move the application to another machine.

When it comes to creating a new application, both applications present the user with interfaces that share some common ideas - instead of ploughing straight into reams of code, the programmer approaches their embryonic application from almost the opposite direction, by designing the layout of the user interface. Windows are fairly easy to set up, with both packages using a variant on Acorn's original FormEd tool.

Menu construction is a little different: as well as deciding which entries to include in the menu, you can specify functions which are to be called when the item in question is selected. Once the windows and menus have been laid out, some simple events can be catered for - short procedures are written to be called automatically when the user clicks on the iconbar, for instance.

Finally, the rest of the program can be built around the framework that's been set up. At this stage, all that remains is to 'compile' the application and save it to disc, dealing with any errors using the built-in throwback systems.

The Editors

Although both applications have editors similar in function, those provided with WimpBASIC are more tightly integrated into the package, and a couple of extra resource viewers are thrown in for good measure. As well as window, menu and code designers, WimpBASIC can provide you with lists of the variables and sprites used in your application.

All the designers and viewers present their information in a consistent fashion, showing a summary of objects available to edit, and providing the ability to create new ones - a little similar in operation to the Filer, or the sprite overview in Paint. The individual editors are perhaps more familiar - windows are created in something a little like FormEd, and code is passed to an Edit lookalike, with syntax-sensitive colouring.

The connectivity between the core of WimpWorks and its editors is a little less formal, and window definitions are passed to a separate template editor before being pulled back into the core once they have been saved. The editing of code is carried out in much the same way, and procedures are exported to Edit (or any other suitable text editor you happen to have running) for modification. In addition the more open structure of WimpWorks allows third party additions for editing as well.

Because of this, the separate sections of WimpWorks do behave differently, but there are advantages - I much prefer using StrongEd to edit code, and having that facility makes the whole process a bit more comfortable for me.

Learning the WIMP

Although a lot of the groundwork is prepared for you, you'll still have to write your own sections of code to create fully-functional applications, so we need to consider two main areas. The first is to determine the language we'll be using to write the extra code and the second is to find out how much support material is provided.

Looking first at WimpWorks, it uses the ARM BASIC module to provide the core of the language, which is understandably comforting to the aspiring WIMP programmer. The language has been extended to provide WIMP functionality by a mixture of extra procedures and keywords. Command syntax is the same, as is the flow of control - in fact, it's just like writing a series of separate procedures.

In the WimpWorks world you can add extension packages that add certain types of commands to the language, for example it would be feasible for someone to create a database package that provided specific commands for handling a database.

WimpBASIC is rather different in that is uses a language that is like BASIC in appearance. Most of the BASIC keywords have been re-implemented, along with a whole host of new ones, but because it's a separate language in its own right, there are subtle differences to be aware of. Firstly, although the language itself isn't case sensitive, the editor automatically maps typed commands into an aesthetic mixture of upper and lower case - strangely unsettling if you've been immersed in BASIC for any length of time.

Other differences emerge, for example, the colon cannot be used as a command separator - you're only allowed to use one statement per line - and is used for a completely different purpose. However, the fact that it's a reimplementation of BASIC means that improvements can be made: for instance, altering the text in a writable icon is as simple as setting a string variable.

I'm happy to say that both packages come with plenty of documentation - both have hypertext manuals stored in StrongHelp format as well as command reference lists giving full details of the additional commands provided. WimpWorks is supplied with a paper manual as well, and I particularly like the way in which associated commands were listed alongside each entry in the reference section - this feature makes it much easier to get to grips with the additions to the language.

Detailed walkthroughs are also provided, two in the WimpWorks manual, and five for WimpBASIC, but both applications provide numerous examples programs on disc and a lot can be learned from examining how another programmer tackled a particular problem. There's an independent WimpBASIC web site that holds a whole variety of programs, classified according to their function - well worth a look if you've got web access.

Although you're bound to come up with ideas that won't be readily implementable, WimpWorks and WimpBASIC both have a strong complement of prewritten functions - for instance, both packages allow you to load and display sprites and Draw files as well as plot simple geometric shapes, and WimpWorks is supplied with an extension module that allows you to create your own Draw files. It's also possible to extend WimpWorks' functionality by writing your own plugin editors to complement those already present.

More Information

If you want to find out more about either of these programs, the best places to start are probably their supporting websites. An independent site has been set up for WimpBASIC at http://www.treknet.is/wb/ and is maintained by one of its beta-testers. The site holds a code library, hints and tips sections, WimpBASIC updates and more, but some of these areas do appear to be a little sparse or out-of-date. However, the site is home to a large array of example applications and tutorials, so could be useful for the struggling programmer.

The WimpWorks website is maintained by the authors of the software, and is held at [http://www.jaffasoft.co.uk/]. There are two areas of particular interest - it's possible to download a demonstration of WimpWorks for evaluation, and owners of newer copies of the application will be able to download updates directly from the website. There's also a document detailing a WimpWorks feature named ActiveApps, a versatile message-passing system that even functions across networks.

In Summary

I was greatly impressed by both of these packages - once you're familiar with the particular indiosyncracies of either application, you can start putting a program together without having to worry about how you're going to code the printing function or file transfer mechanisms. By removing a lot of the black magic associated with WIMP programming, WimpWorks and WimpBASIC aim to make Acorn's GUI more accessible to the masses, and for the most part they succeed.

If you're thinking about which package to go for, I'm afraid you're in for a tough choice - I prefer WimpWorks' more accessible language, but I get the feeling that it might be easier to manage large projects under WimpBASIC.

Finally, if you're planning to try your hand at coding using one of these applications, I'd recommend investing in a WIMP BASIC programming book - a number are available - because although both packages do a relatively good job at introducing the procedures involved, it's particularly helpful to understand a little of what goes on beneath the surface.

Context

WimpWorks was at v2.23 when this review was published. Over the following months and years, there were numerous enhancements and bug fixes; covering:

  • Many bug fixes
  • Speed improvements
  • Better integration for code editors through the use of OLE
  • Improved multi-national support
  • 32-bit support