home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-01-06 | 3.7 KB | 189 lines |
- '
- ' *** REQUESTER ROUTINE ***
- '
- ' * The variable Q must be global, or this routine will not work.
- '
- Global AN,Q
- '
- ' * These are just some lines to test the requesters.
- '
- ALERT["UP TO 5 BUTTONS","0123456789|ABCDEFGHIJ|abcdefghij|Haaarrgh !|>>> ** <<<"]
- ALERT["SMALL !","YO !"]
- ALERT["********** THIS IS A VERY VERY VERY VERY VERY VERY LONG LINE O.K ! **********","YEP !"]
- ALERT["MULTIBLE|TEXT|IS|THAT|OK!","YEP|NO|PROBLEM|MATEY|!!!"]
- ALERT["PRESS A BUTTON !","1|2|3|4|5"]
- '
- ' * Print button that was pressed in last requester.
- '
- Print "Button";Q;" was pressed."
- '
- ' * The character | seperates lnes and buttons e.g.
- '
- ' * You are only allowed five lines of text with a width of 77 each.
- '
- Q$="LINE ONE|LINE TWO|LINE THREE"
- '
- ' * You are only allowed five buttons with a width of 10 each.
- '
- W$="BUTTON ONE|BUTTON TWO"
- '
- ' * Try requester.
- '
- ALERT[Q$,W$]
- '
- Direct
- '
- ' * This is the 3D-Button routine.
- '
- Procedure B[X1,Y1,X2,Y2,A$,IN,BC,FC]
- If IN=1
- C1=2
- C2=3
- Else
- C1=3
- C2=2
- End If
- Ink BC
- If IN<2
- Bar X1,Y1 To X2,Y2
- Ink C1
- Box X1,Y1 To X2,Y2
- Ink C2
- Polyline X1,Y2 To X2,Y2 To X2,Y1
- If IN=1
- Plot X1+1,Y1+1,1
- End If
- Else
- Bar X1+1,Y1+1 To X2-1,Y2-1
- End If
- If A$<>""
- WID=Text Length(A$)
- X7=(((X2-X1)/2)+X1)-(WID/2)
- Gr Writing 0
- Ink 3,BC
- Text X7+1,((Y2-Y1)/2)+Y1+3,A$
- Text X7-1,((Y2-Y1)/2)+Y1+3,A$
- Text X7,((Y2-Y1)/2)+Y1+4,A$
- Text X7,((Y2-Y1)/2)+Y1+2,A$
- Ink FC,BC
- Text X7,((Y2-Y1)/2)+Y1+3,A$
- Gr Writing 1
- End If
- End Proc
- '
- ' * This is the button push routine.
- '
- Procedure R[X1,Y1,X2,Y2]
- X3=X Screen(X Mouse)
- Y3=Y Screen(Y Mouse)
- M=Mouse Key
- AN=0
- If(X3<X1 or X3>X2 or Y3<Y1 or Y3>Y2) or M=0
- Pop Proc
- End If
- ' Bell 96
- AN=M
- Wait Vbl
- End Proc
- '
- Procedure ALERT[M$,B$]
- '
- ' * Define and cut up strings for buttons & text.
- '
- '
- ' * Variable Q holds the button number that was pressed
- '
- Dim B$(4),M$(4)
- I=0
- IO=0
- B=0
- While I<Len(B$)
- I=Instr(B$,"|",I+1)
- If I=0
- I=Len(B$)+1
- End If
- B$(B)=Left$(Mid$(B$,IO+1,I-IO-1),10)
- IO=I
- Inc B
- Wend
- I=0
- IO=0
- L=0
- While I<Len(M$)
- I=Instr(M$,"|",I+1)
- If I=0
- I=Len(M$)+1
- End If
- M$(L)=Left$(Mid$(M$,IO+1,I-IO-1),77)
- IO=I
- Inc L
- Wend
- '
- ' * Open screen 7 and place it in the middle of the screen.
- '
- Screen Open 7,640,41+(L*8),8,Hires
- Screen Display 7,,130-((L*8)/2),,
- Curs Off
- Flash Off
- Cls 0
- Palette $0,$0,$0,$0,$0,$0,$0,$0
- '
- ' * Figure out if the text or buttons are widest, then set the requester
- ' * to suit.
- '
- L1=(Len(M$)*8)+16
- L2=(B*100)+16
- If L1>L2
- OL=L1
- Else
- OL=L2
- End If
- '
- BL=320-(OL/2)
- OFF=L*8
- '
- B[BL,0,BL+OL,39+OFF,"",1,7,1]
- '
- ' * Place text on screen.
- '
- Gr Writing 0
- For A=0 To L-1
- Ink 3,7
- Text 320-(Len(M$(A))*8/2)-1,A*10+14,M$(A)
- Text 320-(Len(M$(A))*8/2)+1,A*10+14,M$(A)
- Text 320-(Len(M$(A))*8/2),A*10+13,M$(A)
- Text 320-(Len(M$(A))*8/2),A*10+15,M$(A)
- Ink 1,7
- Text 320-(Len(M$(A))*8/2),A*10+14,M$(A)
- Next A
- Gr Writing 1
- '
- ' * Place buttons on screen
- '
- D2=327-((B*100)/2)
- For A=0 To B-1
- B[D2+100*A,22+OFF,D2+100*A+86,36+OFF,B$(A),1,5,1]
- Next A
- '
- ' * Fade requester into view
- '
- Fade 1,$AA,$FFF,$DDD,$333,$888,$F54,$FF0,$5AC
- Q=0
- '
- ' * Wait for button to be pressed.
- '
- While Q=0
- For A=0 To B-1
- R[D2+100*A,22+OFF,D2+8+100*A+58,36+OFF]
- If AN>0
- Q=A+1
- End If
- Next A
- Wend
- '
- ' * Fade requester out of view and close screen 7.
- '
- Fade 1
- Wait 15
- Screen Close 7
- End Proc