home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 22 / CD_ASCQ_22_0695.iso / win / prg / hotmap / start.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-26  |  4KB  |  140 lines

  1. unit Start;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, VBXCtrl, Hotmap,
  8.   Frusamap, David, Ressav, Tool2, Edit, ExtCtrls;
  9.  
  10. type
  11.   TForm1 = class(TForm)
  12.     HotMap1: THotMap;
  13.     Label1: TLabel;
  14.     Label3: TLabel;
  15.     Label2: TLabel;
  16.     Timer1: TTimer;
  17.     procedure FormCreate(Sender: TObject);
  18.     procedure HotMap1RegionMouseDown(Sender: TObject;
  19.       var RegionNum: Single; var Button: Integer);
  20.     procedure HotMap1RegionMouseUp(Sender: TObject; var RegionNum: Single;
  21.       var Button: Integer);
  22.     procedure Timer1Timer(Sender: TObject);
  23.     procedure FormShow(Sender: TObject);
  24.   private
  25.     BtnDown:     Integer;
  26.     FillDemo:    Integer;
  27.     { Private declarations }
  28.   public
  29.     { Public declarations }
  30.   end;
  31.  
  32. var
  33.   Form1: TForm1;
  34.  
  35. implementation
  36.  
  37. {$R *.DFM}
  38.  
  39. procedure TForm1.FormCreate(Sender: TObject);
  40.     var DtFl: TVBString;
  41. begin
  42.         DtFl    := 'START.HMD';
  43.         HotMap1.DataFile := DtFl;
  44.         HotMap1.Action := 4;
  45.         DtFl    := 'BTMS.BMP';
  46.         HotMap1.BmpName := DtFl;
  47.         HotMap1.FillType := 3;
  48.  
  49.         FillDemo := 0;
  50. {        SetStringProp(HotMap1.DataFile, DtFl);}
  51. {        HotMap1.SetStringProp(27, DtFl);}
  52. {    VBXSetPropByName(HotMap1, "DataFile", @DtFl[0], Length(DtFl));}
  53. {        HotMap1.DataFile := BStrPCopy('START.HMD');}
  54. {    SetBStr(HotMap1.DataFile, 'START.HMD');
  55.     HotMap1.DataFile := BStrPas('START.HMD');}
  56. end;
  57.  
  58. procedure TForm1.HotMap1RegionMouseDown(Sender: TObject; var RegionNum: Single; var Button: Integer);
  59. begin
  60.     BtnDown := Round(RegionNum);
  61.     HotMap1.CurrentRgn := BtnDown;
  62.     HotMap1.Action := 1;
  63. end;
  64.  
  65. procedure TForm1.HotMap1RegionMouseUp(Sender: TObject; var RegionNum: Single; var Button: Integer);
  66.   var     fmUsaMap:    TUsaMap;
  67.           fmDavid:    TfmDavid;
  68.           fmResSav:    TfrResSav;
  69.         fmTools2:    TTools2;
  70.         fmEdit:        TEditForm;
  71.  
  72.         Rn:         Integer;
  73. begin
  74.     Rn    := Round(RegionNum);
  75.  
  76.     If BtnDown = Rn then
  77.     case Rn of
  78.             1:
  79.                 begin
  80.                     fmUsaMap := TUsaMap.Create(Self);
  81.                     Self.Hide;
  82.                     fmUsaMap.ShowModal;
  83.                     Self.Show;
  84.                 end;
  85.  
  86.             2:
  87.                 begin
  88.                     fmDavid := TfmDavid.Create(Self);
  89.                     Self.Hide;
  90.                     fmDavid.ShowModal;
  91.                     Self.Show;
  92.                 end;
  93.  
  94.             3:
  95.                 begin
  96.                     fmResSav := TfrResSav.Create(Self);
  97.                     Self.Hide;
  98.                     fmResSav.ShowModal;
  99.                     Self.Show;
  100.                 end;
  101.  
  102.             4:
  103.                 begin
  104.                     fmTools2 :=    TTools2.Create(Self);
  105.                     Self.Hide;
  106.                     fmTools2.ShowModal;
  107.                     Self.Show;
  108.                 end;
  109.  
  110.             5:
  111.                 begin
  112.                     fmEdit := TEditForm.Create(Self);
  113.                     Self.Hide;
  114.                     fmEdit.ShowModal;
  115.                     Self.Show;
  116.                 end;
  117.         end;
  118. end;
  119.  
  120. procedure TForm1.Timer1Timer(Sender: TObject);
  121. begin
  122.     HotMap1.CurrentRgn := (FillDemo);
  123.     HotMap1.Action := 1;
  124.     FillDemo := FillDemo + 1;
  125.     if FillDemo > HotMap1.NumOfRgns + 1 then
  126.     begin
  127.         HotMap1.CurrentRgn := 0;
  128.         HotMap1.Action := 1;
  129.         FillDemo := 0;
  130.         Timer1.Enabled := False;
  131.     end;
  132. end;
  133.  
  134. procedure TForm1.FormShow(Sender: TObject);
  135. begin
  136.         Timer1.Enabled := True;
  137. end;
  138.  
  139. end.
  140.