線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1114
推到 Plurk!
推到 Facebook!

窗体从活动到非活动状态的响应过程。

答題得分者是:Vicen
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-10-02 17:57:12 IP:222.35.xxx.xxx 未訂閱
请问窗体从活动到非活动状态的响应过程是OnDeactivate吗?但我试过没有响应这个过程,不知道是为什么。
Vicen
高階會員


發表:13
回覆:145
積分:151
註冊:2005-03-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-10-02 20:52:10 IP:221.226.xxx.xxx 未訂閱
系统没有提供这个事件的,不过您可以通过API函数GETACTIVEWINDOW进行判断,非常简单。    以下是通过TIMER控件实现的窗体活动状态监控,您可以移植到需要的地方,不知道对您能否有帮助。    
//GetActiveWindow 活动当前WINDOWS活动窗口
//Self.Handle 本程序窗口的句柄
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if GetActiveWindow <> Self.Handle then
    Edit1.Text := 'No Active'
  else
    Edit1.Text := 'Active';
end;
Fishman
尊榮會員


發表:120
回覆:1949
積分:2163
註冊:2006-10-28

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-10-03 08:08:17 IP:210.65.xxx.xxx 未訂閱
Hi cxg,    Form 的 OnDeactive 事件 Delphi 的說明如下:    OnDeactivate event (TCustomForm) Occurs when the form loses focus. Description Use OnDeactivate to perform special processing when the form transitions from being the active form to another form in the same application becoming the active form. If activation goes to another application, this event is not triggered. To determine if another application has become active, Use the TApplication object’s OnDeactivate event. PS:TApplicationEvents 位於 Additional TAB 中 ---------------------------------- 小弟才疏學淺,若有謬誤尚請不吝指教 ----------------------------------
------
Fishman
系統時間:2024-05-19 13:42:25
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!