tslediter/designer/ctl_mgr/textcompclassmgr.tsf

98 lines
2.3 KiB
Plaintext

type textcompclassmgr=class(tdcreateform)
uses tslvcl;
listbox1:tlistbox;
b_del:tbtn;
b_add:tbtn;
b_ok:tbtn;
statusbar1:tstatusbar;
label1:tlabel;
function Create(AOwner);override; //构造
begin
inherited;
end
function extcompclassmgr_close(o;e);virtual;
begin
{**
@explan(说明) 主窗口关闭回调 %%
@param(e)(tuievent) 消息对象 %%
@param(o)(ttimer) 当前主窗口 %%
**}
e.skip:= true;
Visible := false;
inherited;
end
function b_ok_clk(o;e);virtual;
begin
Visible := false;
end
function b_del_clk(o;e);virtual;
begin
idx := listbox1.ItemIndex;
if idx>=0 and parent then
begin
p := parent;
p.delexttypeclass(listbox1.getItemText(idx));
relisttypeclass();
end
end
function b_add_clk(o;e);virtual;
begin
if not fadder then
begin
fadder := new textcompclassadder(self);
fadder.Visible := false;
fadder.parent := self;
fadder.Left := left-10;
fadder.top := top-10;
end
fadder.classhash := ftypelist;
if fadder.ShowModal() then
begin
//echo tostn(fadder.getreginfo());
p := parent;
if p then
begin
p.addexttypeclass(fadder.getreginfo());
end
relisttypeclass();
end
end
function relisttypeclass();
begin
p := parent;
if p then
begin
ts := p.getexttypeclass();
r := array();
idx := 0;
for i,v in ts do
begin
r[idx++] := v.dclassname();
end
if r<>ftypelist then
begin
listbox1.Items := r;
ftypelist := r;
end
end
end
function showmgr();
begin
relisttypeclass();
show();
end
function listbox1_sel(o;e);virtual;
begin
idx := o.ItemIndex;
if idx>=0 then
begin
b_del.Enabled := true;
end
end
[weakref]fdesginer;
ftypelist;
end