Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit UnitIngredient;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
- type
- TFormIngredient = class(TForm)
- Edit1: TEdit;
- Edit2: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Edit5: TEdit;
- Code: TLabel;
- Name: TLabel;
- Protein: TLabel;
- Fat: TLabel;
- Hydro: TLabel;
- ChangeCode: TLabel;
- ButtonAdd: TButton;
- ComboBox: TComboBox;
- procedure Edit1KeyPress(Sender: TObject; var Key: Char);
- procedure Edit3KeyPress(Sender: TObject; var Key: Char);
- procedure Edit4KeyPress(Sender: TObject; var Key: Char);
- procedure Edit6KeyPress(Sender: TObject; var Key: Char);
- procedure Edit5KeyPress(Sender: TObject; var Key: Char);
- procedure Edit1Change(Sender: TObject);
- procedure Edit2Change(Sender: TObject);
- procedure Edit3Change(Sender: TObject);
- procedure Edit4Change(Sender: TObject);
- procedure Edit5Change(Sender: TObject);
- procedure ButtonAddClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- FormIngredient: TFormIngredient;
- implementation
- {$R *.dfm}
- procedure TFormIngredient.ButtonAddClick(Sender: TObject);
- begin
- ModalResult := mrOk;
- end;
- procedure TFormIngredient.Edit1Change(Sender: TObject);
- begin
- if (Edit2.Text <> '') and (length(Edit1.Text) = 3)
- and (Edit3.Text <> '') and (Edit4.Text <> '') and
- (Edit5.Text <> '') then
- begin
- ButtonAdd.Enabled := true;
- end
- else
- begin
- ButtonAdd.Enabled := false;
- end;
- end;
- procedure TFormIngredient.Edit1KeyPress(Sender: TObject; var Key: Char);
- begin
- if not(Key in ['0'..'9', #8]) then
- Key := #0;
- end;
- procedure TFormIngredient.Edit2Change(Sender: TObject);
- begin
- if (Edit2.Text <> '') and (length(Edit1.Text) = 3)
- and (Edit3.Text <> '') and (Edit4.Text <> '') and
- (Edit5.Text <> '') then
- begin
- ButtonAdd.Enabled := true;
- end
- else
- begin
- ButtonAdd.Enabled := false;
- end;
- end;
- procedure TFormIngredient.Edit3Change(Sender: TObject);
- begin
- if (Edit2.Text <> '') and (length(Edit1.Text) = 3)
- and (Edit3.Text <> '') and (Edit4.Text <> '') and
- (Edit5.Text <> '') then
- begin
- ButtonAdd.Enabled := true;
- end
- else
- begin
- ButtonAdd.Enabled := false;
- end;
- end;
- procedure TFormIngredient.Edit3KeyPress(Sender: TObject; var Key: Char);
- begin
- if not(Key in ['0'..'9', #8]) then
- Key := #0;
- end;
- procedure TFormIngredient.Edit4Change(Sender: TObject);
- begin
- if (Edit2.Text <> '') and (length(Edit1.Text) = 3)
- and (Edit3.Text <> '') and (Edit4.Text <> '') and
- (Edit5.Text <> '') then
- begin
- ButtonAdd.Enabled := true;
- end
- else
- begin
- ButtonAdd.Enabled := false;
- end;
- end;
- procedure TFormIngredient.Edit4KeyPress(Sender: TObject; var Key: Char);
- begin
- if not(Key in ['0'..'9', #8]) then
- Key := #0;
- end;
- procedure TFormIngredient.Edit5Change(Sender: TObject);
- begin
- if (Edit2.Text <> '') and (length(Edit1.Text) = 3)
- and (Edit3.Text <> '') and (Edit4.Text <> '') and
- (Edit5.Text <> '') then
- begin
- ButtonAdd.Enabled := true;
- end
- else
- begin
- ButtonAdd.Enabled := false;
- end;
- end;
- procedure TFormIngredient.Edit5KeyPress(Sender: TObject; var Key: Char);
- begin
- if not(Key in ['0'..'9', #8]) then
- Key := #0;
- end;
- procedure TFormIngredient.Edit6KeyPress(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