diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-03-11 17:37:55 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-03-11 17:37:55 +0000 |
commit | df088bd71093e1d2b0a81b9e628541253895610c (patch) | |
tree | 8293fd45420d93eefaecab45fa45c9bb1e8a77ae /src/corelib/gfx_msgqueue.inc | |
parent | b4e79f5e55cef2382ebc746e5882d51f13727698 (diff) | |
download | fpGUI-df088bd71093e1d2b0a81b9e628541253895610c.tar.xz |
* Implemented a global MessageHook feature where one component can register and listen to another components messages.
Diffstat (limited to 'src/corelib/gfx_msgqueue.inc')
-rw-r--r-- | src/corelib/gfx_msgqueue.inc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/gfx_msgqueue.inc b/src/corelib/gfx_msgqueue.inc index e498d7a9..9ddda9b4 100644 --- a/src/corelib/gfx_msgqueue.inc +++ b/src/corelib/gfx_msgqueue.inc @@ -184,6 +184,9 @@ begin end; procedure fpgDeliverMessage(var msg: TfpgMessageRec); +var + oItem: TMsgHookItem; + i: integer; begin if msg.MsgCode = FPGM_KILLME then msg.Dest.Free @@ -191,6 +194,15 @@ begin begin try msg.Dest.Dispatch(msg); + if fpgApplication.FMessageHookList.Count > 0 then + begin + for i := 0 to fpgApplication.FMessageHookList.Count - 1 do + begin + oItem := TMsgHookItem(fpgApplication.FMessageHookList.Items[i]); + if (msg.Dest = oItem.Dest) and (msg.MsgCode = oItem.MsgCode) then + oItem.Listener.Dispatch(msg); + end; + end; except on E: Exception do {$IFDEF DEBUG}writeln('fpgDeliverMessage Caught Exception: ' + E.Message){$ENDIF}; |