how does stack run its substack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
how does stack run its substack
I have a main stack and a substack and I am not satisfied the way to start the substack is to use go to stack"substackname".
The startup process is this.
go to stack"substackname". (this shows the mainstack, but script access to a field on the mainstack results in an error because it cannot find the field)
go to stack "mainstackname". (this corrects the previous problem and the whole programe runs as intended)
I would have thought there was a better way of getting both elements running at startup, is there?
The startup process is this.
go to stack"substackname". (this shows the mainstack, but script access to a field on the mainstack results in an error because it cannot find the field)
go to stack "mainstackname". (this corrects the previous problem and the whole programe runs as intended)
I would have thought there was a better way of getting both elements running at startup, is there?
Re: how does stack run its substack
Hi a-revuser,
I am not sure what you are after?
What do you mean "the startup process it this"?
Could you post your script and what you want to achieve?
Best
Klaus
I am not sure what you are after?
What do you mean "the startup process it this"?
Could you post your script and what you want to achieve?
Best
Klaus
Re: how does stack run its substack
Hi Klaus,
Startup process means when the exe is clicked on.
The script is more or less as I have shown, but I paste the actual script here:-
on preopencard
local fileslst,filnam,Linecount,Temptext
go to stack "Scratchpad"
go to stack "AD Part G"
hide stack "Scratchpad"
put the files into fileslst
if fileslst contains "Scratchpad.txt" then
put url "File:Scratchpad.txt" into field "Scratchpad" of stack "Scratchpad"
-----Moved to preopen card 1005-----
--if the length of line 1 of field "Scratchpad" of stack "Scratchpad" < 3 then
--put empty into line 1 of field "Scratchpad" of stack "Scratchpad"
--delete line 1 of field "Scratchpad" of stack "Scratchpad"
--end if
else
--Populate Scratchpad list
Put "Bedroom 1 en-suite" into line 1 of field "Scratchpad" of stack "Scratchpad"
Put "Bedroom 2 en-suite" into line 2 of field "Scratchpad" of stack "Scratchpad"
Put "Bedroom 3 en-suite" into line 3 of field "Scratchpad" of stack "Scratchpad"
Put "Cloakroom" into line 4 of field "Scratchpad" of stack "Scratchpad"
Put "Kitchen" into line 5 of field "Scratchpad" of stack "Scratchpad"
Put "Main bathroom" into line 6 of field "Scratchpad" of stack "Scratchpad"
Put "Shower room" into line 7 of field "Scratchpad" of stack "Scratchpad"
Put "Undefined" into line 8 of field "Scratchpad" of stack "Scratchpad"
Put "Utility room" into line 9 of field "Scratchpad" of stack "Scratchpad"
put field "Scratchpad" of stack "Scratchpad" into url "File:Scratchpad.txt"
end if
-- Display splash message
put "<p><u><b>IMPORTANT NOTICE.</b></u></p>" into Field "Declare"
put Field "Declare" & "<p><b><u>The user accepts full responsibility for data and calculation results.</b></u> <p></p></p>" into Field "Declare"
put Field "Declare" &"<p>If you register the software with us, you can display your name and contact details on the printouts and send them to Building Control with your application/completion.</p><p></p>" into Field "Declare"
put Field "Declare"&"<p>This calculator can have your own branding on the right side of this splash screen (it would be wider of course to take the branding panel). Just contact us for details. </p><p></p>" into Field "Declare"
put Field "Declare" &"<p><b>TIP </b>Hover the mouse cursor over input fields, many offer help. </p>" into Field "Declare"
put Field "Declare"&"<p>You should read the <b>Water conservation and safety issues.pdf</b> included with this downlod as well as refer to our web site for essential information. </p><p></p>" into Field "Declare"
set the htmltext of Field "Declare" to Field "Declare"
put empty into image "brandimage"
--Check for jpeg file
if fileslst contains "brandimage.jpg" then
set the Height of stack "AD Part G" to 340
set the width of stack "AD Part G" to 672
set the loc of stack "AD Part G" to the screenLoc
--set the backgroundColor of stack "AD Part G" to 128,255,255
put "binfile:brandimage.jpg" into filnam
put url (filnam) into image "brandimage"
else
set the Height of stack "AD Part G" to 340
set the width of stack "AD Part G" to 454
set the loc of stack "AD Part G" to the screenLoc
--set the backgroundColor of stack "AD Part G" to 128,255,255
end if
set the backgroundColor of stack "AD Part G" to 128,255,255
if item 3 of the screenRect < 1024 or item 4 of the screenRect < 768 then
answer error "MyApp requires a 1024x768 or larger screen." with "Sorry"
end if
end preopencard
This is contained in the first card and should be the first thing to run after clicking the exe
My (bracketed) comment in the original post shows the effect of adding each of the two lines, in the order you see them.
I have noticed another strange issue in Task manager. To exit my program i click the top right X rather than a Quit or Exit button. The program appears to quit in the normal way, but it shows as still being active in the PROCESSES tab of Task Manager. Have you any idea why?
I look forwared to your reply.
You can see the software at www.ajperks.co.uk the Water Efficiency Calculator.
Startup process means when the exe is clicked on.
The script is more or less as I have shown, but I paste the actual script here:-
on preopencard
local fileslst,filnam,Linecount,Temptext
go to stack "Scratchpad"
go to stack "AD Part G"
hide stack "Scratchpad"
put the files into fileslst
if fileslst contains "Scratchpad.txt" then
put url "File:Scratchpad.txt" into field "Scratchpad" of stack "Scratchpad"
-----Moved to preopen card 1005-----
--if the length of line 1 of field "Scratchpad" of stack "Scratchpad" < 3 then
--put empty into line 1 of field "Scratchpad" of stack "Scratchpad"
--delete line 1 of field "Scratchpad" of stack "Scratchpad"
--end if
else
--Populate Scratchpad list
Put "Bedroom 1 en-suite" into line 1 of field "Scratchpad" of stack "Scratchpad"
Put "Bedroom 2 en-suite" into line 2 of field "Scratchpad" of stack "Scratchpad"
Put "Bedroom 3 en-suite" into line 3 of field "Scratchpad" of stack "Scratchpad"
Put "Cloakroom" into line 4 of field "Scratchpad" of stack "Scratchpad"
Put "Kitchen" into line 5 of field "Scratchpad" of stack "Scratchpad"
Put "Main bathroom" into line 6 of field "Scratchpad" of stack "Scratchpad"
Put "Shower room" into line 7 of field "Scratchpad" of stack "Scratchpad"
Put "Undefined" into line 8 of field "Scratchpad" of stack "Scratchpad"
Put "Utility room" into line 9 of field "Scratchpad" of stack "Scratchpad"
put field "Scratchpad" of stack "Scratchpad" into url "File:Scratchpad.txt"
end if
-- Display splash message
put "<p><u><b>IMPORTANT NOTICE.</b></u></p>" into Field "Declare"
put Field "Declare" & "<p><b><u>The user accepts full responsibility for data and calculation results.</b></u> <p></p></p>" into Field "Declare"
put Field "Declare" &"<p>If you register the software with us, you can display your name and contact details on the printouts and send them to Building Control with your application/completion.</p><p></p>" into Field "Declare"
put Field "Declare"&"<p>This calculator can have your own branding on the right side of this splash screen (it would be wider of course to take the branding panel). Just contact us for details. </p><p></p>" into Field "Declare"
put Field "Declare" &"<p><b>TIP </b>Hover the mouse cursor over input fields, many offer help. </p>" into Field "Declare"
put Field "Declare"&"<p>You should read the <b>Water conservation and safety issues.pdf</b> included with this downlod as well as refer to our web site for essential information. </p><p></p>" into Field "Declare"
set the htmltext of Field "Declare" to Field "Declare"
put empty into image "brandimage"
--Check for jpeg file
if fileslst contains "brandimage.jpg" then
set the Height of stack "AD Part G" to 340
set the width of stack "AD Part G" to 672
set the loc of stack "AD Part G" to the screenLoc
--set the backgroundColor of stack "AD Part G" to 128,255,255
put "binfile:brandimage.jpg" into filnam
put url (filnam) into image "brandimage"
else
set the Height of stack "AD Part G" to 340
set the width of stack "AD Part G" to 454
set the loc of stack "AD Part G" to the screenLoc
--set the backgroundColor of stack "AD Part G" to 128,255,255
end if
set the backgroundColor of stack "AD Part G" to 128,255,255
if item 3 of the screenRect < 1024 or item 4 of the screenRect < 768 then
answer error "MyApp requires a 1024x768 or larger screen." with "Sorry"
end if
end preopencard
This is contained in the first card and should be the first thing to run after clicking the exe
My (bracketed) comment in the original post shows the effect of adding each of the two lines, in the order you see them.
I have noticed another strange issue in Task manager. To exit my program i click the top right X rather than a Quit or Exit button. The program appears to quit in the normal way, but it shows as still being active in the PROCESSES tab of Task Manager. Have you any idea why?
I look forwared to your reply.
You can see the software at www.ajperks.co.uk the Water Efficiency Calculator.
Re: how does stack run its substack
Hi a-revuser,
ok, I see.
And what exactly does not work or not work as exspected?
Hints:
1. Add more specific descriptors
...
put url "File:Scratchpad.txt" into field "Scratchpad" OF CARD 1 of stack "Scratchpad"
...
2. If the app does not really quit, please check if you have some pending messages pending
Anything that got "send xyz ot zyx in X seconds" to an object periodically.
3. Maybe there is still an ivisible stack open?
Closing ONE window does not necessarily^mean to really QUIT the app!
Best
Klaus
ok, I see.
And what exactly does not work or not work as exspected?
Hints:
1. Add more specific descriptors
...
put url "File:Scratchpad.txt" into field "Scratchpad" OF CARD 1 of stack "Scratchpad"
...
2. If the app does not really quit, please check if you have some pending messages pending

Anything that got "send xyz ot zyx in X seconds" to an object periodically.
3. Maybe there is still an ivisible stack open?
Closing ONE window does not necessarily^mean to really QUIT the app!
Best
Klaus
Re: how does stack run its substack
Dear Klaus,
Could I refer you back to the original post.
It explains the problem by stating I was not satisfied that starting a substack with "go to" was correct, though it worked!
I then showed the result of adding the two lines of code with the description between brackets.
Put another way, I originally thought the substack would run automatically as a result of being compiled with the main stack. It turned out that the substack would not run and needed something to bring it to life like using "Go to ......"
I wonder if this is all linked with the fact the main exe still shows in task manager when I close it?
Could I refer you back to the original post.
It explains the problem by stating I was not satisfied that starting a substack with "go to" was correct, though it worked!
I then showed the result of adding the two lines of code with the description between brackets.
Put another way, I originally thought the substack would run automatically as a result of being compiled with the main stack. It turned out that the substack would not run and needed something to bring it to life like using "Go to ......"
I wonder if this is all linked with the fact the main exe still shows in task manager when I close it?
Re: how does stack run its substack
Hi a-revuser,
well, this is the way Rev works:
1. You doubleclick the app/exe
2. The MAINSTACK opens and appears on the screen automatically.
3. Everything else (like opening substacks) needs to be scripted!
See the the main-/substack concept as a convenient way to have several "documents" in ONE file on disk.
This is how this intended (and invented) to work.
Regarding the exe still in the task manager:
Try to really "quit" (with a button or whatever) and then check if the app is still in the task manager.
Best
Klaus
well, this is the way Rev works:
1. You doubleclick the app/exe
2. The MAINSTACK opens and appears on the screen automatically.
3. Everything else (like opening substacks) needs to be scripted!
See the the main-/substack concept as a convenient way to have several "documents" in ONE file on disk.
This is how this intended (and invented) to work.
Regarding the exe still in the task manager:
Try to really "quit" (with a button or whatever) and then check if the app is still in the task manager.
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 163
- Joined: Tue Jan 26, 2010 10:15 pm
- Contact:
Re: how does stack run its substack
Hello a-revuser,
In other programming languages, you need to open a window before to interact with the objets it contains. This is same with Revolution.
For understanding how stacks works in Revolution, consider the mainstack as the core of your program and substacks as expansion windows of your application.
For example if you want to create a mailing application, you will have :
- the mail list and action buttons in the mainstack
- a window/substack to manage contacts
- a window to set preferences
- a window to create a mail
- a window to advert user about processing
- etc.
Checked now your Rev documentation :
"open" is a synonym for "go"
"window" is a synonym for "stack"
It means that instead to write
you can also write
Note that "to" is optional.
At last, a trick to open your "Scratchpad" stack:
Instead to write:
You could write:
Hope that this small explanation clarify things,
Regards,
In other programming languages, you need to open a window before to interact with the objets it contains. This is same with Revolution.
For understanding how stacks works in Revolution, consider the mainstack as the core of your program and substacks as expansion windows of your application.
For example if you want to create a mailing application, you will have :
- the mail list and action buttons in the mainstack
- a window/substack to manage contacts
- a window to set preferences
- a window to create a mail
- a window to advert user about processing
- etc.
Checked now your Rev documentation :
"open" is a synonym for "go"
"window" is a synonym for "stack"
It means that instead to write
Code: Select all
go to stack "Scratchpad"
Code: Select all
open window "Scratchpad"
At last, a trick to open your "Scratchpad" stack:
Instead to write:
Code: Select all
go to stack "Scratchpad"
go to stack "AD Part G"
hide stack "Scratchpad"
Code: Select all
go invisible to stack "Scratchpad"
go to stack "AD Part G"
Hope that this small explanation clarify things,
Regards,
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel
Re: how does stack run its substack
Hi all,
...
## File on the disk:
put the text of fld "any field" of cd 2 of stack "/Applications/Revolution Enterprise/any_not_open_stack.rev" into tText
...
## Or access a substack from a mainstack
put the hilite of btn "any button" of cd 3 of stack "name of substack" into tHilite
## or to avoid problems if you have several stacks with the same name (NO GO!
):
put the hilite of btn "any button" of cd 3 of stack "name of substack" OF ME into tHilite
...
etc.
Internally Rev will then "kind of" open this stack without the stack appearing in "the openstacks".
Like "behind the curtain"
You can even:
...
## File on the disk:
put "This is new text..." into fld "any field" of cd 2 of stack "/Applications/Revolution Enterprise/any_not_open_stack.rev"
## But then you also have to:
save stack "/Applications/Revolution Enterprise/any_not_open_stack.rev"
...
I hope this clarifies things a bit
Best
Klaus
This is not true! You can access objects of stacks (substacks or even stackfiles on the hd!) without opening them!Zryip TheSlug wrote:...In other programming languages, you need to open a window before to interact with the objets it contains. This is same with Revolution....
...
## File on the disk:
put the text of fld "any field" of cd 2 of stack "/Applications/Revolution Enterprise/any_not_open_stack.rev" into tText
...
## Or access a substack from a mainstack
put the hilite of btn "any button" of cd 3 of stack "name of substack" into tHilite
## or to avoid problems if you have several stacks with the same name (NO GO!

put the hilite of btn "any button" of cd 3 of stack "name of substack" OF ME into tHilite
...
etc.
Internally Rev will then "kind of" open this stack without the stack appearing in "the openstacks".
Like "behind the curtain"

You can even:
...
## File on the disk:
put "This is new text..." into fld "any field" of cd 2 of stack "/Applications/Revolution Enterprise/any_not_open_stack.rev"
## But then you also have to:
save stack "/Applications/Revolution Enterprise/any_not_open_stack.rev"
...
I hope this clarifies things a bit

Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 163
- Joined: Tue Jan 26, 2010 10:15 pm
- Contact:
Re: how does stack run its substack
Hi Klaus,
So in my mailing program example, by interact I had in mind that a user can performs action with the objects in a window like type a mail, give parameters in other window, etc.
I confess that I have not totally understand what was wrong to a-revuser with the syntax or what else.
Apologies if I have made things confused. In the sense that my sentence could been interpreted, I've also to precise that others language (not all I use) could have capabilities to reference or access objects in closed window / form.
I hope that the rest of my post is more readable than the first sentence...
The question that I have here, is about security.
Imagine I ask to a stack in my disk all the fields that each card contains and I would retrieve their contents.
Imagine now that you are the creator of this stack and you have protected all the content of your stack by using a password when normal users open it. How you could protect datas in your fields if others programmers can access to your stack without open it?

