home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
borland
/
cb
/
setup
/
cbuilder
/
data.z
/
DBLOOKUP.INT
< prev
next >
Wrap
Text File
|
1997-02-28
|
6KB
|
193 lines
{*******************************************************}
{ }
{ Delphi Visual Component Library }
{ }
{ Copyright (c) 1995,96 Borland International }
{ }
{*******************************************************}
unit DBLookup;
{$R-}
interface
uses Windows, Classes, StdCtrls, DB, Controls, Messages, SysUtils,
Forms, Graphics, Menus, Buttons, DBGrids, DBTables, Grids;
type
{ TDBLookupCombo }
TPopupGrid = class;
TDBLookupComboStyle = (csDropDown, csDropDownList);
TDBLookupListOption = (loColLines, loRowLines, loTitles);
TDBLookupListOptions = set of TDBLookupListOption;
TDBLookupCombo = class(TCustomEdit)
protected
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure Change; override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure GridClick (Sender: TObject);
procedure Loaded; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DropDown; dynamic;
procedure CloseUp; dynamic;
property Value: string;
property DisplayValue: string;
published
property DataField: string;
property DataSource: TDataSource;
property LookupSource: TDataSource;
property LookupDisplay: string;
property LookupField: string;
property Options: TDBLookupListOptions default [];
property Style: TDBLookupComboStyle default csDropDown;
property AutoSelect;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property DropDownCount: Integer default 8;
property DropDownWidth: Integer default 0;
property Enabled;
property Font;
property ImeMode;
property ImeName;
property MaxLength;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly: Boolean default False;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnChange;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDropDown: TNotifyEvent;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
{ TDBLookupList }
TDBLookupList = class(TCustomDBGrid)
protected
function HighlightCell(DataCol, DataRow: Integer; const Value: string;
AState: TGridDrawState): Boolean; override;
function CanGridAcceptKey(Key: Word; Shift: TShiftState): Boolean; override;
procedure DefineFieldMap; override;
procedure SetColumnAttributes; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
function CanEdit: Boolean; virtual;
procedure InitFields(ShowError: Boolean);
procedure CreateWnd; override;
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
procedure LinkActive(Value: Boolean); override;
procedure Paint; override;
procedure Scroll(Distance: Integer); override;
procedure ListClick; dynamic;
procedure Loaded; override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Value: string;
property DisplayValue: string;
published
property DataField: string;
property DataSource: TDataSource;
property LookupSource: TDataSource;
property LookupDisplay: string;
property LookupField: string;
property Options: TDBLookupListOptions default [];
property OnClick: TNotifyEvent;
property ReadOnly: Boolean default False;
property Align;
property BorderStyle;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property Font;
property ImeMode;
property ImeName;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnStartDrag;
end;
{ TPopupGrid }
TPopupGrid = class(TDBLookupList)
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
function CanEdit: Boolean; override;
procedure LinkActive(Value: Boolean); override;
public
property RowCount;
constructor Create(AOwner: TComponent); override;
end;
{ TComboButton }
TComboButton = class(TSpeedButton)
protected
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
end;
implementation