home *** CD-ROM | disk | FTP | other *** search
- {fon:hom459045}
- WIMP lives up to its name?
- {fon:tri}
-
- Let's face it, the main market for Acorn computers is always going
- to be in education. The big thing that got Acorn where it is in
- education is the fact that it's fairly easy to learn to write nice
- structured readable programs in BBC BASIC. I think it would be a
- good idea to enhance BBC BASIC to make it MUCH easier to write
- multitasking programs by adding elements to the language to handle
- some WIMP processing.
-
- The concept would be similar to that of sprite handling. Using the
- system sprite area, it's possible to write many programs using simple
- * calls and PLOT commands. If you want to do something really tricky,
- then you have to use SYS OS_SpriteOp. Commercial programs are
- expected to handle sprites in their own sprite area, and therefore
- would always use the SYS calls.
-
- For WIMP processing, BASIC would provide commands for a subset
- of WIMP operations, such as template loading and the poll loop.
- BASIC itself would handle all the mandatory processing, like opening
- a window when the poll loop returns an open window request. The
- BASIC programmer could write a readable program without having to
- stuff magic numbers into data blocks and invoking cryptic SYS calls.
-
- The programmer would first declare an application directory and
- name, APPLICATION("<App$Dir>", "MyApplication"); BASIC would then
- assume that the templates are in <App$Dir>.Templates and any local
- sprites are in <App$Dir>.Sprites. BASIC would then automatically
- perform the following operations without the programmer necessarily
- being aware of it: 1. Perform a Wimp_Initialise 2. Create a suitable
- local sprite area and load the sprites into it 3. Load all the
- templates from the template file and create the windows.
-
- The programmer would then declare each of the Wimp_Poll responses
- that are to be handled, like:-
-
- WHENEVER NULL:PROCnull
- WHENEVER MOUSE_CLICK window$,icon%,button%:PROCbutton
- WHENEVER MENU_SELECTION main%,sub%:PROCmenu
- WHENEVER DATA_LOAD filename$,size%,type%:PROCdataload
-
- At this point, BASIC doesn't perform any operations, it just
- remembers the commands, and generates a suitable poll mask.
-
- Finally the programmer invokes the poll loop:-
-
- WIMP_POLL
-
- The BASIC WIMP_POLL command handles all the following:
- 1: Performs a SYS"Wimp_Poll" and invokes any appropriate
- WHENEVER command.
- 2: Handles all open window requests by opening the window.
- 3: Handles all close window requests by closing the window.
- 4: Handles any quit message by performing the WHENEVER, if there is
- one, then doing a SYS"Wimp_CloseDown" and END. (This allows the
- program to do any application specific tidying up before ENDing).
-
- If the programmer wants to end the program, he just types END.
- BASIC will remember that this is a WIMP program and do the
- closedown automatically.
-
- There would be commands for creating menus, altering the text in
- writable text icons, changing the sprite in sprite icons, and such
- like. There would not be any BASIC commands for creating or deleting
- windows or icons, if you want to do that you would need to use the
- SYS calls directly.
-
- Whenever a window is referenced, it would be referred to by its name.
- BASIC would be responsible for mapping these to window numbers.
- Instead of a command for creating a menu, perhaps there could be
- standard MENU files, like template files, and the program would
- simply invoke the predefined menus when it needed them.
-
- BASIC would not support any window that needs to be redrawn by the
- program except for the provision of a WHENEVER REDRAW
- command. When this is invoked, the program would need to do its own
- SYS "Wimp_GetRectangle" etc. There would be different WHENEVER
- commands for certain specific messages, such as QUIT, DATA_SAVE,
- MODE_CHANGE, HELP_REQUEST.
-
- In order for it to be possible to write a program that just does a
- small amount of its own WIMP handling there would be a set of
- WHENEVER options that return the Wimp data block, these would look
- like:
-
- WHENEVER EVENT 6,b%:PROCkeypress
- WHENEVER MESSAGE &80145,b%:PROCprinttypeodd
-
- Now see the next article for an example of my new code.
-
- {spr:l03}
- {end}
-