home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / s_to_z / srwdemo / srwaddme.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-09-15  |  3.2 KB  |  84 lines

  1. {SRWADDME.PAS - Adding Shazam Report Wizard to existing projects}
  2. {Copyright (c) 1995 ShazamWare Solutions, Inc.}
  3.  
  4. {--See SRWDEV.WRI for complete instructions on how to use this file.}
  5. {--From Delphi, select File|Open File to open this file.}
  6. {--Deviating from these instructions may result in unpredictable results.}
  7. {--Only add the INDENTED lines, not the comments that start with STEP #.}
  8.  
  9. {STEP 2------------------------------------------------------------------------}
  10. {Append the following lines to the uses statement of the project's DPR file.}
  11. {Make sure you replace the semi-colon in your existing project with a comma}
  12. {before appending this text.}
  13.  
  14.   SrwMain  IN 'SRWMAIN.PAS'  {frmSrwMain},
  15.   SrwEdit  IN 'SRWEDIT.PAS'  {frmSrwEdit},
  16.   SrwTable IN 'SRWTABLE.PAS' {frmSrwTable},
  17.   SrwCode  IN 'SRWCODE.PAS',
  18.   SrwFile  IN 'SRWFILE.PAS',
  19.   SrwFormt IN 'SRWFORMT.PAS' {frmSrwFormat},
  20.   SrwAbout IN 'SRWABOUT.PAS' {frmSrwAbout};
  21.  
  22.  
  23. {STEP 3------------------------------------------------------------------------}
  24. {Add the following lines after the BEGIN section of the project's DPR file, and}
  25. {before any Application.CreateForm methods.  These are global SRW form object}
  26. {variables that must be set to NIL for Shazam to load properly.  DO NOT TRY
  27. {EXPLICTY LOADING SRW FORMS HERE AS THAT IS MANAGED AUTOMATICALLY.}
  28.  
  29.   {form object variables for shazam report wizard}
  30.   frmSrwMain   := NIL;
  31.   frmSrwAbout  := NIL;
  32.   frmSrwTable  := NIL;
  33.   frmSrwEdit   := NIL;
  34.   frmSrwFormat := NIL;
  35.  
  36.  
  37. {STEP 4------------------------------------------------------------------------}
  38. {Open the form that Shazam Report Wizard will be launched from, move to the} 
  39. {IMPLEMENTATION section of the form's Pascal file, and add the following to the USES}
  40. {statement (remember to replace the existing semi-colon with a comma if you have already} 
  41. {declared other forms and units):}
  42.  
  43.      SrwMain, SrwCode;
  44.  
  45.  
  46.  
  47. {STEP 5------------------------------------------------------------------------}
  48. {Within your project, create a menu item or toolbar button titled Reports and}
  49. {add the following line to its click event.  See SRWDEV.WRI for additional
  50. {information.}
  51.  
  52.   {create main shazam report wizard form}
  53.   IF frmSrwMain = NIL THEN BEGIN
  54.      srwIsChild := False; {or True for mdi applications}
  55.      srwParentForm := NIL; {or project's parent form name}
  56.      Application.CreateForm(TfrmSrwMain, frmSrwMain);
  57.   END;
  58.  
  59.   {customize shazam}
  60.  
  61.  
  62.   {display shazam}
  63.   frmSrwMain.Show;
  64.   frmSrwMain.BringToFront;
  65.  
  66.  
  67. {STEP 6------------------------------------------------------------------------}
  68. {If you assigned srwParentForm := FormName, this will activate an Exit menu
  69. {item on Shazam's File menu.  It executes the srwParentForm.Close method, which
  70. {will immediately close your application unless your intercept this with
  71. {something like the following code in your parent form's OnCloseQuery event.}
  72.  
  73.   {confirm with user that they actually want to exit}
  74.   IF MessageDlg('Exit the SRW Demonstration Program?',
  75.          mtConfirmation, [mbYes, mbNo], 1) = mrNo THEN BEGIN
  76.      CanClose := False; {cancel the close event}
  77.      Exit;
  78.   END;
  79.  
  80.   {close application properly here, freeing resources, etc.}
  81.  
  82.  
  83.  
  84.