openstack or preopenstack confusing to new application builders

7 messages Options
Embed this post
Permalink
william humphrey-2

openstack or preopenstack confusing to new application builders

Reply Threaded More More options
Print post
Permalink
I am posting this just for other newbies out there who may find this
confusing. If you have a mainstack and lots of substacks and you put either
a preopenstack or an openstack in the mainstack you would think that it
would only be called when you first open your stack. Not true. It is called
every time you switch to any of the other substacks of your main stack. I
have solved this by using GLX framework and the special on
glxapp_initializeApplication
which does what I thought pre-openstack should do. It runs just once when
you first open your stack (or application) and then it is never called
again. I have no idea how to do this with RunRev normally. For example when
I initialize my database I've found that it is a bad idea to do it in either
peropenstack or openstack as it gets called again and again when you switch
to other substacks and back again. I found that really confusing and just
put my openstack stuff in a button that I could push when the stack first
opened.

So if you are using glx framework then you solve it with
glxapp_initializeApplication
-- I don't know any other way to solve that confusing problem but I hope
someone will put in the trick (maybe you check to see if the stack is among
the lines of the open stack and exit or something like that).
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Richard Gaskin

Re: openstack or preopenstack confusing to new application builders

Reply Threaded More More options
Print post
Permalink
william humphrey wrote:

> I am posting this just for other newbies out there who may find this
> confusing. If you have a mainstack and lots of substacks and you put either
> a preopenstack or an openstack in the mainstack you would think that it
> would only be called when you first open your stack. Not true. It is called
> every time you switch to any of the other substacks of your main stack. I
> have solved this by using GLX framework and the special on
> glxapp_initializeApplication
> which does what I thought pre-openstack should do. It runs just once when
> you first open your stack (or application) and then it is never called
> again. I have no idea how to do this with RunRev normally. For example when
> I initialize my database I've found that it is a bad idea to do it in either
> peropenstack or openstack as it gets called again and again when you switch
> to other substacks and back again. I found that really confusing and just
> put my openstack stuff in a button that I could push when the stack first

The startup message is a good option for things that need to happen when
the standalone starts up.

But preOpenStack is easy to deal with if you put your preOpenStack
handler in the card script of the mainstack.  That way it only fires
when that mainstack is opened, but isn't triggered by the opening of any
substacks.

--
  Richard Gaskin
  Fourth World
  Rev training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com
  revJournal blog: http://revjournal.com/blog.irv
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Nicolas Cueto-4

Re: openstack or preopenstack confusing to new application builders

Reply Threaded More More options
Print post
Permalink
In reply to this post by william humphrey-2
I think the solution is to include preOpenstack, openStack and
closeStack handlers in all your stacks. Even if the handlers are
empty. That goes for cards too.

--
Nicolas Cueto


On Mon, Nov 9, 2009 at 6:33 AM, william humphrey
<[hidden email]> wrote:

> I am posting this just for other newbies out there who may find this
> confusing. If you have a mainstack and lots of substacks and you put either
> a preopenstack or an openstack in the mainstack you would think that it
> would only be called when you first open your stack. Not true. It is called
> every time you switch to any of the other substacks of your main stack. I
> have solved this by using GLX framework and the special on
> glxapp_initializeApplication
> which does what I thought pre-openstack should do. It runs just once when
> you first open your stack (or application) and then it is never called
> again. I have no idea how to do this with RunRev normally. For example when
> I initialize my database I've found that it is a bad idea to do it in either
> peropenstack or openstack as it gets called again and again when you switch
> to other substacks and back again. I found that really confusing and just
> put my openstack stuff in a button that I could push when the stack first
> opened.
>
> So if you are using glx framework then you solve it with
> glxapp_initializeApplication
> -- I don't know any other way to solve that confusing problem but I hope
> someone will put in the trick (maybe you check to see if the stack is among
> the lines of the open stack and exit or something like that).
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
J. Landman Gay

Re: openstack or preopenstack confusing to new application builders

Reply Threaded More More options
Print post
Permalink
In reply to this post by william humphrey-2
william humphrey wrote:
> If you have a mainstack and lots of substacks and you put either
> a preopenstack or an openstack in the mainstack you would think that it
> would only be called when you first open your stack. Not true. It is called
> every time you switch to any of the other substacks of your main stack.

Right. Substacks inherit the script of the mainstack automatically. The
message hierarchy works normally, and if nothing in a substack catches
the message, it will pass through to the mainstack. This is good if you
have certain behaviors you want to happen every time a stack opens (like
updating a window menu, maybe) but not so good if you only want
something to happen when the mainstack opens.

There are many ways to deal with this, and two have already been suggested:

1. If you only want something to happen once when the mainstack opens,
put the openstack or preOpenStack handler in the first card of the
mainstack. Substacks don't inherit the scripts of mainstack cards, only
the one in the stack script, so handlers in the cards won't be called by
substacks. When a mainstack first opens, it always opens at the first
card, so the handlers will trigger from there.

2. Use blocking handlers. Put empty "openStack" or "preOpenStack"
handlers in the stack scripts of the substacks. When they open, the
blocking handlers will catch the messages, which won't go through to the
mainstack. This is only convenient if you have one or two substacks,
otherwise it's too much trouble.

3. If you really do need to put the handlers in the mainstack script,
check to see if the stack that is opening is one you want to deal with.
This is a good approach if you want to trigger an openStack handler in
some substacks but not all of them. So you can do this:

  if the short name of this stack is not in "substack1,substack2"
  then pass openStack -- or "exit" if you like

That lets you decide which stacks should handle the message.

If you want only the mainstack to handler it, you can do this:

   if the short name of this stack is not the short name of me
   then pass openStack

But in this case you may as well put the handler into the first card
instead.
--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
dunbarx

Re: openstack or preopenstack confusing to new application builders

Reply Threaded More More options
Print post
Permalink
In reply to this post by william humphrey-2
The several proffered solutions all should work.

You can also explicitly test to see if the stack containing the handler is
the stack you want:

if the short name of this stack = yourMainStack then doThis else exit
preOpenStack

This may give you more options...

Craig Newman
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
dunbarx

Re: openstack or preopenstack confusing to new application builders

Reply Threaded More More options
Print post
Permalink
In reply to this post by william humphrey-2
Jacque:

I should have read this before I sent my own version.

Craig


In a message dated 11/8/09 7:24:06 PM, [hidden email] writes:


> 3. If you really do need to put the handlers in the mainstack script,
> check to see if the stack that is opening is one you want to deal with.
> This is a good approach if you want to trigger an openStack handler in
> some substacks but not all of them. So you can do this:
>
>   if the short name of this stack is not in "substack1,substack2"
>   then pass openStack -- or "exit" if you like
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
J. Landman Gay

Re: openstack or preopenstack confusing to new application builders

Reply Threaded More More options
Print post
Permalink
[hidden email] wrote:

> I should have read this before I sent my own version.

Nah. More is good. :)

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution