C
conis
Unregistered / Unconfirmed
GUEST, unregistred user!
unit lvCombobox;
interface
uses
SysUtils, Classes, Controls, StdCtrls, Forms, Windows, ComCtrls,Dialogs ;
type
{
TSelectFieldEditer= class(TStringProperty)
function GetAttributes: TPropertyAttributes; override;
procedure GetValues(Proc: TGetStrProc); override;
end;
}
TlvCombobox = class(TCustomComboBox)
private
FExListView: TListView;
protected
procedure DropDown; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetParent(AParent: TWinControl); override;
procedure Loaded; override;
public
constructor Create(AOwner : TComponent); override;
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
published
property Color;
property Constraints;
property Ctl3D;
property BevelEdges;
property BevelInner;
property BevelKind default bkNone;
property BevelOuter;
property Font;
property Text;
property Visible;
property OnChange;
property OnClick;
property OnCloseUp;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnDropDown;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMeasureItem;
property OnSelect;
property OnStartDock;
property OnStartDrag;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('kitop', [TlvCombobox]);
//RegisterPropertyEditor(TypeInfo(string), TlvCombobox, 'SelectField', TSelectFieldEditer);
end;
{ TlvCombobox }
constructor TlvCombobox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FExListView := TListView.Create(self);
FExListView.FreeNotification(self);
FExListView.Width := Width;
end;
procedure TlvCombobox.DropDown;
begin
inherited;
DroppedDown := False;
FExListView.Visible := True;
end;
procedure TlvCombobox.Loaded;
begin
inherited;
end;
procedure TlvCombobox.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (Operation = opRemove) and (AComponent = FExListView) then
FExListView := nil;
end;
procedure TlvCombobox.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
begin
inherited;
if FExListView <> nil then with FExListView do
begin
Top := ATop + AHeight;
Left := ALeft;
Width := AWidth;
Height := 0;
end;
end;
procedure TlvCombobox.SetParent(AParent: TWinControl);
begin
inherited;
FExListView.Parent := AParent;
end;
end.
interface
uses
SysUtils, Classes, Controls, StdCtrls, Forms, Windows, ComCtrls,Dialogs ;
type
{
TSelectFieldEditer= class(TStringProperty)
function GetAttributes: TPropertyAttributes; override;
procedure GetValues(Proc: TGetStrProc); override;
end;
}
TlvCombobox = class(TCustomComboBox)
private
FExListView: TListView;
protected
procedure DropDown; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetParent(AParent: TWinControl); override;
procedure Loaded; override;
public
constructor Create(AOwner : TComponent); override;
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
published
property Color;
property Constraints;
property Ctl3D;
property BevelEdges;
property BevelInner;
property BevelKind default bkNone;
property BevelOuter;
property Font;
property Text;
property Visible;
property OnChange;
property OnClick;
property OnCloseUp;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnDropDown;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMeasureItem;
property OnSelect;
property OnStartDock;
property OnStartDrag;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('kitop', [TlvCombobox]);
//RegisterPropertyEditor(TypeInfo(string), TlvCombobox, 'SelectField', TSelectFieldEditer);
end;
{ TlvCombobox }
constructor TlvCombobox.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FExListView := TListView.Create(self);
FExListView.FreeNotification(self);
FExListView.Width := Width;
end;
procedure TlvCombobox.DropDown;
begin
inherited;
DroppedDown := False;
FExListView.Visible := True;
end;
procedure TlvCombobox.Loaded;
begin
inherited;
end;
procedure TlvCombobox.Notification(AComponent: TComponent;
Operation: TOperation);
begin
inherited;
if (Operation = opRemove) and (AComponent = FExListView) then
FExListView := nil;
end;
procedure TlvCombobox.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
begin
inherited;
if FExListView <> nil then with FExListView do
begin
Top := ATop + AHeight;
Left := ALeft;
Width := AWidth;
Height := 0;
end;
end;
procedure TlvCombobox.SetParent(AParent: TWinControl);
begin
inherited;
FExListView.Parent := AParent;
end;
end.