Q qf0421 Unregistered / Unconfirmed GUEST, unregistred user! 2000-03-25 #1 当TOOLBAR被用户DOCKDRAG到外面,形成一个TOOLWINDOW时,当关闭这个TOOL WINDOW时怎样捕捉他的"关闭".
沈 沈前卫 Unregistered / Unconfirmed GUEST, unregistred user! 2000-03-25 #3 Visible可以判断是否关闭,如果要实时捕捉他的"关闭".30分太少.....
沈 沈前卫 Unregistered / Unconfirmed GUEST, unregistred user! 2000-03-25 #4 { 这个控件可以满足你的要求,不过要注意,如果你设置ToolBar1.Visible有可能触发 这个事件,所以最好是在设置ToolBar1.Visible时将ToolBar1.OnClose:=nil; 设置完毕后再ToolBar1.OnClose:=YourCloseEvent; } unit SQWToolBar; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ToolWin, ComCtrls; type TSQWToolBar = class(TToolBar) private { Private declarations } FCloseEvent:TNotifyEvent; procedure DoCloseEvent; procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED; protected { Protected declarations } public { Public declarations } published { Published declarations } property OnClose:TNotifyEvent read FCloseEvent write FCloseEvent; end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [TSQWToolBar]); end; { TSQWToolBar } procedure TSQWToolBar.CMVisibleChanged(var Message: TMessage); begin inherited; if (not Visible) then DoCloseEvent; end; procedure TSQWToolBar.DoCloseEvent; begin if Assigned(FCloseEvent) then FCloseEvent(Self); end; end.
{ 这个控件可以满足你的要求,不过要注意,如果你设置ToolBar1.Visible有可能触发 这个事件,所以最好是在设置ToolBar1.Visible时将ToolBar1.OnClose:=nil; 设置完毕后再ToolBar1.OnClose:=YourCloseEvent; } unit SQWToolBar; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ToolWin, ComCtrls; type TSQWToolBar = class(TToolBar) private { Private declarations } FCloseEvent:TNotifyEvent; procedure DoCloseEvent; procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED; protected { Protected declarations } public { Public declarations } published { Published declarations } property OnClose:TNotifyEvent read FCloseEvent write FCloseEvent; end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [TSQWToolBar]); end; { TSQWToolBar } procedure TSQWToolBar.CMVisibleChanged(var Message: TMessage); begin inherited; if (not Visible) then DoCloseEvent; end; procedure TSQWToolBar.DoCloseEvent; begin if Assigned(FCloseEvent) then FCloseEvent(Self); end; end.
Q qf0421 Unregistered / Unconfirmed GUEST, unregistred user! 2000-03-26 #5 沈大哥,这里的关键是不是就是让TOOLBAR接收CM_VISIBLECHANGED?