Fórum CheckBox em DBGrid #177473
26/08/2003
0
Rafael Sangalli
Rafael_sangalli
Curtir tópico
+ 0Posts
26/08/2003
Leanribas
leanribas@bol.com.br
Gostei + 0
26/08/2003
Valdir.santos
Obrigado.
Valdir.
vsantos@piracicaba.sp.gov.br
Gostei + 0
26/08/2003
Guialberto
Obrigado.
[]´s
Guialberto
guialberto.soares@ig.com.br
Gostei + 0
26/08/2003
Marcelo.c
O da Bíblia(Marco Cantú) não funcionou com você ?
Testei aqui e funcionou perfeitamente:
Insira um DBCheckBox sobre o DBGrid e defina o campo desejado.
No evento OnDrawColumnCell coloque o código:
if (gdFocused in State) and (Column.Field = Campo) then begin DBCheckbox1.SetBounds( Rect.Left + DBGrid1.Left + 1, Rect.Top + DBGrid1.Top + 1, Rect.Right - Rect.Left, Rect.Bottom - Rect.Top); end;
No evento OnCollEnter:
if DBGrid1.Columns[DBGrid1.SelectedIndex].Field = Campo then DBCheckbox1.Visible := True else DBCheckBox1.Visible :=False;
E por fim, no evento OnKeyPress:
if DBCheckBox1.Visible and (Ord(Key) > 31) then begin Key :=#0; Table1.Edit; DBCheckBox1.Checked := not DBCheckBox1.Checked; DBCheckBox1.Field.AsBoolean := DBCheckBox1.Checked; end;
Gostei + 0
27/08/2003
Valdir.santos
Abraços
Valdir.
Gostei + 0
27/08/2003
Fcremm
http://www.scalabium.com/smdbgrid.htm
Gostei + 0
27/08/2003
Marcelo.c
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)