So we can test if a substack exists with "there is a stack myStack" whereas we have never opened its window.


Regards,
Hum... In fact by interact I would like to say doing physically something in a window like click on a button or type some text in a field, not reference or access programmatically to an object.Klaus wrote:Hi all,
This is not true! You can access objects of stacks (substacks or even stackfiles on the hd!) without opening them!Zryip TheSlug wrote:...In other programming languages, you need to open a window before to interact with the objets it contains. This is same with Revolution....
So in my mailing program example, by interact I had in mind that a user can performs action with the objects in a window like type a mail, give parameters in other window, etc.
I confess that I have not totally understand what was wrong to a-revuser with the syntax or what else.
Apologies if I have made things confused. In the sense that my sentence could been interpreted, I've also to precise that others language (not all I use) could have capabilities to reference or access objects in closed window / form.
I hope that the rest of my post is more readable than the first sentence...
Thanks to have point me this usage out. If I understand well we can reference any stack in a disk without charging it in memory.Klaus wrote: ...
## File on the disk:
put the text of fld "any field" of cd 2 of stack "/Applications/Revolution Enterprise/any_not_open_stack.rev" into tText
The question that I have here, is about security.
Imagine I ask to a stack in my disk all the fields that each card contains and I would retrieve their contents.
Imagine now that you are the creator of this stack and you have protected all the content of your stack by using a password when normal users open it. How you could protect datas in your fields if others programmers can access to your stack without open it?
I'm using this kind of reference in my color picker small projectKlaus wrote: ...
## Or access a substack from a mainstack
put the hilite of btn "any button" of cd 3 of stack "name of substack" into tHilite
## or to avoid problems if you have several stacks with the same name (NO GO!):
put the hilite of btn "any button" of cd 3 of stack "name of substack" OF ME into tHilite
...
etc.

Right, they are in memory but not returned in the lines of the openstacks function.Klaus wrote:Internally Rev will then "kind of" open this stack without the stack appearing in "the openstacks".
Like "behind the curtain"![]()
So we can test if a substack exists with "there is a stack myStack" whereas we have never opened its window.
Hum this is afraid me a bit, hope you will reassure me soon.Klaus wrote: You can even:
...
## File on the disk:
put "This is new text..." into fld "any field" of cd 2 of stack "/Applications/Revolution Enterprise/any_not_open_stack.rev"
## But then you also have to:
save stack "/Applications/Revolution Enterprise/any_not_open_stack.rev"
...

Thanks to have pointed out that my vocabulary is not always the most appropriateI hope this clarifies things a bit![]()

Regards,
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel
Re: how does stack run its substack
Thank you all for your advice.
It appears I have explained myseld poorly, but I now have the answer. I set it out here so others may benefit.
Assume the main stack is running and the substack is now needed. In my case it is triggered by the on preopencard handler in the main exe. This is because the substack is required to show ONLY with certain main stack cards. So the substack opens when I go into the specific main card and vanishes from view when leaving the specific main stack card.
open stack "Scratchpad" (to get it into memory but it will not be displayed on the first call)
show stack "Scratchpad" (to get it to display when needed)
If you terminate the main exe at this stage, the program will disapear in the normal way, but still be running as a process in the task manager and running the EXE and terminating as above will keep adding more EXEs in the task manager.
In my case, I will close the substack by using the on closecard handler in the main exe and the substack vanishes from view.
close stack "Scratchpad"
At this point, if the main stack is terminated, the substack has already been closed so nothing is left running in the task manager.
That is the sort of answer I was looking for.
It appears I have explained myseld poorly, but I now have the answer. I set it out here so others may benefit.
Assume the main stack is running and the substack is now needed. In my case it is triggered by the on preopencard handler in the main exe. This is because the substack is required to show ONLY with certain main stack cards. So the substack opens when I go into the specific main card and vanishes from view when leaving the specific main stack card.
open stack "Scratchpad" (to get it into memory but it will not be displayed on the first call)
show stack "Scratchpad" (to get it to display when needed)
If you terminate the main exe at this stage, the program will disapear in the normal way, but still be running as a process in the task manager and running the EXE and terminating as above will keep adding more EXEs in the task manager.
In my case, I will close the substack by using the on closecard handler in the main exe and the substack vanishes from view.
close stack "Scratchpad"
At this point, if the main stack is terminated, the substack has already been closed so nothing is left running in the task manager.
That is the sort of answer I was looking for.