Amos Professional Manual  Contents  Index

AMOS Interface


Vertical buttons can be drawn using the Vertical Text command, like this:

X> BUtton 3,135,35,10,42,0,0,1;
   [INk 0,0,0; Graphic Box 2,2,12,42; INk 6,0,0; Graphic Box 0,0,9,39;
   VText 0,0,'Hello!',2;][]

Graphical Icons can be generated using a packed image held in the Resource bank. They can be displayed with a simple call to the UNpack command, as follows:

X> [UNpack 0,0,1]

Complex buttons may be produced using a packed picture as the background, along with any combination of the Interface text and graphics commands. The background can also be generated from a whole line of images, using the powerful LIne command. Here is a ready- made example to examine:

LD> Load "AMOSPro_Tutorials:Tutorial/Interface/Simple_Requester.AMOS"

Changing a button
The ability to call an Interface routine whenever the status of a button is changed allows a range of useful effects to be generated. The key to these effects is held by three Interface button functions, BPosition, BReturn and BChange.

BPosition
Interface function: return the setting inside a button definition
setting=BP

After a normal button is created with a BUtton definition, the position of the current setting can be read straight from the drawing routine, using a simple call to the BPosition function. BPosition returns a value from the minimum to maximum, depending on the current setting of the button. It can be used to flick the image of the button ON or OFF as part of the drawing routine, so that there is one image for the selected button, and a different appearance for the original version.

This can be used in a number of ways. Here are some examples for changing the colour of text or background, using the INk command:

X> BUtton 1,50,38,50,10,0,0,1;
   [INk 0,0,0; GraphicSquare 0,0,50,10; PRint 1,2,'Button',BPosition+5;][]
   display highlighted text in a new ink colour

X> BUtton 2,90,38,50,10,0,0,1;
   [INk BPosition 1+,0,0; change the background of the button when selected
   GraphicBox 0,0,33,10; PRint 1,2,'Quit',4;][ButtonQuit;]

As mentioned earlier, another possibility is to display a packed image from the resource bank.

Back    Next
09.01.12