界面库

优化gtkactivate
This commit is contained in:
JianjunLiu
2023-01-05 17:36:51 +08:00
parent 5c87f678d6
commit 8ed3ce6baa
5 changed files with 126 additions and 24 deletions
+8 -4
View File
@@ -1662,7 +1662,7 @@ type TWinControl = class(tcontrol)
end
function setactive(); virtual;
begin
if WsPopUp and HandleAllocated() then
if not(factivated) and WsPopUp and HandleAllocated() then
begin
_wapi.SetActiveWindow(self.Handle);
end
@@ -1879,7 +1879,12 @@ type TWinControl = class(tcontrol)
tcn := P.WinClassName;
f := _wapi.CreateWindowExA(p.ExStyle,tcn,tcc,stl,x,y,sx,sy,p.WndParent,id,p.happ,selfid);
InitializeWnd();
if HandleAllocated()then ControlCreateWnd();
if HandleAllocated()then
begin
ControlCreateWnd();
//处理初始化active的问题
if factivated and factivecontrol and ContainsControl(factivecontrol) then factivecontrol.SetFocus();
end
end
function Notification(ac,op);override;
begin
@@ -2523,10 +2528,9 @@ type TWinControl = class(tcontrol)
property onSetFocus:eventhandler read FonSetFocus write fonSetFocus;
property oncreated:eventhandler read foncreated write foncreated;
property ActiveControl read getactivecontrol write setactivecontrol;
property Active read factivated;//是否获活动窗口
private //模态相关
property Modaling read FModaling;
{**
@param(BorderStyle)(bsNone|bsSingle) 边框样式 %%
@param(Handle)(pointer) 窗口句柄 %%
+10 -7
View File
@@ -4963,14 +4963,17 @@ type tgtk_ctl_object = class(_gtkeventtype)
if st .& (2^7) then
begin
//CallTslVclProc(_const.WM_SETFOCUS ,0,0);
hwd := handle;
hwd := _wapi.gtk_widget_is_toplevel(hwd)?hwd:_wapi.gtk_widget_get_toplevel(hwd);
if G_GTK_WINDOW_ACTIVATE<>hwd then
begin
if G_GTK_WINDOW_ACTIVATE then
AddMessageToGtkMessageQueue(G_GTK_WINDOW_ACTIVATE,0x6,0,0,0);
end
hwd := handle;
hwd := _wapi.gtk_widget_is_toplevel(hwd)?hwd:_wapi.gtk_widget_get_toplevel(hwd);
if G_GTK_WINDOW_ACTIVATE<>hwd then
begin
if G_GTK_WINDOW_ACTIVATE then
begin
AddMessageToGtkMessageQueue(G_GTK_WINDOW_ACTIVATE,0x6,0,0,0);
end
end
AddMessageToGtkMessageQueue(hwd,0x6,1,0,0);
G_GTK_WINDOW_ACTIVATE := hwd;
//CallTslVclProc(_const.WM_ACTIVATE ,2,0,0);
end
{GDK_WINDOW_STATE_WITHDRAWN = 1 << 0,
+2
View File
@@ -4012,6 +4012,8 @@ type TCustomComboBoxbase=class(TCustomControl)
if csDesigning in ComponentState then return;
x := e.xpos;
y := e.ypos;
if x>1 and y>1 then return ShowDropDown(true);
return ;
if x>FBtnRect[0]and x<FBtnRect[2]and y>FBtnRect[1]and y<FBtnRect[3]then
begin
ShowDropDown(true);