-
Notifications
You must be signed in to change notification settings - Fork 0
/
Notes.pas
92 lines (77 loc) · 2.08 KB
/
Notes.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
unit Notes;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.DBCtrls, Data.DB,
Vcl.Mask, Vcl.StdCtrls, Vcl.ComCtrls, Vcl.Grids, Vcl.DBGrids, DBDateTimePicker,
Vcl.Buttons;
type
TFormNotes = class(TForm)
DBNavigator1: TDBNavigator;
DBGrid1: TDBGrid;
DBRichEditNoteMainText: TDBRichEdit;
DBEditNoteTitle: TDBEdit;
DBDateTimePickerNote: TDBDateTimePicker;
BitBtnSave: TBitBtn;
BitBtnAdd: TBitBtn;
BitBtnDelete: TBitBtn;
PanelLeft: TPanel;
PanelRigth: TPanel;
procedure BitBtnSaveClick(Sender: TObject);
procedure BitBtnAddClick(Sender: TObject);
procedure BitBtnDeleteClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure SetWidthGrid;
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormNotes: TFormNotes;
implementation
{$R *.dfm}
uses DM;
procedure TFormNotes.BitBtnAddClick(Sender: TObject);
begin
DMl.ADOQueryNotes.Append;
DBDateTimePickerNote.Date := Now;
end;
procedure TFormNotes.BitBtnDeleteClick(Sender: TObject);
begin
DMl.ADOQueryNotes.Delete;
end;
procedure TFormNotes.BitBtnSaveClick(Sender: TObject);
begin
try
begin
if Dml.ADOQueryNotes.FieldByName('Äàòà').Text = '' then
Dml.ADOQueryNotes.FieldByName('Äàòà').AsDateTime := DBDateTimePickerNote.Date;
DMl.ADOQueryNotes.Post;
end;
except
ShowMessage('Ïðîâåðüòå ââåäåííûå äàííûå');
end;
end;
procedure TFormNotes.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #27) then
Close;
end;
procedure TFormNotes.FormShow(Sender: TObject); //Âñòàâêà òåêóøåé äàòû
begin
DBDateTimePickerNote.Date := Now;
SetWidthGrid;
end;
procedure TFormNotes.SetWidthGrid; // Óñòàíîâêà øèðèíû ãðèäà
begin
try
DBGrid1.Columns[0].Width := 20;
DBGrid1.Columns[1].Width := 200;
DBGrid1.Columns[2].Visible := False;
DBGrid1.Columns[3].Width := (DBGrid1.Width - (20 + 200));
except
end;
end;
end.