|
Error en Componente TDBGridPlus
Tengo un componente propio llamado TDBGridPlus descendiente de TDBGrid como se muestra en el código siguiente:
unit DBGridPlus;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Grids, DBGrids, DB;
type
TDBGridPlus = class(TDBGrid)
private
procedure MiDrawDataCell
(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
public
{ Public declarations }
property InplaceEditor;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
implementation
constructor TDBGridPlus.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Self.OnDrawDataCell:=MiDrawDataCell;
end;
procedure TDBGridPlus.MiDrawDataCell
(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
var
Grid : TStringGrid;
Texto : String;
Rectangulo : TRect;
begin
Rectangulo:=Rect;
Grid := TStringGrid(Sender);
if Field.IsBlob
then begin
Grid.Canvas.FillRect(Rect);
Texto := Field.AsString;
DrawText( Grid.Canvas.Handle,
PChar(Texto),
StrLen(PChar(Texto)),
Rectangulo,
DT_WORDBREAK);
end;
end;
destructor TDBGridPlus.Destroy;
begin
inherited Destroy;
end;
end.
Como se ve trato de llamar cierto código nuevo dentro del evento OnDrawDataCell.
Pero no me funciona. No me interesa que el nuevo código funcione (que en este caso muestra un campo memo cualquiera y funciona) sino que se active cuando use el evento OnDrawDataCell. Pero ni siquiera se ejecuta.
Alguna sugerencia ?
Gracias por la información.
__________________
SigmaMan
|