Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #5  
Antiguo 16-08-2012
CSIE CSIE is offline
Miembro
 
Registrado: feb 2008
Ubicación: Universo paralelo
Posts: 69
Poder: 19
CSIE Va por buen camino
Hola,

En este procedimiento lo que determinas es el tipo de control que TKDBGrid va ha utilizar para editar los datos. Si te fijas en el demo verás:


Código Delphi [-]
procedure TMainForm.DBGridEditorCreate(Sender: TObject; ACol, ARow: Integer;
  var AEditor: TWinControl);
begin
  // you have still full control about the inplace editor but
  // here we just use the default handling
  // (if you delete this event the same is used in TKDBGridCell)
  DBGrid.DefaultEditorCreate(ACol, ARow, AEditor);
  // use default handling for other inplace editor events
end;

Lo que hace aqui es usar el procedimiento por defecto de TKDBGrid, donde asigna el TWinControl a utilizar.


Código Delphi [-]
procedure TKCustomDBGrid.DefaultEditorCreate(ACol, ARow: Integer; var AEditor: TWinControl);
begin
  // create custom editors according to table column type
  if Cols[ACol] is TKDBGridCol then
    case TKDBGridCol(Cols[ACol]).DataType of
      ftString, ftWideString, ftInteger, ftSmallInt, ftWord, ftLargeInt, ftFloat, ftCurrency, ftBcd:
      begin
        AEditor := TEdit.Create(nil);
      end;
      ftMemo
    {$IF DEFINED(FPC) OR DEFINED(COMPILER10_UP)}
      , ftWideMemo
    {$IFEND}
        :
      begin
        AEditor := TMemo.Create(nil);
      end;
      ftDate, ftTime, ftDateTime:
      begin
        AEditor := {$IFDEF FPC}TDateEdit{$ELSE}TDateTimePicker{$ENDIF}.Create(nil);
      end;
      ftBoolean:
      begin
        AEditor := TCheckBox.Create(nil);
      end;
    else
      AEditor := nil;
    end
  else
    AEditor := nil;
end;

Pero utilizando la misma técnica del procedimiento anterior, tu puedes personalizar los controles a utilizar. Por ejemplo si te fijas, cuando el DataType es integer, o string utiliza un TEdit estándard:

Código Delphi [-]
case TKDBGridCol(Cols[ACol]).DataType of
      ftString, ftWideString, ftInteger, ftSmallInt, ftWord, ftLargeInt, ftFloat, ftCurrency, ftBcd:
      begin
        AEditor := TEdit.Create(nil);
      end;

Pero tu podrías mejorarlo usando controles específicos para datos numéricos o de texto o memos.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Como interpretar WM_KEYDOWN casacham OOP 3 14-04-2009 09:32:00
Interpretar achivos dwg (CAD) Val Gráficos 1 16-01-2008 06:56:14
como interpretar un error FGarcia Varios 4 03-01-2008 01:13:09
Interpretar SQL juanpe Firebird e Interbase 4 11-07-2007 10:07:58
Interpretar ficheros XSD kes Conexión con bases de datos 0 20-01-2005 12:16:37


La franja horaria es GMT +2. Ahora son las 16:51:55.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi