open a substack in an opencard handler

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: Klaus, FourthWorld, heatherlaine, kevinmiller

Post Reply
Martin Koob
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 237
Joined: Sun May 27, 2007 8:19 pm

open a substack in an opencard handler

Post by Martin Koob » Mon Jul 29, 2013 11:54 pm

I am trying to have a substack open above the main stack when a card opens. What happens is the substack opens in front of the main stack but immediately the main stack moves to the front. I want the substack to stay above the main stack.

Two illustrate this I created a simple stack with a main stack with two cards and a sub stack called "window2"

Card 1 of the main stack has a button with the script

Code: Select all

on mouseUp 
   go card 2 
end mouseUp 
Card 2 of the main stack has the following card script

Code: Select all

on opencard 
   show stack "window2" 
   go stack "window2" 
   #the following wait command is just to hold stack "window2" open long enough to see it opened 
   wait 2 seconds 
end opencard 

on closecard 
   hide stack "window2" 
end closecard 
Card 2 of the main stack also has a button with the following script

Code: Select all

on mouseUp 
    go card 1 
end mouseUp 
When you click the button to go to card 2 the stack "window2" opens above the main stack and stays for the 2 seconds of the wait but then the main stack moves to the front.

I assume the problem is that when the opencard message ends the stack with the card with that handler becomes the active stack and moves to the front.

I have tried sending or dispatching messages to other objects to show and go to the substack but if I do that within the opencard handler after those messages are dealt with the context returns to the open card handler and then the main stack becomes active again.

Is there another way to do this?

Thanks.

Martin Koob

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: open a substack in an opencard handler

Post by shaosean » Tue Jul 30, 2013 1:12 am

The extension rev is not allowed.
really? you guys couldn't even be bothered to modify the settings of the forum to allow your own file format?

This uses a "send" command in the openCard of card 1 of stack "untitled 1"
Attachments
20130729.rev.zip
(843 Bytes) Downloaded 150 times

Martin Koob
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 237
Joined: Sun May 27, 2007 8:19 pm

Re: open a substack in an opencard handler

Post by Martin Koob » Tue Jul 30, 2013 1:31 pm

Thanks Shaosean.

I see it is the send in time that makes the difference. I was just using send.

Martin

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

Re: open a substack in an opencard handler

Post by Klaus » Tue Jul 30, 2013 2:06 pm

shaosean wrote:
The extension rev is not allowed.
really? you guys couldn't even be bothered to modify the settings of the forum to allow your own file format?
You guys? C'mon, that's not my fault, cherie 8-)

Please complain at RunRev :-D

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: open a substack in an opencard handler

Post by shaosean » Tue Jul 30, 2013 2:59 pm

easier to blame you santa klaus ;-P

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

Re: open a substack in an opencard handler

Post by Klaus » Tue Jul 30, 2013 3:18 pm

*#%%$§]]##*++

:-D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”