Page 1 of 1

Check If stack is Opened IN LC

Posted: Thu Jun 28, 2018 1:15 pm
by mrcoollion
I am not able to find out if a stack is open from within another stack.
I have the Stack ID ( tStackID ) and have opened the stack in LC but the following statements do not work :shock:

Code: Select all

if there is a stack ID tStackID then.........

Code: Select all

put the name of stack ID tStackID into tStackName
Any ideas?

Re: Check If stack is Opened IN LC

Posted: Thu Jun 28, 2018 1:40 pm
by Klaus
Dag mijnheer,

stacks have a MODE property, see dictionary.
Important for you is Mode 0: closed but loaded!

Code: Select all

...
if the mode of stack id tStackID = 0 then
## stack is closed
else
## stack is OPEN, check the other 12 possible MODES in the dictionary
end if
...
Best

Klaus

Re: Check If stack is Opened IN LC

Posted: Thu Jun 28, 2018 3:51 pm
by mrcoollion
Dank Klaus,

Re: Check If stack is Opened IN LC

Posted: Thu Jun 28, 2018 4:34 pm
by FourthWorld
The openStacks function will return a list of open stacks, e.g.:

Code: Select all

if "MyStack" is among the lines of openStacks() then...

Re: Check If stack is Opened IN LC

Posted: Thu Jun 28, 2018 4:37 pm
by Klaus
FourthWorld wrote:
Thu Jun 28, 2018 4:34 pm
The openStacks function will return a list of open staxks, e.g.:

Code: Select all

if "MyStack" is among the lines of openStacks() then...
Well, erm..., yes. :D

Re: Check If stack is Opened IN LC

Posted: Thu Jun 28, 2018 9:47 pm
by mrcoollion
I used this as a work around with a popup menu button to select the stack.
But using the ID of a stack to check if it is opened in LC and using the ID to get the stack name and Title does not work...

But for now all is fine...

Thanks for the support :D

Here is the code from the Pull down menu button for anybody who is curious.

Code: Select all

on mouseDown
   put the mainstacks into tListmainStacks
   put tListmainStacks into tStacksList
   if the highlited of btn "FilterOnOff" is true
   then
      filter tStacksList without "com.*" 
      filter tStacksList without "rev*"
   end if
   set the text of btn "SelectAStack" to tStacksList
end mouseDown

on menuPick pItemName
   if pItemName is empty 
   then
      exit menuPick
   end if
   put pItemName into tStackName
   if there is a stack tStackName 
   then
      Put the ID of stack tStackName into tStackID
      Put the title of stack tStackName into tStackTitle
   else
      answer "Stack does not exists ?!"
      exit menuPick
   end if
   Put tStackID into fld "StackID"
   Put tStackName into fld "StackName"
   Put tStackTitle into fld "StackTitle"
end menuPick