openStack message path?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Zax
Posts: 432
Joined: Mon May 28, 2007 10:12 am
Location: France

openStack message path?

Post by Zax » Fri Jul 09, 2021 2:51 pm

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:

Code: Select all

insert the script of me into back
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?

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: openStack message path?

Post by Klaus » Fri Jul 09, 2021 2:53 pm

Is this in the IDE? Maybe the IDE "eats" all unhandled messages.
Does it work in a standalone?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: openStack message path?

Post by dunbarx » Fri Jul 09, 2021 3:06 pm

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

Zax
Posts: 432
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: openStack message path?

Post by Zax » Fri Jul 09, 2021 3:58 pm

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.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: openStack message path?

Post by Klaus » Fri Jul 09, 2021 4:13 pm

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

Zax
Posts: 432
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: openStack message path?

Post by Zax » Fri Jul 09, 2021 4:58 pm

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.

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: openStack message path?

Post by Klaus » Fri Jul 09, 2021 5:04 pm

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?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: openStack message path?

Post by jacque » Fri Jul 09, 2021 5:22 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Zax
Posts: 432
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: openStack message path?

Post by Zax » Sat Jul 10, 2021 9:08 am

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!

Zax
Posts: 432
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: openStack message path?

Post by Zax » Sat Jul 10, 2021 1:34 pm

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".

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”