home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-01-07 | 3.7 KB | 189 lines |
- '
- ' *** 3D TEXT INPUT
- '
- ' * ED$ MUST BE GLOBAL OR THIS ROUTINE WILL NOT WORK.
- '
- Global ED$
- '
- ' * THESE ARE SOME EXAMPLE EDIT REQUESTERS.
- '
- ED["Greetings","",10,10]
- Print ED$
- '
- ED["Enter your name","",10,30]
- Print ED$
- '
- ED["Quit (Y/N) ?","N",1,1]
- Print ED$
- '
- ED["Text has already been entered using ED$","This is the text",50,50]
- Print ED$
- '
- ' THE 3D BUTTON ROUTINE IS USED TO DRAW THE TEXT INPUT SCREEN.
- '
- 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
- '
- Procedure ED[MSG$,ED$,SX,ML]
- '
- ' MSG$ - This is the message that the edit screen tells the user.
- '
- ' ED$ - This is what the user can put on the edit line before writing.
- '
- ' SX - This is the width of the edit line.
- '
- ' ML - This is the maximum length of the edit line, it can be bigger
- ' than SX, because the edit line scrolls through text as well.
- '
- '
- ' * WHATEVER HAS BEEN TYPED IN THE EDIT LINE, IT WILL BE STORED IN ED$.
- '
-
- MID=39-Int(SX/2)
-
- Screen Open 7,640,38,8,Hires
- Screen Display 7,,117,,
- Flash Off
- Cls 0
- Pen 6
- Paper 4
- Palette $AA,$FFF,$DDD,$333,$888,$F00,$FF0,$4A4
-
- XX=MID
- YY=3
- B[40,(YY-3)*8,600,(YY-3)*8+12,MSG$,1,7,6]
- B[(MID*8)-5,(8*(YY-1))+4,(MID*8)+(SX*8)+5,(8*(YY-1))+19,"",1,7,6]
- B[(MID*8)-2,(8*(YY-1))+6,(MID*8)+(SX*8)+2,(8*(YY-1))+17,"",0,4,6]
-
- Curs On
- Locate XX,YY
- Print String$(" ",SX);
- Ink 0
- Bar 0,0 To 7,7
- XC=0
- MN=0
- PX=0
- L=Len(ED$)
- If L>=SX
- PX=L-SX
- End If
- Clear Key
- Do
- Gosub _DED
- Repeat
- A$=Inkey$
-
- S=Scancode
- If(CHK=1) and(A$<>"") and(Scancode=0)
- Timer=0
- End If
- If Mouse Key=1
- X=(X Screen(X Mouse))/8-XX
- If X>=MN and X<=L
- XC=X
- Gosub _DED
- Wait Vbl
- End If
- End If
- Until A$<>""
- F=1
- If A$=Chr$(13)
- Exit
- End If
- If A$=Chr$(27)
- ED$="_Esc_"
- Exit
- End If
- If S=65 and XC+PX>MN
- ED$=Left$(ED$,XC+PX-1)+Mid$(ED$,PX+XC+1)
- E=1
- L=L-1
- S=79
- End If
- If S=70 and XC+PX<L
- ED$=Left$(ED$,XC+PX)+Mid$(ED$,PX+XC+2)
- E=1
- L=L-1
- F=0
- End If
- If S=79 and PX+XC>MN
- F=0
- If XC=0
- PX=PX-1
- Else
- XC=XC-1
- End If
- End If
- If S=78 and PX+XC<L
- F=0
- If XC=SX
- PX=PX+1
- Else
- XC=XC+1
- End If
- End If
- If F
- If A$>=" " and L<ML
- ED$=Left$(ED$,PX+XC)+A$+Mid$(ED$,PX+XC+1)
- L=L+1
- If L>SX
- If XC>=SX
- PX=PX+1
- Else
- XC=XC+1
- End If
- Else
- XC=XC+1
- End If
- End If
- End If
- Loop
- Curs Off
- Goto _END
- _DED:
- Locate XX,YY
- Print Mid$(ED$,PX+1,SX);
- If E
- If X Curs<XX+SX
- Print " ";
- E=0
- End If
- End If
- Locate Min(XX+XC,XX+SX-1),YY
- Return
- _END:
- Screen Close 7
- End Proc