界面库

优化
This commit is contained in:
JianjunLiu 2022-11-22 15:23:50 +08:00
parent 505a537c09
commit e8ef5109ef
5 changed files with 76 additions and 26 deletions

View File

@ -1153,14 +1153,7 @@ type tcontrol = class(tcomponent)
@explan(说明) 资源回收,子类请override该方法然后在destroy中调用 %% @explan(说明) 资源回收,子类请override该方法然后在destroy中调用 %%
**} **}
FFont := nil; FFont := nil;
FMessagehandle := array(); FMessagehandle := array();
{while true do
begin
ci := FControls.Count;
if ci<1 then break;
cvi := FControls[ci-1];
cvi.SetParent(nil);
end }
FSIDC.deleteid(FID); FSIDC.deleteid(FID);
SetParent(nil); SetParent(nil);
FOnClick := nil; //点击 FOnClick := nil; //点击

View File

@ -2215,10 +2215,6 @@ type TTreeNode=class(TTreeCtlNode)
begin begin
inherited; inherited;
end end
function Destroy();override;
begin
inherited;
end
function moveup();virtual; function moveup();virtual;
begin begin
{** {**
@ -2229,8 +2225,13 @@ type TTreeNode=class(TTreeCtlNode)
if not bf then return false; if not bf then return false;
ndp := parent; ndp := parent;
nd := self(true); nd := self(true);
if ndp then if ndp then
begin begin
ow := Owner;
if ow then //Ëø¶¨Ñ¡Ôñ¸Ä±ä
begin
lk := ow.ExecuteCommand("addlocked",0);
end
ndp.deletenode(nd); ndp.deletenode(nd);
ndp.insertnode(nd,bf); ndp.insertnode(nd,bf);
return true; return true;
@ -2247,6 +2248,11 @@ type TTreeNode=class(TTreeCtlNode)
ndp := parent; ndp := parent;
if ndp then if ndp then
begin begin
ow := Owner;
if ow then //Ëø¶¨Ñ¡Ôñ¸Ä±ä
begin
lk := ow.ExecuteCommand("addlocked",0);
end
nd := self(true); nd := self(true);
ndp.deletenode(nd); ndp.deletenode(nd);
ndp.insertnode(nd,ndp.indexof(bf)+1); ndp.insertnode(nd,ndp.indexof(bf)+1);

View File

@ -905,7 +905,7 @@ type TWinControl = class(tcontrol)
FHandle := nil; FHandle := nil;
for i := 0 to FControls.count-1 do for i := 0 to FControls.count-1 do
begin begin
item := FControls.geti(i); item := FControls[i];
if(item is class(TWinControl))and item.WsPopUp then if(item is class(TWinControl))and item.WsPopUp then
begin begin
item.DestroyHandle(); item.DestroyHandle();
@ -1782,7 +1782,6 @@ type TWinControl = class(tcontrol)
begin begin
FUpDateCount := 0; FUpDateCount := 0;
FTabStop := false; FTabStop := false;
FControls := new TFpList();
FBorderStyle := bsNone; FBorderStyle := bsNone;
//FTRACKMOUSEEVENT := NEW TTRACKMOUSEEVENT(); //FTRACKMOUSEEVENT := NEW TTRACKMOUSEEVENT();
FWsPopUp := false; FWsPopUp := false;
@ -1888,7 +1887,7 @@ type TWinControl = class(tcontrol)
begin begin
for i := 0 to FControls.count-1 do for i := 0 to FControls.count-1 do
begin begin
item := FControls.geti(i); item := FControls[i];
if(item is class(TWinControl))then if(item is class(TWinControl))then
begin begin
item.HandleNeeded(); item.HandleNeeded();

View File

@ -586,7 +586,7 @@ type tarray1dlk=class //
**} **}
if j>_len-1 then j := _len-1; if j>_len-1 then j := _len-1;
if j<0 then j := 0; if j<0 then j := 0;
if i=j or(i<0 and i>_len)then exit; if i=j or(i<0 or i>_len)then exit; //修改
sl := createserial(i,j); sl := createserial(i,j);
for ii := 0 to length(sl)-2 do for ii := 0 to length(sl)-2 do
begin begin
@ -1045,6 +1045,59 @@ type tnumindexarray = Class() //ջģ
@param(Data)(array) 数据 %% @param(Data)(array) 数据 %%
**} **}
end end
type tnumindexarrayex = class(tnumindexarray)
{**
@explan(说明) 扩展模拟数组 %%
**}
function create();
begin
inherited;
end
function Deli(idx);
begin
r := splice(idx,1);
return r?true:false;
end
function geti(i);
begin
return GetValueByIndex(i);
end
function InsertBefor(it,idx);
begin
splice(idx,0,it);
end
function clean();
begin
splice(nil,nil);
end
function setorder(i,j);
begin
{**
@explan(说明) 设置元素位置 %%
@param(i)(integer)原始位置 %%
@param(j)(integer) 移动后的位置
**}
len := count-1;
if j>len then j := len;
if j<0 then j := 0;
if i=j or(i<0 or i>len)then exit;
d := splice(i,1);
splice(j,0,d[0]);
end
function append(v);
begin
Push(v);
end
function add(v) ;
begin
Push(v);
end
function Remove(v);
begin
return deli(indexof(v));
end
property count read length;
end
//ifdef newgetop //ifdef newgetop
type trefarray = class() //数组成员引用模拟 type trefarray = class() //数组成员引用模拟
function create(d,bidxs); //构造函数 function create(d,bidxs); //构造函数

View File

@ -108,7 +108,7 @@ type ttreelistwnd = class(TCustomScrollControl)
begin begin
inherited; inherited;
FHashItems := array(); FHashItems := array();
FItems := new TFpList(); FItems := new tnumindexarrayex();
FColWidth := 10; FColWidth := 10;
FColCount := 0; FColCount := 0;
FItemHeight := 25; FItemHeight := 25;
@ -699,7 +699,7 @@ type TcustomTreeCtlNode = class(tsluibase) //
FExpandWidth := 12; FExpandWidth := 12;
FBasePos := 10; FBasePos := 10;
FHierarchyWidth := 20; FHierarchyWidth := 20;
FItems := new TFpList(); //子项 FItems := new tnumindexarrayex(); //子项
FHierarchy :=-1; FHierarchy :=-1;
FEexpanded := false; FEexpanded := false;
FChecked := false; FChecked := false;
@ -1355,7 +1355,7 @@ type TcustomTreeCtlNode = class(tsluibase) //
FHandle; FHandle;
FWidth; FWidth;
FOwner; FOwner;
///////////节点成员
FVisible; FVisible;
FDirtype; FDirtype;
FImgId; FImgId;
@ -1372,12 +1372,7 @@ type TcustomTreeCtlNode = class(tsluibase) //
private //ÆÕͨÊôÐÔÉèÖà private //ÆÕͨÊôÐÔÉèÖÃ
function initnodehandle(); function initnodehandle();
begin begin
hd := new THandleClass(); FHandle := inttostr(int64(new THandleClass()));
try
FHandle := inttostr(int64(hd)); ////当前句柄唯一标识
except
FHandle := inttostr(gettslvariableptr(hd));
end;
end end
function SetWidth(w);virtual; function SetWidth(w);virtual;
begin begin
@ -1536,6 +1531,10 @@ type TcustomTreeCtl = class(ttreelistwnd)
if FPaintArray then return FPaintArray[pm]; if FPaintArray then return FPaintArray[pm];
return 0; return 0;
end end
"addlocked":
begin
return new tcountlocker(fcountlocker);
end
"emptynodeexpanding": "emptynodeexpanding":
begin begin
if HandleAllocated()then if HandleAllocated()then