Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit UnitBanquet;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
- type
- TFormBanquet = class(TForm)
- Code: TLabel;
- Count: TLabel;
- EditCount: TEdit;
- ButtonAdd: TButton;
- ComboBox: TComboBox;
- LabelError: TLabel;
- procedure EditCountKeyPress(Sender: TObject; var Key: Char);
- procedure EditCountChange(Sender: TObject);
- procedure ButtonAddClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- FormBanquet: TFormBanquet;
- implementation
- {$R *.dfm}
- procedure TFormBanquet.ButtonAddClick(Sender: TObject);
- begin
- if ComboBox.ItemIndex = 0 then
- begin
- LabelError.Visible := true;
- end
- else
- begin
- LabelError.Visible := false;
- ModalResult := mrOk;
- end;
- end;
- procedure TFormBanquet.EditCountChange(Sender: TObject);
- begin
- if (EditCount.Text <> '') then
- begin
- ButtonAdd.Enabled := true;
- end
- else
- begin
- ButtonAdd.Enabled := false;
- end;
- end;
- procedure TFormBanquet.EditCountKeyPress(Sender: TObject; var Key: Char);
- begin
- if not(Key in ['0'..'9', #8]) then
- Key := #0;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement