Ver Mensaje Individual
  #1  
Antiguo 05-09-2007
mcalmanovici mcalmanovici is offline
Miembro
 
Registrado: jun 2006
Posts: 78
Reputación: 18
mcalmanovici Va por buen camino
Genero comboBox en dbgrid y cuando hago dos veces click desaparece el comboBox.

Hola gente:
Sé que hay muchos hilos con respecto a comboBox y dbgrid, es más los estuve mirando todos pero nada me dice en cuanto al problema que se me está presentando.
Este es el código Delphi que ejecuto:

Código Delphi [-]
procedure TwMain.DBGrid4CellClick(Column: TColumn);
begin
if Column.FieldName = 'administrador' then
begin
CDSAbmUsuario.Edit;
if CDSAbmUsuario.FindField('administrador').AsString = 'S' then
CDSAbmUsuario.FindField('administrador').AsString := 'N'
else
CDSAbmUsuario.FindField('administrador').AsString := 'S';
CDSAbmUsuario.Post;
Dbgrid4.Repaint;
end;
end;

procedure TwMain.DBGrid4DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
Check: Integer;
R: TRect;
begin
if Column.FieldName = 'administrador' then 
begin
DBGrid1.Canvas.FillRect(Rect);
Check := 0;
if CDSAbmUsuario.FindField('administrador').AsString = 'S' then
Check := DFCS_CHECKED; 
R:=Rect;
InflateRect(R,-2,-2); 
DrawFrameControl(DBGrid4.Canvas.Handle,R,DFC_BUTTON, DFCS_BUTTONCHECK or Check);
end;
end;

Me esta andando bastante bien el comboBox en el dbgrid...
El problema es el siguiente: hago click en el comboBox y me anda perfecto, ahora cuando vuelvo a hacer click en el mismo registro sin irme a otro desaparece el comboBox (no me refiero a hacer doble click sino a hacer un click y me cambia el tilde, ahora cuando vuelvo a hacer click me desaparece el comboBox). Para que aparezca me tengo que ir a otro registro del dbgrid.....
No sé si a alguien le paso esto o tiene alguna solución para este problema...

Desde ya agradezco sus repuestas.

Muchas gracias.
Mariano.
Responder Con Cita