home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / pctchnqs / 1990 / number1 / makemusi.pas < prev    next >
Pascal/Delphi Source File  |  1989-12-07  |  3KB  |  102 lines

  1. (*
  2. **    File:    makeform.pas
  3. **    Purpose: Create CUSTFORM.DTA file with type from UNEWTYPE
  4. **    Author:  (c) 1989 by Tom Swan. All rights reserved.
  5. *)
  6.  
  7. program MakeForm;
  8.  
  9. uses Crt, Forms, Sliders, uNewType, uFormGen;
  10.  
  11. type  FnameString = string[65];     { File name string type }
  12.  
  13. const FORMFILE = 'MUSIC.DTA';       { Name for new file }
  14.  
  15.    
  16. {---- Design a new data-entry form. }
  17.  
  18. {$F+}    { Turn on far-code generation. }
  19. procedure newForm;
  20. begin
  21.    theForm.init( 9, 4, 71, 22 );
  22.    theForm.add( new( FStrPtr,   
  23.       init(  3,  3, ' Title      :', 45 ) ) );
  24.    theForm.add( new( FStrPtr,   
  25.       init(  3,  4, ' Composer   :', 22 ) ) );
  26.    theForm.add( new( FStrPtr,   
  27.       init(  3,  5, ' Instrument :', 22 ) ) );
  28.    theForm.add( new( FStrPtr,   
  29.       init( 38,  4, ' Label:', 16 ) ) );
  30.    theForm.add( new( FStrPtr,   
  31.       init( 38,  5, ' Type :', 6 ) ) );
  32.    theForm.add( new( FStrPtr,   
  33.       init( 52,  5, ' Tech:', 3 ) ) );
  34.    theForm.add( new( FIntPtr,   
  35.       init(  3,  6, ' Play Time  :', 0, 99 ) ) );
  36.    theForm.add( new( FIntPtr,   
  37.       init( 18,  6, ':', 0, 99 ) ) );
  38.    theForm.add( new( FIntPtr,   
  39.       init( 26,  6, ' (C):', 0, 2050 ) ) );
  40.    theForm.add( new( FRealPtr,  
  41.       init( 38,  6, ' Cost :', 6, 2 ) ) );
  42.    theForm.add( new( FYesNoPtr, 
  43.       init( 52,  6, ' Gift:' ) ) );
  44.    theForm.add( new( FStrPtr,   
  45.       init(  3,  8, ' Performer / director :', 22 ) ) );
  46.    theForm.add( new( FStrPtr,   
  47.       init(  3,  9, ' Producer             :', 22 ) ) );
  48.    theForm.add( new( FStrPtr,   
  49.       init(  3, 10, ' Sound Engineer       :', 22 ) ) );
  50.    theForm.add( new( FYesNoPtr, 
  51.       init( 49,  8, ' Taped  :' ) ) );
  52.    theForm.add( new( FIntPtr,   
  53.       init( 49,  9, ' Number :', 0, 999 ) ) );
  54.    theForm.add( new( FStrPtr,   
  55.       init(  3, 12, ' Notes:', 51 ) ) );
  56.    theForm.add( new( FSliderPtr,
  57.       init(  3, 14, ' Performance quality :', 0, 100, 5 ) ) );
  58.    theForm.add( new( FSliderPtr,
  59.       init(  3, 15, ' Recording quality   :', 0, 100, 5 ) ) );
  60.    theForm.add( new( FYesNoPtr, 
  61.       init(  3, 17, ' On loan :' ) ) );
  62.    theForm.add( new( FStrPtr,   
  63.       init( 18, 17, ' To :', 22 ) ) );
  64.    theForm.add( new( FIntPtr,   
  65.       init( 46, 17, ' Date :', 0, 12 ) ) );
  66.    theForm.add( new( FIntPtr,   
  67.       init( 55, 17, '/', 0, 31 ) ) );
  68.    theForm.add( new( FIntPtr,   
  69.       init( 58, 17, '/', 0, 99 ) ) );
  70. end; { newForm }
  71. {$F-}    { Turn off "far" code generation. }
  72.  
  73.  
  74. {---- Return True if file exists in current directory }
  75.  
  76. function fileExists( fname : FnameString ) : Boolean;
  77. var
  78.    f : File;
  79. begin
  80.    assign( f, fname );
  81.    {$i-} reset( f ); {$i+}    { Try to open the file }
  82.    if ioresult = 0 then
  83.    begin
  84.       fileExists := True;     { Return true if file open }
  85.       close( f )              { Then, close the file }
  86.    end else
  87.       FileExists := False     { Return false if not open }
  88. end; { FileExists }
  89.  
  90.  
  91. {---- Main program }
  92.  
  93. begin
  94.    if FileExists( FORMFILE )
  95.    then
  96.       writeln( FORMFILE, ' already exists' )
  97.    else begin
  98.       writeln( 'Creating new ', FORMFILE );
  99.       MakeFile( NewForm, FORMFILE );
  100.    end { else }
  101. end. { MakeForm }
  102.