Advertisement
MadCortez

Untitled

Mar 23rd, 2021
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.67 KB | None | 0 0
  1. unit Menu;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  7.   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
  8.  
  9. type
  10.   TMenuForm = class(TForm)
  11.     GetData: TButton;
  12.     ConnectFile: TButton;
  13.     OpenDialog1: TOpenDialog;
  14.     procedure GetDataClick(Sender: TObject);
  15.     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  16.     procedure ConnectFileClick(Sender: TObject);
  17.     procedure FormCreate(Sender: TObject);
  18.   private
  19.     { Private declarations }
  20.   public
  21.     { Public declarations }
  22.   end;
  23.   TRef = Record
  24.       Topic: String[25];
  25.       Author: String[20];
  26.       Str: Integer;
  27.       Date: String[10];
  28.   End;
  29.  
  30. var
  31.   MenuForm: TMenuForm;
  32.   Ref: array of TRef;
  33.   MyFile: File of TRef;
  34.   n: Integer;
  35.  
  36. implementation
  37.  
  38. Uses
  39.    Base, ChangeMenu, Add, DeleteRef, Change;
  40.  
  41. {$R *.dfm}
  42.  
  43. procedure TMenuForm.GetDataClick(Sender: TObject);
  44. begin
  45.    BaseForm.Show;
  46.    MenuForm.Hide;
  47. end;
  48.  
  49. procedure TMenuForm.ConnectFileClick(Sender: TObject);
  50. var
  51.    i: Integer;
  52. begin
  53.    i := 0;
  54.    if OpenDialog1.Execute then
  55.    begin
  56.       AssignFile(MyFile, OpenDialog1.FileName);
  57.       Reset(MyFile);
  58.       SetLength(Ref, FileSize(MyFile));
  59.       While not eof(MyFile) do
  60.       begin
  61.          Read(MyFile, Ref[i]);
  62.          Inc(i);
  63.       end;
  64.       n := i;
  65.    end;
  66.    GetData.Enabled := True;
  67. end;
  68.  
  69. procedure TMenuForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
  70. begin
  71.    MenuForm.Close;
  72.    ChangeMenuForm.Close;
  73.    AddForm.Close;
  74.    DeleteForm.Close;
  75.    ChangeForm.Close;
  76. end;
  77.  
  78. procedure TMenuForm.FormCreate(Sender: TObject);
  79. begin
  80.    n := 0;
  81. end;
  82.  
  83. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement