openControl and the Message Path

Peter Haworth pete at lcsql.com
Mon Nov 24 21:07:07 EST 2014


I've been using openControl to handle initalisation of controls within
groups and curious about what the dictionary says about it:

"For nested groups, the *openControl* message is sent to the parent group
first, if it is passed or not handled by the parent group, then it passes
though each child group in reverse layer order (i.e from highest to
lowest)."

I might be misunderstanding but that sounds like the reverse of the normal
message path.

I did some testing and it's more complicated than the dictionary
explanation (LC 6.6.2/OSX 10.7).

Assume you have Group A that contains group A1 and group A1 contains group
A2.  All three groups have an openControl handler that includes a pass
openControl command at the end.  I was expecting that the message would go
to group A then A1, then A2 but here's what happens:

A
    A1
A
        A2
    A1
A

It's as if the message follows the message path for openControl but then
also follows the normal message path.

Probably not a huge issue but if you happened to have some time consuming
code in group A's openControl, it would be executed three times, unless you
include some sort of check as to whether it's already been executed.


Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>



More information about the use-livecode mailing list