Icon Toolkit provides eight new commands for Amstrad Basic that enable the user to create (or simulate) a WIMP (windows, icons, menus, pointer) environment from Basic. Also included is an Icon Designer program to enable the user to design icons for use from Basic. There follows a brief rundown of the commands followed by a description of how firstly icons and secondly menus can be set up from Basic. Icon Commands |Source, baseSets the base addressaddress from which the icon data is to be taken. One icon takes 64 bytes. |lcon,x,y,number Places an icon on the screen. When designing icons it is best to make notes of the order in which your icons are stored. In the example memo program 5 icons (numbers 1 to 5) are used.|Pointer,x,y,colour,@a% Places a pointer on screen at x,y in a certain colour. The pointer can be moved around the screen with the cursor keys. When the COPY key is pressed the variable a% returns the number of the icon selected.Window/Mouse Commands |Tcoord,x,y,@a%Returns the screen address equivalent of text coords x,y.|Gcoord,x,y,@a%Returns the screen address equivalent of graphics co-ords x,y.|Cut,screen address,store address,width, depth |Paste,screen address,store address, width, depthThese commands store and replace respectively a section of the screen starting at the given address, in the store address. The dimensions of the screen section must be given (in bytes not pixels).|Fwindow,screen address, width, depth, maskFills a specified section of the screen, starting at the given address with a pixel mask (1 to 255). The dimensions of section must be given (again in bytes, not pixels).Examples To use the icon commands: - Design your icons with the designer. If you require more than 5 icons you can merge your designer files into memory at 320 byte intervals. (320 bytes = 5 x 64 bytes).
- Set the |SOURCE command to the base address of the data.
- Place your icons on screen with the |ICON command.
- Place the pointer on the screen with the |POINTER command.
- Use the On a% . . . command to assign sub-routines to icons.
For example: 10 memory 39999 20 load "data",40000 30 |SOURCE,40000 35 print chr$(23) ;chr$( 11) 40 p%=1 50 for n%= 100 to 500 step 100 60 |ICON,n%,300,p% 70 p%=p%+1 80 next 90 a%=0:|POINTER,50,300,1 ,@a% 100 on a% gosub 200,300,400,500,600 200 rem SUBROUTINES . . . 300 .... 400 .... 500 .... 600 ....To use the window/menu commands:- Use the |TCOORD/|GCOORD commands to find the required location for a window.
- Store the present contents of that location with the |CUT command.
- Fill your window with a background using the |FWINDOW command.
- Set up menu of print message in window using Basic.
- When finished replace the old screen contents in place of the window.
For example: 10 a%=0:|TCOORD, 10,10,@a% 20 |CUT,a%, 16384,40,100 30 |FWINDOW,a%,40,100,240 40 paper 1:pen 0 50 locate 12,11:print "WINDOW" 60 locate 12,15:print "PRESS A KEY" 70 while inkey$="":wend 80 |PASTE,a%,16384,40,100 90 paper 0:pen 1As this is a three week production more listings follow.PCW
|