Search code examples
livecode

How to get list card of stack ? - livecode


I want to get list card and list objects of stack by name.

Before.I ask question "How to find stack of Project Browser ? - livecode".I can do it.

Now.I want to get list card and list objects of stack by name.

Can anyone show example code for me please ?

Here my code for get number of cards of this stack

answer the number of cards of this stack

But my code this error for get name card

answer the name of cards of this stack

-------I can solve this problem-------

on mouseUp
   put the number of cards of this stack into numC
   repeat with crd = 1 to the number of cards of this stack
      answer the name of card crd
   end repeat
end mouseUp

Solution

  • Here's an example that creates an array with the stack card names as keys. Each array element contains a list of the controls for the card.

    on mouseUp
       local tCurrentStack, tCards, tCurrentCard, tControlsA
    
       put "MyStack" into tCurrentStack
       put the cardNames of stack tCurrentStack into tCards
       repeat with tCardIndex = 1 to the number of lines in tCards
          put line tCardIndex of tCards into tCurrentCard
          repeat with tControlIndex = 1 to the number of controls in card tCurrentCard of stack tCurrentStack
             put the name of control tControlIndex of card tCurrentCard of stack tCurrentStack & LF after tControlsA[tCurrentCard]
          end repeat
       end repeat
    end mouseUp
    

    to show the controls from card "MyCard"...

    put tControlsA["MyCard"]