home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 4 / Amoszine 4 (Disk 1 of 3).adf / READERS_SOURCE.LHA / READERS_SOURCE / PRO_S.PULLINGER / Number_Requester.Amos / Number_Requester.amosSourceCode
Encoding:
AMOS Source Code  |  1992-02-26  |  1.9 KB  |  70 lines

  1. ' Number_Requester.Amos - Steve Pullinger
  2.  
  3.  
  4. ' Uses Interface to get a number from the user 
  5.  
  6.  
  7. ' Initialise Interface resources 
  8. Load "AMOSPro_Tutorial:Tutorials/Interface/Example_resource.abk"
  9. Resource Bank 16
  10. Resource Screen Open 0,640,200,0
  11. Flash Off : Curs Off : Cls 0 : Paper 0 : Pen 8
  12. Palette ,,,,$840,$C84,$FC8,$FEB
  13. Wait Vbl 
  14.  
  15.  
  16. ' Example procedure call 
  17. N_REQUEST["Please Enter a number",310]
  18. NR=Param : Rem Get return value 
  19.  
  20. ' Print String from basic
  21. Print "Procedure returned: ";NR
  22.  
  23. ' To call the procedure, pass a string for the title and a default value 
  24.  
  25. Procedure N_REQUEST[TITLE$,DEF_VAL]
  26.    
  27.    ' This procedure displays an Interface requester centred on-screen 
  28.    ' The title for the requester is passed as TITLE$ and the procedure
  29.    ' returns the number input from an Interface enter DIgit zone  
  30.    
  31.    ' DEF_VAL is a default value for the requester 
  32.    ' EXAMPLE: REQUEST["Please enter a number"]  
  33.    
  34.    ' Interface Program
  35.    
  36.    IN_STRING$=IN_STRING$+"BAse     80,40;"
  37.    IN_STRING$=IN_STRING$+"SIze     1VATextWidth32+,TextHeight6*;"
  38.    IN_STRING$=IN_STRING$+"BAse     ScreenWidth SizeX-2/,ScreenHeight SizeY-2/;"
  39.    IN_STRING$=IN_STRING$+"SAve     1;"
  40.    IN_STRING$=IN_STRING$+"BOx      0,0,1,SizeX,SizeY;"
  41.    IN_STRING$=IN_STRING$+"POutline 1VACentreX,10,1VA,0,3;"
  42.  
  43.    ' If you don't want a default value change the 1 after 3VA to 0 below
  44.    IN_STRING$=IN_STRING$+"DI       1,16,32,2VA,3VA,1,4,6 ;"
  45.    IN_STRING$=IN_STRING$+"EXit;"
  46.    
  47.    
  48.    ' Open Communication Channel between Amos and Interface program
  49.    Dialog Open 1,IN_STRING$
  50.    
  51.    ' Pass title string to Interface 
  52.    TITLE$=" "+TITLE$
  53.    TITLE$=TITLE$+" "
  54.    Vdialog$(1,1)=TITLE$
  55.    Vdialog(1,2)=Len(TITLE$)
  56.    Vdialog(1,3)=DEF_VAL
  57.    
  58.    ' Call GET_STRING$ program 
  59.    X=Dialog Run(1)
  60.    
  61.    ' Wait for input complete
  62.    Repeat 
  63.       ' RET is returned by the procedure to Amos 
  64.       RET=Rdialog(1,1)
  65.    Until Dialog(1)
  66.    
  67.    ' Close Interface program
  68.    Dialog Close(1)
  69.    
  70. End Proc[RET]