Page 1 of 1

I must be missing something

Posted: Fri Mar 27, 2009 3:15 pm
by magice
I have created a mainstack and a substack. They work together as intended. The problem I am having though, is that when I initially open the the project, the substack doesn't open. I have to go to the application browser and open it from there. Am I missing a simple property setting, or do I somehow need to script the opening of that substack?

Posted: Fri Mar 27, 2009 3:25 pm
by sturgis
Not sure this is the best way, but try

Code: Select all

on preOpenStack
show stack "stackname"
end preOpenStack
In the main stack script.

I'm still new, but I think that since its showing in the app browser it is actually open, just not showing.

Posted: Fri Mar 27, 2009 3:42 pm
by magice
unfortunately that didn't seem to help. I still have to go to the application menu and open the substack before it wil interact with the main stack.

Posted: Fri Mar 27, 2009 3:57 pm
by Klaus
Hi magice,

try:

Code: Select all

on preOpenStack 
  GO stack "stackname" 
end preOpenStack
"show stack XYZ" will only set the "visible" property but not open the stack!


Best from germany

Klaus

Posted: Fri Mar 27, 2009 4:08 pm
by massung
I'm new to Revolution, but my experience so far shows that using openStack or preOpenStack is probably a bad idea. That handler will be called again when you actually open the substack (or any other substack), too. This is probably not what you want to have happen.

If you put it in openCard of the main stack, then it will only happen when you initially open the main stack.

If I'm seeing the above behavior due to a misunderstanding I have on how stack scripts are executed, then perhaps someone here can correct me and explain why that is, though. ;)

Jeff M.

Posted: Fri Mar 27, 2009 4:26 pm
by sturgis
ah k. A DOH moment for me, thanks for the catch.

Also is stated just above, it probably is a good idea to put it in cardOpen rather than preOpenStack

I've run into some wierdness with drawers due to this.
Klaus wrote:Hi magice,

try:

Code: Select all

on preOpenStack 
  GO stack "stackname" 
end preOpenStack
"show stack XYZ" will only set the "visible" property but not open the stack!


Best from germany

Klaus

Posted: Fri Mar 27, 2009 5:12 pm
by magice
That did it, thank you very much.

Posted: Sat Mar 28, 2009 7:58 am
by Obleo
massung wrote:I'm new to Revolution, but my experience so far shows that using openStack or preOpenStack is probably a bad idea. That handler will be called again when you actually open the substack (or any other substack), too.
Jeff M.
Really ? I never heard of that or had any such problem in the years I used revolution doing any such thing. It is called once when the main stack is opened. each substack has it's own stack script. If there no such handler in the substack it will not tigger that meassage again.

I'd be interested to see a stack that did otherwise.

Posted: Sat Mar 28, 2009 10:48 am
by SparkOut
The preOpenStack and openStack messages pass through the hierarchy as usual when a substack is opened as well.

If you make a plain mainstack "myMainStack" and substack "mySubStack" with no controls on them and put the following in the stack script of the mainstack

Code: Select all

on preOpenStack
   answer "preOpenStack triggered in mainstack"
end preOpenStack

on openStack
   answer "openStack triggered in mainstack"
   go stack "mySubStack"
end openStack
then you will find that the mainstack preOpenStack and openStack messages are triggered twice each - once when the mainstack opens, and again when the substack opens - because the preOpenStack and openStack messages are not handled in the substack, then the messages pass up the hierarchy to the mainstack in the usual manner. Therefore you need to consider the message path hierarchy when making stack level handlers. Either you need to trap them in substacks where the mainstack handlers should not trigger, or, you can move the preOpenStack and openStack handlers to card 1 of the mainstack, which will mean that a substack's message will not be trapped by the mainstack stack script - it doesn't pass through all the cards, whereas by default a stack will open card 1 of that stack as it opens.
(Not a very coherent paragraph, but I hope you get what I mean.)