Explicit Variables again

Richard Gaskin ambassador at fourthworld.com
Fri Oct 19 13:25:30 EDT 2012


Peter Haworth wrote:

> messageBoxRedirect?  I can find no mention of that in the dictionary.  What
> does it do?
>
> I look forward to seeing your message box replacement Richard.  I have that
> as a future enhancement to my lcStackBrowser plugin but sounds like you may
> have saved me the trouble!

My bad: it's actually called "revMessageBoxRedirect".

And you're right:  oddly, it isn't documented, but can potentially be 
useful for other things than what it was originally implemented for, so 
I just logged a request for its documentation:
<http://quality.runrev.com/show_bug.cgi?id=10481>

The revMessageBoxRedirect global property was originally added at my 
request to overcome a limitation formerly in the engine which prevented 
us from replacing the Message Box stack without crashing.  I was 
pursuing a path for migrating portions of the MetaCard IDE for use 
within the LiveCode IDE, and this was preventing that work from going 
forward.

Their solution for this far exceeded my expectations, and can be useful 
for all sorts of MB replacements and diagnostic tools.

The revMessageBoxRedirect global prop defaults to empty, and when empty 
any "put" commands have their output sent to the main field in a stack 
named "Message Box" (and you really should use only LC's provided 
Message Box stack, because I've found that attempting to replace it with 
another of the same name on the fly is problematic).

But you can set the value of the revMessageBoxRedirect to the long ID of 
any object, and after having done so that object will then receive a new 
message, msgChanged, whenever any script triggers an action that would 
normally put output into the Message Box, e.g.:

on msgChanged pMsg
   put pMsg into fld "Messages" of stack "My Cool Message Box"
end msgChanged


Certainly a specialized need, which may be why they've never bothered to 
document it.

But serious toolmakers will find it interesting, and it can lend itself 
to certain types of logging solutions which can be useful and fun to build.

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  Follow me on Twitter:  http://twitter.com/FourthWorldSys




More information about the Use-livecode mailing list