Page 1 of 1
openStack message path?
Posted: Fri Jul 09, 2021 2:51 pm
by Zax
Hello,
I would like to list names of all of my opened stacks in another opened stack.
As it seems the best way to do that would be to update the list on
openStack event message, I wrote in my listing stack's script:
then
Code: Select all
on openStack -- to trop opening stacks message
put the milliseconds && the short name of this stack -- for testing purpose
pass openStack
end openStack
But
openStack message is never trapped by this script, even if an opened stack doesn't have an
openStack handler. Also tried with an
openStack handler and
pass openStack into an opened stack without success.
What am I doing wrong?
Re: openStack message path?
Posted: Fri Jul 09, 2021 2:53 pm
by Klaus
Is this in the IDE? Maybe the IDE "eats" all unhandled messages.
Does it work in a standalone?
Re: openStack message path?
Posted: Fri Jul 09, 2021 3:06 pm
by dunbarx
Hi.
I am not sure what your issue is with the "openStack" message, but why not just use any of these:
the stacks
the openStacks
the stacksInUse
the mainStacks
Craig
Re: openStack message path?
Posted: Fri Jul 09, 2021 3:58 pm
by Zax
Yes Klaus, it's in the IDE, but I will never have to use this "list" stack in standalone

Are you suggesting that the IDE is not well fed and eat random messages?
@dunbarx: yes, but before listing the stacks, openStacks stacksInUse etc, I need an event/trigger (message) to perform the update of my list.
Re: openStack message path?
Posted: Fri Jul 09, 2021 4:13 pm
by Klaus
Hi Zax
yes, I know at leat from one message that the IDE "catches" and does not pass it:
pastekey
Hm, just made a test and it worked as advertized, so it is not the IDE
Where exactly do you:
Code: Select all
...
insert the script of me into back
...
?
I did this with a button:
Code: Select all
...
insert the script of this stack into back
...
and succeeded.
And of course your stacks may have their own "openstack" handlers, so I would rather use: insert ... into FRONT
Best
Klaus
Re: openStack message path?
Posted: Fri Jul 09, 2021 4:58 pm
by Zax
I will perform more tests tomorrow (not on my "LC" machine right now).
Script to front can be hard to handle because it traps messages before current stacks. In my case, I'm pretty sure the "listing" stack script has to be in the back.
Re: openStack message path?
Posted: Fri Jul 09, 2021 5:04 pm
by Klaus
Zax wrote: ↑Fri Jul 09, 2021 4:58 pm
Script to
front can be hard to handle because it traps messages
before current stacks.
that is true, but will sever exactly your purpose!

You open a stack, the FRONT script will catch the OPENSTACK message, does its thing and then passes
the message and everything works as exspected.
Or am I misunderstanding you completely?
Re: openStack message path?
Posted: Fri Jul 09, 2021 5:22 pm
by jacque
If a stack is in memory it won't get an openstack message because it's already open,. If I remember right, this can happen if the stack is closed while destroystack is false.
I have a handler in a backscript that uses the openstacks to get a list and I call it from the message box. It filters out the IDE stacks so I only see mine. Since you need this just for development it might work for you too.
Re: openStack message path?
Posted: Sat Jul 10, 2021 9:08 am
by Zax
OK, I started tests from scratch and finally discover a strange thing:
openStack message is well sent with my recent stacks, but are
not with very old stacks, the ones with .rev extension for example, though I still update and use these stacks without problems.
Changing extension of these stacks for .livecode didn't solve this strange behavior.
Old or recent, all these stacks have of course a
pass openStack at the end of their
openStack handler (though they are old, they were well coded

)
I encounter another problem for my "list" stack project: some of my stacks have a splash screen made with substacks, so "the name or this stack" on
openStack event is the name of the substack (the splash screen). STrapping
openStack event doesn't seem to be the correct way to update my opened stacks list.
Anyhow, thank you for your help Klaus and Jacqueline!
Re: openStack message path?
Posted: Sat Jul 10, 2021 1:34 pm
by Zax
As an history is already handled in LC, I finally found it's safer to parse data from text of btn "File" of group "revMenuBar" of stack "revMenuBar".