📄 wwdbdlg.pas
字号:
unit Wwdbdlg;
{
//
// Components : TwwDBLookupDlg
//
// Copyright (c) 1995-2001 by Woll2Woll Software
//
// 9/19/97 - AutoDropDown with ShowMatchText should copy only selected text
//
// 10/7/97 - Check for active after OnDropDown is called
//
// 5/12/98 - check for active lookuptable before calling resync
// 5/28/98 - Restore original text before dialog opened
// 1/4/99 - Set InList if ok clicked from dialog
// 2/10/99 - Add PictureMaskFromField property for Delphi 4
// 12/8/02 - Update text in IswwCalculatedpath to fix problem
// when storedvalue and displayvalue are the same even
// though storedfield and displayed field are different fields.
// 8/16/04 - Respect AutoEdit=false
}
interface
{$i wwIfDef.pas}
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls, Buttons,
Forms, Dialogs, StdCtrls, wwdblook, dbTables, wwiDlg, db,
Wwdbgrid, wwTable, menus, wwdbigrd, wwstr, wwcommon, wwframe;
type
TwwDBLookupComboDlg = class(TwwDBCustomLookupCombo)
private
FGridOptions: TwwDBGridOptions;
FGridColor: TColor;
FGridTitleAlignment: TAlignment;
FOptions : TwwDBLookupDlgOptions;
FCaption: String;
FMaxWidth, FMaxHeight: integer;
FUserButton1Click: TwwUserButtonEvent;
FUserButton2Click: TwwUserButtonEvent;
FUserButton1Caption: string;
FUserButton2Caption: string;
FOnInitDialog: TwwOnInitDialogEvent;
FOnCloseDialog: TwwOnInitDialogEvent;
FOnSortChange: TNotifyEvent;
{$ifdef wwDelphi4Up}
FPictureMaskFromField: boolean;
{$endif}
FControlType: TStrings;
FControlInfoInDataset: boolean;
FPictureMasks: TStrings;
FPictureMaskFromDataSet: boolean;
procedure SetPictureMasks(val: TStrings);
procedure SetControlType(val: TStrings);
procedure SetOptions(sel: TwwDBLookupDlgOptions);
procedure SetGridOptions(sel: TwwDBGridOptions);
protected
// Function LoadComboGlyph: HBitmap; override;
// Procedure DrawButton(Canvas: TCanvas; R: TRect; State: TButtonState;
// ControlState: TControlState; var DefaultPaint: boolean); override;
Function IsLookupDlg: boolean; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure DropDown; override;
published
property Controller;
property DisableThemes;
{$ifdef wwDelphi4Up}
property Anchors;
property BiDiMode;
property Constraints;
property ParentBiDiMode;
property PictureMaskFromField: boolean read FPictureMaskFromField write FPictureMaskFromField default False;
{$endif}
property ControlType : TStrings read FControlType write SetControlType;
property ControlInfoInDataset: boolean
read FControlInfoInDataset write FControlInfoInDataSet default True;
property PictureMaskFromDataset: boolean
read FPictureMaskFromDataset write FPictureMaskFromDataSet default True;
property PictureMasks: TStrings read FPictureMasks write SetPictureMasks;
property Options: TwwDBLookupDlgOptions read FOptions write SetOptions
default [opShowOKCancel, opShowSearchBy];
property GridOptions: TwwDBGridOptions read FGridOptions write SetGridOptions
default [dgEditing, dgTitles, dgIndicator, dgColumnResize, dgColLines,
dgRowLines, dgTabs, dgConfirmDelete, dgPerfectRowFit];
property GridColor: TColor read FGridColor write FGridColor;
property GridTitleAlignment: TAlignment read FGridTitleAlignment write FGridTitleAlignment;
property Caption : String read FCaption write FCaption;
property MaxWidth : integer read FMaxWidth write FMaxWidth;
property MaxHeight : integer read FMaxHeight write FMaxHeight;
property UserButton1Caption: string read FUserButton1Caption write FUserButton1Caption;
property UserButton2Caption: string read FUserButton2Caption write FUserButton2Caption;
property OnUserButton1Click: TwwUserButtonEvent read FUserButton1Click write FUserButton1Click;
property OnUserButton2Click: TwwUserButtonEvent read FUserButton2Click write FUserButton2Click;
property OnInitDialog: TwwOnInitDialogEvent read FOnInitDialog write FOnInitDialog;
property OnCloseDialog: TwwOnInitDialogEvent read FOnCloseDialog write FOnCloseDialog;
property OnSortChange: TNotifyEvent read FOnSortChange write FOnSortChange;
property Picture;
property SearchDelay;
property Selected;
property DataField;
property DataSource;
property LookupTable;
property LookupField;
property SeqSearchOptions;
property Style;
property AutoSelect;
property Color;
property DragCursor;
property DragMode;
property Enabled;
property ButtonStyle default cbsEllipsis;
property ButtonEffects;
property ButtonWidth;
property ButtonGlyph;
property Frame;
{$ifdef wwDelphi3Up}
property ImeMode;
property ImeName;
{$endif}
property MaxLength;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property AutoDropDown;
property ShowButton;
property OrderByDisplay;
property AllowClearKey;
property UseTFields;
// property UnboundAlignment;
property ShowMatchText;
property OnChange;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDropDown;
property OnCloseUp;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnPerformCustomSearch;
end;
procedure Register;
implementation
uses wwlocate;
constructor TwwDBLookupComboDlg.Create(AOwner: TComponent);
begin
inherited create(AOwner);
ButtonStyle:= cbsEllipsis;
FGridOptions := [dgTitles, dgIndicator, dgColumnResize, dgRowSelect,
dgColLines, dgRowLines, dgTabs, dgAlwaysShowSelection, dgConfirmDelete,
dgPerfectRowFit];
FGridColor:= clWhite;
FGridTitleAlignment:= taLeftJustify;
FOptions:= [opShowOKCancel, opShowSearchBy];
FCaption:= 'Lookup';
FMaxHeight:= 209;
FGrid.SkipDataChange:= True;
FControlType:= TStringList.create;
FControlInfoInDataset:= True;
FPictureMasks:= TStringList.create;
FPictureMaskFromDataSet:= True;
end;
destructor TwwDBLookupComboDlg.Destroy;
begin
FControlType.Free;
FPictureMasks.Free;
inherited Destroy;
end;
(*
Procedure TwwDBLookupComboDlg.DrawButton(Canvas: TCanvas; R: TRect; State: TButtonState;
ControlState: TControlState; var DefaultPaint: boolean);
var Transparent: boolean;
begin
{$ifdef win32}
DefaultPaint:= False;
Transparent:= FButton.Flat and
(not FMouseInButtonControl) and not (FFocused);
// Transparent:= FButton.Flat and
// (not FMouseInButtonControl) and (not Focused);
wwDrawEllipsis(Canvas, R, State, Enabled, Transparent,
ButtonEffects.Transparent and ButtonEffects.Flat,
// ButtonEffects.Transparent,
ControlState)
// wwDrawEllipsis(Canvas, R, State, Enabled, ControlState)
{$endif}
end;
*)
//Function TwwDBLookupComboDlg.LoadComboGlyph: HBitmap; { Win95 }
//begin
// if FlatButton then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -