添加测试代码

测试
This commit is contained in:
JianjunLiu
2023-06-28 14:38:56 +08:00
parent e9f7ae4e50
commit 2768380032
9 changed files with 222 additions and 21 deletions
-1
View File
@@ -1294,7 +1294,6 @@ type TEditAndBtnUni=class(tcustomcontrol)
function DoControlAlign();override;
begin
c := clientRect;
echo tostn(c);
FBtn.SetBoundsRect(array(C[2]-18,1,C[2]-3,c[3]-2));
FText.SetBoundsRect(array(c[0]+1,c[1]+1,c[2]-22,c[3]-2));
end
+41 -19
View File
@@ -58,14 +58,29 @@ type tcustompagecontrol = class(TCustomControl)
FTabRects;
FClientarea;
private
function gettabsheetitem(idx);
begin
if idx>=0 and idx<ftabitems.length() then return FTabItems[idx];
if isacceptsheettype(idx) then
begin
for i:= 0 to ftabitems.length()-1 do
begin
it := FTabItems[i];
if idx=it.PageSheet then return it;
end
end
end
function gettabesheet(idx);
begin
if idx>=0 then return FTabItems[idx];
if idx>=0 and idx<ftabitems.length() then
begin
return FTabItems[idx].PageSheet;
end
end
function getactivetabsheet();
begin
id := FCurrentid;
if id>=0 then return FTabItems[id];
if id>=0 then return FTabItems[id].PageSheet;
end
function SetTabPosition(v);
begin
@@ -471,6 +486,12 @@ type tcustompagecontrol = class(TCustomControl)
end
return r;
end
function checknewchild(achild);override;//检查child
begin
r := inherited;
if isacceptsheettype( achild) then achild.Align := alNone;
return r;
end
function getsheetrect(); //获得sheet
begin
{**
@@ -625,25 +646,25 @@ type tcustompagecontrol = class(TCustomControl)
CalcTabs();
for i := 0 to FTabItems.length()-1 do
begin
it := FTabItems[i];
pg := it.PageSheet;
if it and pg then
pg := FTabItems[i].PageSheet;
if not pg then continue;
pg.Align := alNone;
if i=FCurrentid then
begin
if i=FCurrentid then
pg.Visible := true;
rc := getsheetrect();
if not rc then return ;
rc[1]+=1;
if csDesigning in ComponentState then
begin
pg.Visible := true;
rc := getsheetrect();
if not rc then return ;
rc[1]+=1;
if csDesigning in ComponentState then
begin
rc[0]+=2;
rc[2]-=2;
rc[3]-=2;
end
pg.SetBoundsrect(rc);
end else
pg.Visible := false;
rc[0]+=2;
rc[2]-=2;
rc[3]-=2;
end
pg.SetBoundsrect(rc);
end else
begin
pg.Visible := false;
end
end
end
@@ -726,6 +747,7 @@ type tcustompagecontrol = class(TCustomControl)
property TabCount read GetTabCount;
property TabPosition:tabalign read FTabPosition write SetTabPosition;
property tabsheet read gettabesheet ;
property tabsheetitem:tcustomtabitem read gettabsheetitem;
property onmeasuretabwidth:eventhandler read fonmeasuretabwidth write fonmeasuretabwidth;
property ondrawtab:eventhandler read fondrawtab write fondrawtab;
property ownerdraw:bool read fownerdraw write fownerdraw;