Listen for messages in FrontScripts

Richard Gaskin ambassador at fourthworld.com
Sat Dec 31 16:11:44 CST 2011


Todd Geist wrote:

> What messages can you listen for in FrontScripts?  I know user input
> messages can be intercepted there, but I am not sure about what other
> engine Messages, or if it is possible to listen for custom messages.

You can trap anything in a frontScript by just adding a handler with the 
name of the handler you want to trap.

If you want to trap every message, command, and function call you can 
use the undocumented messageHandled message.

Note that the messageHandled message is not sent by default.  To 
activate it you'll need to set the undocumented messageMessages global 
property to true.

If you use messageHandled, be aware that it will be called for 
EVERYTHING, so it may make a noticeable difference in performance. 
Useful for temporary diagnostic logging, but I don't use it for anything 
else.

An example of messageHandled use is in the 4W Flight Recorder tool in 
Stacks section of RevNet - in the IDE choose Development->Plugins->GoRevNet.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv



More information about the use-livecode mailing list