Class TEDBGrid (unit Dbgrid)

Inherits from

TDBGrid

Enhanced DBGrid V1.06 - released September 18, 1997 Disclaimer: This is a Freeware component. Use it at your own risk. You can send any comments, suggestions and bugs to demian@bhnet.com.br New versions can be found at: http://www.bhnet.com.br/~demian http://web.unix.horizontes.com.br/~demian If you do any modification to this code, please send me a copy. If you use this code on any 'real-life' application, please let me know. If you think this code is completely useless, please DON'T LET ME KNOW! What it does: DBGrid descendent with support for embedded objects. Also publishs Col/Row properties and OnMouseDown/OnMouseMove/OnMouseUp events. How to use it (a sample for embedding a TComboBox)): 1. Install the component [VNM Pallete]; 2. Drop one TEDBGrid and one TTable onto a form; 3. Drop one TComboBox onto the TEDBGrid component 4. Double click the TTable, define a new calculated string field, name it 'ComboBox1'; Notice: - To disable/enable object drawing set the public property ObjEnabled to true/false; - Each embedded object must have a corresponding Calculated Field; - As default the object size and position will be the same of the current grid cell (ideal for TCustomEdit descendents). If you don't want the object size to be adjusted (if the object is a TDBMemo, for example), set the object Tag property to a value other than 0; - See 'My Defaults' comment in the Create method. History: 1.06 - fixed OnMouseDown bug; 1.05 - fixed persistent columns bug (Delphi 2 only); 1.04 - Eliminated the ColObjects property and implemented objects dropping onto the grid component; - Altered objects displaying (now they are showed only when the user press a key or click the mouse over the embedded object grid cell); - fixed navigational problems when exiting an embedded object. 1.03 - Fixed calculated fields navigational problems; 1.02 - Fixed TDBCustomGrid memory leak (Delphi 1 only); 1.01 - Published events OnMouseDown and OnMouseUp for dragging suport; - Fixed typo 'Miscelan' in Uses clause; 1.00 - Created;

Constructors


constructor Create(AOwner:TComponent);

______________________________________________________________________________


Functions

destructor Destroy;

______________________________________________________________________________

procedure DrawColumnCell(const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);

______________________________________________________________________________} {$ifdef WIN32

procedure KeyPress(var Key: Char);

______________________________________________________________________________

procedure Loaded;

______________________________________________________________________________

procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer);

______________________________________________________________________________

procedure SetColumnAttributes;

______________________________________________________________________________

function GetObjIndex (const GridIndex: integer): integer;

______________________________________________________________________________

procedure WMGetDlgCode(var Msg: TWMGetDlgCode);

______________________________________________________________________________

procedure WMSetFocus(var Msg: TWMSetFocus);

______________________________________________________________________________

Properties

property Col :


property Row :


Events

event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


Variables

ObjEnabled : boolean;


ColumnHasObj : boolean;


FOnMouseDown : TMouseEvent;


GridObjs : TList;


iCurrentObj : integer;


ShowObject : boolean;



Constructors


constructor Create(AOwner:TComponent);

______________________________________________________________________________


Functions


destructor Destroy;

______________________________________________________________________________


procedure DrawColumnCell(const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);

______________________________________________________________________________} {$ifdef WIN32


procedure KeyPress(var Key: Char);

______________________________________________________________________________


procedure Loaded;

______________________________________________________________________________


procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer);

______________________________________________________________________________


procedure SetColumnAttributes;

______________________________________________________________________________


function GetObjIndex (const GridIndex: integer): integer;

______________________________________________________________________________


procedure WMGetDlgCode(var Msg: TWMGetDlgCode);

______________________________________________________________________________


procedure WMSetFocus(var Msg: TWMSetFocus);

______________________________________________________________________________


Properties


property Col :


property Row :


Events


event OnMouseDown :


event OnMouseMove :


event OnMouseUp :


Variables


ObjEnabled : boolean;


ColumnHasObj : boolean;


FOnMouseDown : TMouseEvent;


GridObjs : TList;


iCurrentObj : integer;


ShowObject : boolean;