迷
迷惘的人
Unregistered / Unconfirmed
GUEST, unregistred user!
unit ComboListBox;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,ExtCtrls;
type
TComboListBox = class(TComboBox)
private
{ Private declarations }
AutoListbox:TListbox;
mouseclick:boolean;
procedure listboxclick(sender:TObject);
protected
{ Protected declarations }
procedure Change;override;
public
{ Public declarations }
published
{ Published declarations }
//property left stored true;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Standard', [TComboListBox]);
end;
procedure TCombolistbox.listboxclick(sender:TObject);
begin
text:=AutoListbox.items[AutoListbox.itemIndex];
autolistbox.free;
mouseclick:=true;
end;
procedure TCombolistbox.Change;
var
i:integer;
begin
inherited;
if not mouseclick then
begin
if not assigned(Autolistbox) then
begin
AutoListbox:=TListbox.create(self);
AutoListbox.parent:=TWincontrol(self.Owner);
Autolistbox.top:=top+height;
Autolistbox.left:=left;
AutoListbox.width:=Width;
Autolistbox.height:=60;
Autolistbox.OnClick:=listboxClick;
mouseclick:=false;
end;
Autolistbox.items.clear;
for i:=0 to self.items.count-1 do
begin
if pos(self.text,self.items)>0 then
Autolistbox.Items.add(self.items);
//Autolistbox.Refresh;
end;
Autolistbox.sorted:=true;
end;
end;
end.
望高手们指点,谢谢。
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,ExtCtrls;
type
TComboListBox = class(TComboBox)
private
{ Private declarations }
AutoListbox:TListbox;
mouseclick:boolean;
procedure listboxclick(sender:TObject);
protected
{ Protected declarations }
procedure Change;override;
public
{ Public declarations }
published
{ Published declarations }
//property left stored true;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Standard', [TComboListBox]);
end;
procedure TCombolistbox.listboxclick(sender:TObject);
begin
text:=AutoListbox.items[AutoListbox.itemIndex];
autolistbox.free;
mouseclick:=true;
end;
procedure TCombolistbox.Change;
var
i:integer;
begin
inherited;
if not mouseclick then
begin
if not assigned(Autolistbox) then
begin
AutoListbox:=TListbox.create(self);
AutoListbox.parent:=TWincontrol(self.Owner);
Autolistbox.top:=top+height;
Autolistbox.left:=left;
AutoListbox.width:=Width;
Autolistbox.height:=60;
Autolistbox.OnClick:=listboxClick;
mouseclick:=false;
end;
Autolistbox.items.clear;
for i:=0 to self.items.count-1 do
begin
if pos(self.text,self.items)>0 then
Autolistbox.Items.add(self.items);
//Autolistbox.Refresh;
end;
Autolistbox.sorted:=true;
end;
end;
end.
望高手们指点,谢谢。