![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
#4
|
|||
|
|||
|
Este es el metodo que lo dibuja el check
procedure TWVentana.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var Check: Integer; R: TRect; XVentana:TRecVentana; begin if Column.FieldName = 'L_SEL_REM' then //indico la columna donde lo quiero poner begin DBGrid1.Canvas.FillRect(Rect);//Rellenas en el drid un rectangulo Check := 0; if FTBVentana.FindField('L_SEL_REM').AsBoolean = true then Check := DFCS_CHECKED; R:=Rect; // InflateRect(R,-2,-2); //Disminuye el tamaño del CheckBox DrawFrameControl(DBGrid1.Canvas.Handle,R,DFC_BUTTON, DFCS_BUTTONCHECK or Check); end; end; y este es el metodo de cambio de estado del check procedure TWventana.DBGrid1CellClick(Column: TColumn); var Xventana:TRecventana; begin FTBVentana.DisableControls; try if Column.FieldName = 'L_SEL_REM' then begin FTBVentana.edit; try if FTBVentana.FieldByName('L_SEL_REM').AsBoolean = true then FTBVentana.FieldByName('L_SEL_REM').AsBoolean := false else FTBVentana.FieldByName('L_SEL_REM').AsBoolean := true finally FTBVentana.Commit; end; Dbgrid1.Refresh; // quizás más bien un Repaint.... pero en fin. end; finally FTBVentana.EnableControls; end; end; entonces si yo pincho con el raton en cualquier parte de la celda donde esta el checkbox me cambia el estado, y solo quiero que me cambie el estado cuando pincho justamente en el checkbox. Gracias |
| Herramientas | Buscar en Tema |
| Desplegado | |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Checkbox en un dbgrid | el_barto | OOP | 7 | 25-08-2005 10:08:21 |
| DBGrid con CheckBox | lgarcia | OOP | 2 | 03-03-2005 22:15:30 |
| DBgrid y Checkbox | santi | Varios | 2 | 24-01-2005 18:25:53 |
| DBGrid y CheckBox | seb@ | OOP | 2 | 17-10-2003 15:04:54 |
| CheckBox en un DBGrid | DJ VMan | MySQL | 4 | 26-06-2003 17:05:26 |
|