Advertisement
ksyshshot

упозн 7

Jun 1st, 2023
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.32 KB | Source Code | 0 0
  1. unit UnitBanquet;
  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.   TFormBanquet = class(TForm)
  11.     Code: TLabel;
  12.     Count: TLabel;
  13.     EditCount: TEdit;
  14.     ButtonAdd: TButton;
  15.     ComboBox: TComboBox;
  16.     LabelError: TLabel;
  17.     procedure EditCountKeyPress(Sender: TObject; var Key: Char);
  18.     procedure EditCountChange(Sender: TObject);
  19.     procedure ButtonAddClick(Sender: TObject);
  20.   private
  21.     { Private declarations }
  22.   public
  23.     { Public declarations }
  24.   end;
  25.  
  26. var
  27.   FormBanquet: TFormBanquet;
  28.  
  29. implementation
  30.  
  31. {$R *.dfm}
  32.  
  33.  
  34. procedure TFormBanquet.ButtonAddClick(Sender: TObject);
  35. begin
  36.     if ComboBox.ItemIndex = 0 then
  37.     begin
  38.         LabelError.Visible := true;
  39.     end
  40.     else
  41.     begin
  42.         LabelError.Visible := false;
  43.         ModalResult := mrOk;
  44.     end;
  45. end;
  46.  
  47. procedure TFormBanquet.EditCountChange(Sender: TObject);
  48. begin
  49.     if (EditCount.Text <> '') then
  50.     begin
  51.         ButtonAdd.Enabled := true;
  52.     end
  53.     else
  54.     begin
  55.         ButtonAdd.Enabled := false;
  56.     end;
  57. end;
  58.  
  59. procedure TFormBanquet.EditCountKeyPress(Sender: TObject; var Key: Char);
  60. begin
  61.     if not(Key in ['0'..'9', #8]) then
  62.         Key := #0;
  63. end;
  64.  
  65.  
  66. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement