Форум: "Базы";
Текущий архив: 2002.04.08;
Скачать: [xml.tar.bz2];
ВнизКак в DBGrid запихнуть CheckBox? Найти похожие ветки
← →
gek (2002-03-01 15:21) [1]
type
TDbaForm = class(TForm)
Table1: TTable;
.....
DBGrid1: TDBGrid;
DBCheckBox1: TDBCheckBox;
....
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1ColEnter(Sender: TObject);
procedure DBGrid1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
end;
procedure TDbaForm.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if (gdFocused in State) and
(Column.Field = Table1Senior) then
begin
DBCheckBox1.SetBounds (
Rect.Left + DBGrid1.Left + 1,
Rect.Top + DBGrid1.Top + 1,
Rect.Right - Rect.Left,
Rect.Bottom - Rect.Top);
end;
end;
procedure TDbaForm.DBGrid1ColEnter(Sender: TObject);
begin
if DBGrid1.Columns [DBGrid1.SelectedIndex].
Field = Table1Senior then
DBCheckBox1.Visible := True
else
DBCheckBox1.Visible := False;
end;
procedure TDbaForm.DBGrid1KeyPress(Sender: TObject; var Key: Char);
begin
if DBCheckBox1.Visible and (Ord (Key) > 31) then
begin
Key := #0;
Table1.Edit;
DBCheckBox1.Checked := not
DBCheckBox1.Checked;
DBCheckBox1.Field.AsBoolean :=
DBCheckBox1.Checked;
end;
end;
© Copyright Marco Cantu
Страницы: 1 вся ветка
Форум: "Базы";
Текущий архив: 2002.04.08;
Скачать: [xml.tar.bz2];
Память: 0.44 MB
Время: 0.009 c