Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit AddElementsUnit;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Menus, System.RegularExpressions, System.Math;
- type
- TAddElementsForm = class(TForm)
- AddBtn: TButton;
- ElementEdit: TEdit;
- InstructionMenu: TMainMenu;
- Instruction: TMenuItem;
- Label1: TLabel;
- procedure AddBtnClick(Sender: TObject);
- procedure ElementEditChange(Sender: TObject);
- procedure ElementEditKeyPress(Sender: TObject; var Key: Char);
- procedure FormShow(Sender: TObject);
- procedure InstructionClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- AddElementsForm: TAddElementsForm;
- implementation
- {$R *.dfm}
- Uses
- MainUnit, LinkedListUnit;
- procedure TAddElementsForm.ElementEditChange(Sender: TObject);
- begin
- if ElementEdit.Text <> '' then
- AddBtn.Enabled := true
- else
- AddBtn.Enabled := false;
- end;
- procedure TAddElementsForm.ElementEditKeyPress(Sender: TObject; var Key: Char);
- begin
- if (ElementEdit.Text <> '') and (Key = #13) then
- AddBtnClick(Sender);
- if (ElementEdit.Text = '0') and (Key <> #08) then
- Key := #0;
- end;
- procedure TAddElementsForm.FormShow(Sender: TObject);
- begin
- ElementEdit.Text := '';
- SystemParametersInfo(SPI_SETBEEP, 0, nil, SPIF_SENDWININICHANGE);
- end;
- procedure TAddElementsForm.InstructionClick(Sender: TObject);
- var
- Separator: String;
- begin
- Separator := #13#10;
- MessageDlg('Нужно ввессти число в диапазон 0..99.', mtInformation, [mbOK], 0);
- end;
- procedure TAddElementsForm.AddBtnClick(Sender: TObject);
- begin
- TListOperations.push(Header, StrToInt(ElementEdit.Text));
- ElementEdit.Text := '';
- Main.ListMemo.Text := '';
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement