Controls in a stack

Phil Davis revdev at pdslabs.net
Tue Jan 22 00:48:17 EST 2013


Another twist in the pursuit of truth:
Backgrounds not placed on any card are included in "the number of 
backgrounds in this stack" but nowhere else. (Neither are their 
controls) You have to place them onto a card to count their controls.

You could cycle through all the cards and do this:
     put the name of control x of this cd into tControlArray[ the short 
id of control x of this cd ]

When you're done, the array structure itself will have eliminated 
duplicate references. tControlArray contains all control names keyed by 
their unique IDs. Except for those pesky 0 ID controls. And the controls 
in any unplaced BGs.

Phil Davis


On 1/21/13 9:14 PM, Kay C Lan wrote:
> On Tue, Jan 22, 2013 at 3:29 AM, Peter Haworth <pete at lcsql.com> wrote:
>> Looking at the controls that are missed, they are almost all from stacks
>> that contain multiple cards, seemingly randomly missing a few from each
>> card.  There are also a handful that have an id of zero which I didn't
>> think was possible but that's another topic.
> Quick test:
>
> 1) New Main Stack
> 2) Add a button,
> 3) Add a new card
> 4) Add a button
> 5) Go back to cd 1 and group the single btn and turn it into a background
> 6) Add a Card (this should come with the  bkgnd btn)
> 7) Add to this a normal btn.
>
> So you should have a 3 card stack with 1 card that has a bkgnd btn on
> it, a 2nd card with a bkgnd btn + a normal btn, and a 3rd card with
> just a normal btn.
>
> Total number of controls for the stack is 4 (a group for the bkgnd, a
> btn in the bkgnd group, and two normal btns.
>
> In the msg box if I enter:
>
> put the number of controls of stack "test"
>
> the answer I get back is always the number of controls of the current
> front most card of the stack, I can not get 4 as the answer.
>
> So if I happen to be on the card with only the normal btn, then the
> answer is 1, the answer you want is 4, and if I loop through the cards
> the answer I get is 6.
>
> As you've already figured, the problem is associated with multi-card
> stacks, from what I can tell 'the number of controls of this stack'
> will never give the correct answer for a multi-card stack, and if you
> loop through all the cards you'll end up duplicating the process for
> any background controls.
>
> HTH
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

-- 
Phil Davis





More information about the use-livecode mailing list