Update twincontrol.tsf

模态优化
This commit is contained in:
JianjunLiu 2023-08-10 14:39:44 +08:00
parent 37ff1b871a
commit 152470c5db
1 changed files with 12 additions and 2 deletions

View File

@ -132,12 +132,15 @@ type TWinControl = class(tcontrol)
_wapi.BringWindowToTop(hWnd);
//disable掉父窗口
FModalRootWnd := 0;
inabledlist := array();
inabledlistidx := 0;
if(modp is class(TWinControl))and modp.HandleAllocated()then
begin
hParentWnd := modp.Handle;
while(hParentWnd) do
begin
_wapi.EnableWindow(hParentWnd,FALSE);
inabledlist[inabledlistidx++] := hParentWnd;
wdobj := class(tUIglobalData).uigetdata("TGlobalComponentcache").getwndbyhwnd(hParentWnd);
if wdobj and wdobj.Modaling then
begin
@ -174,7 +177,13 @@ type TWinControl = class(tcontrol)
end
//模态已经退出
//恢复父窗口的enable状态
if(modp is class(TWinControl))and modp.HandleAllocated()then
///////////////////////////////////////////////////////////////////////////
for i:= length(inabledlist)-1 downto 0 do
begin
_wapi.EnableWindow(inabledlist[i],TRUE);
end
inabledlist := nil;
{if(modp is class(TWinControl))and modp.HandleAllocated()then
begin
hParentWnd := modp.Handle;
while(hParentWnd) do
@ -183,7 +192,8 @@ type TWinControl = class(tcontrol)
if FModalRootWnd=hParentWnd then break;
hParentWnd := _wapi.GetParent(hParentWnd);
end
end
end}
///////////////////////////////////////////////////////////////////////
//将自己隐藏
_wapi.ShowWindow(hWnd,SW_HIDE);
return FModalCode;