南
南腔北调
Unregistered / Unconfirmed
GUEST, unregistred user!
unit CHOPCombobox;
interface
uses
SysUtils, Classes, Controls, StdCtrls,Forms,messages,CHManageDBConn,shareproc,
CustomDataClass;
type
TComboBoxTest = class(TComboBox)
private
{ Private declarations }
protected
{ Protected declarations }
public
procedure CreateWnd;override;
destructor Destroy; override;
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('CHGroupware', [TComboBoxTest]);
end;
{ TComboBoxTest }
procedure TComboBoxTest.CreateWnd;
var cid:tid;
begin
inherited;
if not (csDesigning in ComponentState) then
begin
cid:=tid.Create;
cid.id:=1;
items.AddObject('bbbbbbbb',cid);
cid:=tid.Create;
cid.id:=2;
items.AddObject('aaaaaaa',cid);
cid:=tid.Create;
cid.id:=3;
items.AddObject('ccccc',cid);
end;
end;
destructor TComboBoxTest.Destroy;
var
i:integer;
ftid:tid;
begin
if not (csDesigning in ComponentState) then
begin
for i:=0 to items.Count-1 do
begin
if items.Objects<>nil then
if items.Objects is tid then
begin
ftid:=(items.Objects as tid);
items.Objects:=nil;
ftid.Free;
end;
end;
end;
inherited;
end;
interface
uses
SysUtils, Classes, Controls, StdCtrls,Forms,messages,CHManageDBConn,shareproc,
CustomDataClass;
type
TComboBoxTest = class(TComboBox)
private
{ Private declarations }
protected
{ Protected declarations }
public
procedure CreateWnd;override;
destructor Destroy; override;
{ Public declarations }
published
{ Published declarations }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('CHGroupware', [TComboBoxTest]);
end;
{ TComboBoxTest }
procedure TComboBoxTest.CreateWnd;
var cid:tid;
begin
inherited;
if not (csDesigning in ComponentState) then
begin
cid:=tid.Create;
cid.id:=1;
items.AddObject('bbbbbbbb',cid);
cid:=tid.Create;
cid.id:=2;
items.AddObject('aaaaaaa',cid);
cid:=tid.Create;
cid.id:=3;
items.AddObject('ccccc',cid);
end;
end;
destructor TComboBoxTest.Destroy;
var
i:integer;
ftid:tid;
begin
if not (csDesigning in ComponentState) then
begin
for i:=0 to items.Count-1 do
begin
if items.Objects<>nil then
if items.Objects is tid then
begin
ftid:=(items.Objects as tid);
items.Objects:=nil;
ftid.Free;
end;
end;
end;
inherited;
end;