?? umycontrol.pas
字號:
unit uMyControl;
interface
uses
SysUtils, StdCtrls, Controls, Classes, Variants, DBCtrlsEh, ToolCtrlsEh;
type
TGISCombo = class(TCustomDBComboBoxEh)
private
FAccept: Boolean;
FListVisible: Boolean;
ItemIndex: Integer;
FItemIndex: Integer;
FAutoValue: Boolean;
FCtl3D: Boolean;
procedure SetItemIndex(const Value: Integer);
procedure SetCtl3D(const Value: Boolean);
protected
procedure InternalSetItemIndex(const Value: Integer); override;
procedure CloseUp(Accept: Boolean); override;
public
property Color;
property Hint;
property ShowHint;
property OnChange;
property OnClick;
property OnKeyUp;
property AutoValue: Boolean read FAutoValue write FAutoValue default True;
property Ctl3D: Boolean read FCtl3D write SetCtl3D default True;
function GetPopupListboxEx: TWinControl;
constructor Create(AOwner: TComponent); override;
end;
implementation
{ TMyCombo }
procedure TGISCombo.CloseUp(Accept: Boolean);
begin
FAccept := Accept;
inherited;
end;
constructor TGISCombo.Create(AOwner: TComponent);
begin
inherited;
FAutoValue := True;
FCtl3D := True;
FAccept := False;
end;
function TGISCombo.GetPopupListboxEx: TWinControl;
begin
Result := GetPopupListbox;
end;
procedure TGISCombo.InternalSetItemIndex(const Value: Integer);
begin
if FItemIndex <> Value then
begin
GetItemsList;
if (Value >= 0) and (Value < FItemsCount) then
begin
FItemIndex := Value;
if FKeyBased then
FVarValue := KeyItems.Strings[FItemIndex];
end else
begin
FItemIndex := -1;
FVarValue := Null;
end;
UpdateImageIndex;
if FListVisible then
TPopupListboxEh(PopupListbox).ItemIndex := FItemIndex;
if (FItemIndex >= 0) and (AutoValue or FAccept) then
//inherited InternalSetText(Items.Strings[FItemIndex])
EditText := Items.Strings[FItemIndex]
//else inherited InternalSetText('');
end;
end;
procedure TGISCombo.SetCtl3D(const Value: Boolean);
begin
FCtl3D := Value;
TPopupListboxEh(GetPopupListbox).Ctl3D := FCtl3D;
end;
procedure TGISCombo.SetItemIndex(const Value: Integer);
begin
FItemIndex := Value;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -