Amos Professional Manual  Contents  Index

Advanced Control Panels


DIALOG RUN
function: run a dialogue box from an open channel
button=DIALOG RUN(channel number)
button=DIALOG RUN(channel number,label,x,y)

As its name suggests, DIALOG RUN executes an Interface dialogue program from a specified channel, previously opened by a call to DIALOG OPEN. This Interface program will now run in the background, leaving the main AMOS Professional program to continue from its next instruction, providing that the Interface program does not contain a RunUntil instruction.

The use of an Interface RunUntil command will force the Interface program to behave exactly like the original DIALOG BOX routine, so it will take complete control of the system and only return when the user clicks on an exit button, or aborts by pressing [Ctrl]+[C]. In this case, the value held by "button" will contain the number of the last button pressed by the user.

The parameters for a DIALOG RUN function are very simple. First give the number of a channel that is currently open, then define the label in an Interface command string from which the program is to start. If a label is not specified, the Interface program will commence from the first routine in the list. Optional x,y coordinates can also be set to position the control panel on screen, and all graphics coordinates will now be measured from this location. It is important to note that if a BAse command is included in the program, these new x,y coordinates will be completely ignored! Also note that optional coordinates can be given without specifying the label parameter, as long as the appropriate commas are included. For example:

X> Dialog Run(1,,x,y)

Here is a simple working example:

E> A$=A$+"BA 50,50;SI 180,60;SA 1 ;IN 5,0,0;GB 0,0,170,50;"
   A$=A$+"PO 10,10,'Simple Keyboard',2,4;"
   Rem Define two quick return buttons
   A$=A$+"BU 1,10,28,24,10,0,0,1;[IN 0,BP 2*,0;SW 1;PR 4,2,' 1 ',4;][BR 0;NW;]"
   A$=A$+"BU 2,70,28,24,10,0,0,1;[IN 0,BP 2*,0;SW 1;PR 4,2,' 2 ',4;][BR 0;NW;]"
   A$=A$+"EXit;"
   Dialog Open 1,A$ : Rem Open a channel to the Interface program in A$
   R=Dialog Run(1) : Rem Run the program
   Rem Read each keypress as it is made
   Repeat
    P=Dialog(1) : Rem Check for button selection explained later
    If P<>0 Then Play P*10,10
   Until Inkey$<>""
   Dialog Close

DIALOG CLOSE
instruction: close one or more dialogue channels
Dialog Close
Dialog Close channel number

This command closes one or more dialogue channels on the screen.

Back    Next
09.03.02