stack script executes when opening substack

Phil Davis revdev at pdslabs.net
Tue Sep 16 13:52:46 EDT 2008


Hi Jim,

What you experienced here is normal behavior. In Rev's message path, the 
mainstack's stack script is always between its substacks and the engine. 
So if you don't want those substack 'open' messages to be handled by 
'open' handlers in the mainstack, you could do any of several different 
things, depending on your requirements:

- in the "PatientFind" stack script, you could put:
    on preOpenStack
      -- trap the message
    end preOpenStack

- or in the button script that opens the substack you could put:
    on mouseUp
      lock messages
      go to stack "PatientFind"
      unlock mesages
    end mouseUp

I'm sure there must be other ways to prevent your unwanted outcomes, but 
these will get you going.

HTH -
Phil Davis


Jim McNeely wrote:
> Another newbie question; I appreciate the patience and help.
>
> I have this attached to the main stack:
>
> on preOpenStack
>    put revOpenDatabase("mysql", "localhost", "blechy", "account", 
> "pw") into MySQLID
>    answer "MySQL connection ID: " & MySQLID
> end preOpenStack
>
> THEN, I have a button which is supposed to open a substack window thusly:
>
> on mouseup
>    go to stack "PatientFind"
> end mouseup
>
> When it opens PatientFind, it executes the main stack's on 
> preOpenStack script, and then, if you close that window, it wants to 
> know if you want to save the changes to the whole file.
>
> What's up with that? I've read all the documentation I can find about 
> stacks and substacks and cards and such, and none of it hints at this 
> behavior.
>
> TIA,
>
> Jim McNeely 

-- 
Phil Davis

PDS Labs
Professional Software Development
http://pdslabs.net




More information about the use-livecode mailing list