Page 2 of 2

Re: stack inside stack

Posted: Thu Oct 28, 2010 11:11 am
by WaltBrown
If you know the name of the "lost" object, you can type

Code: Select all

show myObjectName
in the Message Box.
Walt

Re: stack inside stack

Posted: Thu Oct 28, 2010 12:44 pm
by Dixie
Hi...

I just quickly made a stack "Untitled 1"... then a substack "Untitled 2"
In a button in stack "Untitled 1" I put the following :-

Code: Select all

on mouseUp
   open stack "Untitled 2" in the window of stack "Untitled 1"
end mouseUp
The substack, stack "Untitled 2" then opens in the window of stack "Untitled 1"
Is this what you are wanting to do ?

be well

Dixie

Re: stack inside stack

Posted: Fri Oct 29, 2010 4:51 am
by openworld
Klaus,

Is there a way in LiveCode to locate substacks of a Mainstack? I've tried various commands in the Message box, for example

- open substack "QuickTagger" of MainStack "Soctet"
- open palette "QuickTagger" of MainStack "Soctet"

When I do a "find" search on "Quicktagger" on the stack (with all search options checked), I do not find the substack. Is there a better way?

Best,

Mark
Klaus wrote:Hi Mark,

maybe:
...
palette "Quicktagger"
...
will work for you?

Or dou you mean the stack is really not "visible" which IS indeed a porperty of a stack? :D


Best

Klaus

Re: stack inside stack

Posted: Fri Oct 29, 2010 11:01 am
by Klaus
Hi Mark,

"find" will only find text inside of stacks, so this will not work for you.

To get a list of substacks you can
...
put the substacks of stack "you main stack here"
...

And once a mainstack is open you should be able to pen any of its substacks by simply using
...
go stack "substack 1"
## = the same as: toplevel "substack 1"
...
OR
...
palette "substack 2"
...
OR
...
modeless "substack 2"
...
OR
...
modal "substack 3"
...

Is that what you mean?


Best

Klaus

P.S.
The correct syntax for opening substacks is:
go stack "name of substack" of stack "mainstack here"

Re: stack inside stack

Posted: Fri Oct 29, 2010 6:06 pm
by openworld
Klaus,

All is good now here re the recent substack issue - my thanks for providing the resolution!

Best,

Mark

Re: stack inside stack

Posted: Tue Nov 09, 2010 11:32 pm
by nomodes
Here is a way to position one or more inner stacks (substacks) in an outer stack (mainstack) so that the inner stacks never move and never disappear under the outer stack.

Create the inner stacks using the menu command "New Substack of Outer".

Use the Application Browser to access the Property Inspector of each substack. You probably will want to uncheck Shadow. You probably will want to set the Title Bar Controls (using the Controls field wand) to Empty (the last choice in the Title Bar Controls dialog). After sizing and positioning them, you will probably want to uncheck Resizable.

Here is an (outer) stack script that produces the desired behavior. My test case uses four inner stacks that have no adornments--no title bar, no scroll bars, etc. The top row has two inner stacks 300 pixels high. The bottom row has two inner stacks 500 pixels high. All four inner stacks are 400 pixels wide and are separated by two-pixel gaps. To change the number of inner stacks and/or their locations within the outer stack, only one line of the script needs to be edited.

Code: Select all

on openStack
   set the raisePalettes to true -- Make inner stacks float in their own layer above the outer stack
   positionInnerStacks the left of me, the top of me -- ensure that all the inner stacks are shown correctly
end openStack

on moveStack newStackLeft,newStackTop
   positionInnerStacks newStackLeft, newStackTop -- ensure that all the inner stacks are shown correctly
end moveStack

on positionInnerStacks outerStackLeft,outerStackTop
   put the substacks of me into innerStackNames
   -- To change the layout, simply edit the top-left corner coordinates on the next line
   put "0 0, 402 0, 0 302, 402 302" into innerStackLocations -- Be sure they are in substacks order
   send "showInnerStacks" to me in 1 second -- Prevent flickering
   repeat with i = 1 to the number of lines in innerStackNames
      put line i of innerStackNames into innerStackName
      -- Prepare inner stack
      set the shadow of stack innerStackName to false -- Usually looks better
      palette stack innerStackName -- Causes palette behavior
      hide stack innerStackName -- Prevent flickering
      -- Position inner stack
      put item i of innerStackLocations into hv
      set the left of stack innerStackName to outerStackLeft + word 1 of hv
      set the top of stack innerStackName to outerStackTop + word 2 of hv
   end repeat
end positionInnerStacks

on showInnerStacks -- Prevent flickering
   repeat for each line innerStackName in the substacks of me
      show stack innerStackName
   end repeat
end showInnerStacks
One problem though... In Palette mode, it doesn't seem to be possible to edit a substack using the tools. A way around this is to right-click the stack or card in the Application Browser and choose TopLevel from the menu. When done editing, either (a) right-click the card in the stack window and choose Stack Mode > Palette from the menu or (b) move the stack window a tad (which will run the above script and accomplish the same thing).

Re: stack inside stack

Posted: Tue Nov 09, 2010 11:49 pm
by Dixie
nomodes...

I must be missing the point here... but I still think that the easiest way to accomplish what was asked 'opening a stack inside a stack' is just to open the substack in the window of the main stack... Make a stack "Untitled 1"... then a substack "Untitled 2". Then from wherever you wish to call the substack, just use the one line of script.. it would work for any number of substacks that were in the stackfile...

Code: Select all

open stack "Untitled 2" in the window of stack "Untitled 1"
The substack, stack "Untitled 2" then opens in the window of stack "Untitled 1"...

be well

Dixie

Re: stack inside stack

Posted: Wed Nov 10, 2010 8:19 am
by nomodes
Dixie,

The problem that pmc posed was,
I want my substack to be inside the panel of the Mainstack, which does not go beyond it(the mainstack). Something like an object, eg. Tab panel, which you put into a card. You see, the tab panel which you put in a card does not 'move' out from this card, it stayed inside it. And furthermore, you are able to specify the size and position of the tab panel in the card.
In a subsequent message, one containing illustrations, pmc further clarified the requirement. I believe that my solution addresses it. Yours is much shorter than mine, but when I try to incorporate it into a real-world example, it doesn't do what I think pmc wanted.

I tried doing what I think you suggested:

Code: Select all

open stack "Outer" -- works as expected
open stack "Upper Left" in the window of stack "Outer" -- Changes the title and content of the window "Outer" to that of the stack "Upper Left"
open stack "Lower Left" in the window of stack "Outer" -- Message execution error: Error description: go: error in window expression
open stack "Outer" -- Opens the stack "Outer" in a new (yet another) window
If you meant something else, can you provide a more extensive example?

Unfortunately, the command open stack "A" in the window of stack "B" is not explained in the Developer Documentation at http://docs.runrev.com/Command/go. I am not sure what it is supposed to do. If you know a place where it is documented, could you post that location?

Thanks,

Larry

Re: stack inside stack

Posted: Fri Nov 12, 2010 5:15 pm
by shaosean
open stack "A" in the window of stack "B"
This replaces the content of stack "B" (what you see on the screen, not the actual file) with the content of stack "A".. This is a nice method to open a new stack in the same location and size as a previous stack but without all the flickering..

Re: stack inside stack

Posted: Tue Jan 18, 2011 12:14 pm
by ctflatt
Klaus:

According to the Dictionary included with the IDE, "The close command closes the stack window immediately, but it does not necessarily remove the stack from memory. A stack that is closed but in memory still takes up space in RAM and its objects are still accessible to scripts."

The app I am creating for the iPad consists of a main stack (obviously) which opens other stacks based on user selection. What is the best way to handle the closing of these substacks and removing them from memory when "closed?"

Do I need to catch the opening stack's name (in a variable) in the main stack, and then upon closing the substack, destroy the substack from the main stack?

Does this make sense, or am I speaking gibberish?

:Todd

PS. This wasn't necessarily a mobile question, so I hope I have used the correct forum for this question. Thanks :)

Re: stack inside stack

Posted: Tue Jan 18, 2011 12:21 pm
by Dixie
Hi...

Have a look at 'destroyStack' in the dictionary...

be well

Dixie

Re: stack inside stack

Posted: Tue Jan 18, 2011 12:30 pm
by ctflatt
Dixie:

Thanks for the info. I had already checked out the destroyStack property in the dictionary...

In the close handler of the substack, would I include the following?

Code: Select all

set the destroyStack of this stack to true
Is it that easy?

:Todd

Re: stack inside stack

Posted: Tue Jan 18, 2011 1:09 pm
by Dixie
Hi Todd...

Why not just set the 'destroyStack' to true when you create the stack ? That way whenever it is closed it will be removed from memory. You can also do this by clicking the checkbox 'purge stack on close' in the stack's property inspector...

be well

Dixie