cxdbextlookupcombobox.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 969 行 · 第 1/3 页
PAS
969 行
{********************************************************************}
{ }
{ Developer Express Visual Component Library }
{ ExpressQuantumGrid }
{ }
{ Copyright (c) 1998-2008 Developer Express Inc. }
{ ALL RIGHTS RESERVED }
{ }
{ The entire contents of this file is protected by U.S. and }
{ International Copyright Laws. Unauthorized reproduction, }
{ reverse-engineering, and distribution of all or any portion of }
{ the code contained in this file is strictly prohibited and may }
{ result in severe civil and criminal penalties and will be }
{ prosecuted to the maximum extent possible under the law. }
{ }
{ RESTRICTIONS }
{ }
{ THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES }
{ (DCU, OBJ, DLL, ETC.) ARE CONFIDENTIAL AND PROPRIETARY TRADE }
{ SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS }
{ LICENSED TO DISTRIBUTE THE EXPRESSQUANTUMGRID AND ALL }
{ ACCOMPANYING VCL CONTROLS AS PART OF AN EXECUTABLE PROGRAM ONLY. }
{ }
{ THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED }
{ FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE }
{ COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE }
{ AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT }
{ AND PERMISSION FROM DEVELOPER EXPRESS INC. }
{ }
{ CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON }
{ ADDITIONAL RESTRICTIONS. }
{ }
{********************************************************************}
unit cxDBExtLookupComboBox;
{$I cxVer.inc}
interface
uses
{$IFDEF DELPHI6}
Variants,
{$ENDIF}
Windows, Classes, Controls, DB, Graphics, Messages, SysUtils, cxClasses,
cxContainer, cxControls, cxCustomData, cxDB, cxDBData, cxDBEdit,
cxDBLookupEdit, cxEditConsts, cxGrid, cxGridCustomTableView, cxEdit,
cxGridCustomView, cxGridStrs, cxGridTableView, cxLookAndFeels, cxLookupEdit;
type
{ TcxExtLookupGrid }
TcxExtLookupGrid = class(TcxGrid)
private
FEditable: Boolean;
FMousePos: TPoint;
FPopupMouseMoveLocked: Boolean;
FPrevOnKeyDown: TKeyEvent;
FPrevOnMouseDown: TMouseEvent;
FPrevOnMouseMove: TMouseMoveEvent;
FPrevOnMouseUp: TMouseEvent;
FRowPressed: Boolean;
FOnCloseUp: TcxLookupGridCloseUpEvent;
function GetView: TcxCustomGridTableView;
procedure ViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ViewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure ViewMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
protected
procedure DoCancelMode; override;
procedure DoCloseUp(AAccept: Boolean); virtual;
function IsDataRow(AHitTest: TcxCustomGridHitTest): Boolean;
property Editable: Boolean read FEditable write FEditable;
property PopupMouseMoveLocked: Boolean read FPopupMouseMoveLocked write FPopupMouseMoveLocked;
property OnCloseUp: TcxLookupGridCloseUpEvent read FOnCloseUp write FOnCloseUp;
public
property View: TcxCustomGridTableView read GetView;
end;
{ TcxCustomExtLookupComboBoxProperties }
TcxCustomExtLookupComboBoxProperties = class(TcxCustomDBLookupEditProperties);
{ TcxExtLookupComboBoxProperties }
TcxExtLookupComboBoxProperties = class(TcxCustomExtLookupComboBoxProperties)
private
FAutoSearchOnPopup: Boolean;
FDestroying: Boolean;
FFocusPopup: Boolean;
FGrid: TcxExtLookupGrid;
FInCheckListFieldItem: Boolean;
FListFieldItem: TcxCustomGridTableItem;
FPrevColumnFiltering: Boolean;
FPrevPullFocusing: Boolean;
FPrevImmediateEditor: Boolean;
FPrevIncSearch: Boolean;
FPrevMultiSelect: Boolean;
FView: TcxCustomGridTableView;
function GetGrid: TcxExtLookupGrid;
function GetGridMode: Boolean;
function GetListFieldIndex: Integer;
function GetListFieldItem: TcxCustomGridTableItem;
procedure SetGridMode(Value: Boolean);
procedure SetListFieldItem(Value: TcxCustomGridTableItem);
procedure SetView(Value: TcxCustomGridTableView);
protected
procedure CheckListFieldItem;
procedure DeinitializeDataController; override;
procedure FreeNotification(Sender: TComponent); override;
function GetIncrementalFiltering: Boolean; override;
function GetListIndex: Integer; override;
procedure InitializeDataController; override;
procedure LinkView(AView: TcxCustomGridTableView);
function PopupWindowCapturesFocus: Boolean; override;
procedure UnlinkView(AView: TcxCustomGridTableView);
// LookupGrid methods
function GetLookupGridActiveControl: TWinControl; override;
function GetLookupGridCanResize: Boolean; override;
function GetLookupGridColumnCount: Integer; override;
function GetLookupGridControl: TWinControl; override;
function GetLookupGridDataController: TcxCustomDataController; override;
function GetLookupGridVisualAreaPreferredWidth: Integer; override;
function GetLookupGridNearestPopupHeight(AHeight: Integer): Integer; override;
function GetLookupGridPopupHeight(ADropDownRowCount: Integer): Integer; override;
function IsLookupGridMouseOverList(const P: TPoint): Boolean; override;
procedure LookupGridDeinitialize; override;
procedure LookupGridDroppedDown(const AFindStr: string); override;
procedure LookupGridInitEvents(AOnClick, AOnFocusedRowChanged: TNotifyEvent;
AOnCloseUp: TcxLookupGridCloseUpEvent); override;
procedure LookupGridInitialize; override;
procedure LookupGridInitLookAndFeel(ALookAndFeel: TcxLookAndFeel;
AColor: TColor; AFont: TFont); override;
procedure LookupGridLockMouseMove; override;
procedure LookupGridMakeFocusedRowVisible; override;
procedure LookupGridUnlockMouseMove; override;
// DBLookupGrid methods
procedure DBLookupGridBeginUpdate; override;
procedure DBLookupGridCheckColumnByFieldName(const AFieldName: string); override;
procedure DBLookupGridCreateColumnsByFieldNames(const AFieldNames: string); override;
procedure DBLookupGridEndUpdate; override;
function GetDBLookupGridColumnField(AIndex: Integer): TField; override;
function GetDBLookupGridColumnFieldName(AIndex: Integer): string; override;
function GetDBLookupGridColumnIndexByFieldName(const AFieldName: string): Integer; override;
function GetDBLookupGridDataController: TcxDBDataController; override;
public
constructor Create(AOwner: TPersistent); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
class function GetContainerClass: TcxContainerClass; override;
class function IsViewSupported(Value: TcxCustomGridTableView): Boolean;
property Grid: TcxExtLookupGrid read GetGrid;
property ListFieldIndex: Integer read GetListFieldIndex;
published
property Alignment;
property AssignedValues;
property AutoSearchOnPopup: Boolean read FAutoSearchOnPopup write FAutoSearchOnPopup default True;
property AutoSelect;
property ButtonGlyph;
property CaseSensitiveSearch;
property CharCase;
property ClearKey;
property DropDownAutoSize;
property DropDownHeight;
property DropDownListStyle;
property DropDownRows;
property DropDownSizeable;
property DropDownWidth;
property FocusPopup: Boolean read FFocusPopup write FFocusPopup default False;
property GridMode: Boolean read GetGridMode write SetGridMode default False;
property HideSelection;
property ImeMode;
property ImeName;
property ImmediateDropDown;
property ImmediatePost;
property IncrementalFiltering;
property View: TcxCustomGridTableView read FView write SetView; // before
property KeyFieldNames;
property ListFieldItem: TcxCustomGridTableItem read GetListFieldItem write SetListFieldItem;
property MaxLength;
property OEMConvert;
property PopupAlignment;
property PostPopupValueOnTab;
property ReadOnly;
property Revertable;
property UseLeftAlignmentOnEditing;
property ValidateOnEnter;
property OnChange;
property OnCloseUp;
property OnEditValueChanged;
property OnInitPopup;
property OnNewLookupDisplayText;
property OnPopup;
property OnValidate;
end;
{ TcxCustomExtLookupComboBox }
TcxCustomExtLookupComboBox = class(TcxCustomDBLookupEdit)
private
function GetActiveProperties: TcxExtLookupComboBoxProperties;
function GetProperties: TcxExtLookupComboBoxProperties;
procedure SetProperties(Value: TcxExtLookupComboBoxProperties);
protected
function CanDropDown: Boolean; override;
public
class function GetPropertiesClass: TcxCustomEditPropertiesClass; override;
property ActiveProperties: TcxExtLookupComboBoxProperties
read GetActiveProperties;
property EditValue;
property Properties: TcxExtLookupComboBoxProperties read GetProperties
write SetProperties;
property Text;
end;
{ TcxExtLookupComboBox }
TcxExtLookupComboBox = class(TcxCustomExtLookupComboBox)
published
property Anchors;
property AutoSize;
property BeepOnEnter;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property ImeMode;
property ImeName;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property Properties;
property EditValue;
property ShowHint;
property Style;
property StyleDisabled;
property StyleFocused;
property StyleHot;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnEditing;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
{ TcxDBExtLookupComboBox }
TcxDBExtLookupComboBox = class(TcxCustomExtLookupComboBox)
private
function GetDataBinding: TcxDBTextEditDataBinding;
procedure SetDataBinding(Value: TcxDBTextEditDataBinding);
procedure CMGetDataLink(var Message: TMessage); message CM_GETDATALINK;
protected
class function GetDataBindingClass: TcxEditDataBindingClass; override;
published
property Anchors;
property AutoSize;
property BeepOnEnter;
property Constraints;
property DragCursor;
property DragKind;
property DataBinding: TcxDBTextEditDataBinding read GetDataBinding
write SetDataBinding;
property DragMode;
property Enabled;
property ImeMode;
property ImeName;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property Properties;
property ShowHint;
property Style;
property StyleDisabled;
property StyleFocused;
property StyleHot;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnEditing;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
end;
{ TcxEditRepositoryExtLookupComboBoxItem }
TcxEditRepositoryExtLookupComboBoxItem = class(TcxEditRepositoryItem)
private
function GetProperties: TcxExtLookupComboBoxProperties;
procedure SetProperties(Value: TcxExtLookupComboBoxProperties);
public
class function GetEditPropertiesClass: TcxCustomEditPropertiesClass; override;
published
property Properties: TcxExtLookupComboBoxProperties read GetProperties write SetProperties;
end;
implementation
uses
cxGridFilterHelpers;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?