tslediter/designer/ctl_mgr/t_editor_config.tsf

89 lines
2.3 KiB
Plaintext

type t_editor_config=class(tdcreateform)
uses tslvcl;
gb_format:tgroupbox;
lb_align:tlabel;
ck_align:tcheckbtn;
lb_array:tlabel;
cb_array:tcombobox;
lb_syn:tlabel;
ck_syn:tcheckbtn;
lb_select:tlabel;
ck_sel:tcheckbtn;
gb_tips:tgroupbox;
lb1:tlabel;
sp_i:tspinedit;
lb2:tlabel;
ck_case:tcheckbtn;
lb3:tlabel;
lb4:tlabel;
panel1:tpanel;
bt_ok:tbtn;
bt_cancel:tbtn;
label1:tlabel;
label2:tlabel;
ck_first:tcheckbtn;
function Create(AOwner);override; //构造
begin
inherited;
end
function editor_config_close(o;e);
begin
e.skip := true;
o.Visible := false;
end
function bt_cancel_clk(o;e);
begin
o.Visible := false;
//calldatafunction(foncancel_clk,self,e);
end
function bt_ok_clk(o;e);
begin
calldatafunction(OnOkClicked,self,e);
end
function getdata();
begin
r := array();
r["cmt"]:= ck_align.Checked;
r["arraytype"]:= array("普通":1,"默认":0,"宽松":3)[cb_array.getCurrentItemText()];
r["syn"]:= ck_syn.checked;
r["sel"]:= ck_sel.checked;
r["matchidx"] := sp_i.value;
r["matchfirst"] := ck_first.Checked;
r["case"] := ck_case.Checked;
return r;
end
function setdata(d);
begin
if ifarray(d) then
begin
ck_align.Checked := (d["cmt"]=1);
cb_array.ItemIndex := (array(0:0,1:1,3:2))[d["arraytype"]];
ck_syn.Checked := d["syn"];
ck_sel.Checked := d["sel"];
sp_i.value := d["matchidx"];
ck_case.Checked := (d["case"]=1);
ck_first.Checked := (d["matchfirst"]=1);
end
end
function DoControlAlign();override;//对齐子控件
begin
//当窗口大小改变时,该函数会被调用,
//可以通过 clientrect 获取客户区大小,设置子控件的位置以及大小
//如果自己处理了子控件的对齐,就可以去掉 inherited
inherited;
end
function Recycling();override; //回收变量
begin
inherited;
ci := self.classinfo(); //将成员变量赋值为nil避免循环引用
for i,v in ci["members"] do
begin
if v["const"] then continue;
if v["static"] then continue;
invoke(self,v["name"],nil);
end
end
[weakref]OnOkClicked;
end