Controls in a stack

Robert Sneidar slylabs13 at me.com
Tue Jan 22 14:05:15 EST 2013


I've been thinking about this from the perspective of creating a compact stack definition. You obviously must check for duplicate controls if you are going to loop through the controls of every card, as a shared background will appear to belong to any card you are on that it is placed on. 

So then one final step to getting all the backgrounds of the stack (including the ones not placed anywhere) would be to create a new card and loop through the number of backgrounds of this stack, placing each one, then recording the controls, checking for their existence first before adding them to your array. When done delete the card. You can even mark the group as not belonging to any card because if you have already gone through all the cards of a stack and a group has not been placed, then you encounter one that is not in your array yet, this is obviously one that has not been placed on any card. 

I hope that is not too convoluted. It makes sense in my head, but that is no guarantee that it doesn't appear to be babbling to others. ;-)

Bob


On Jan 22, 2013, at 10:11 AM, Peter Haworth wrote:

> Thanks Kay and Phil.
> 
> I've gone back to using the original handler since obviously getting the
> controls of a stack isn't reliable.  I feel like missing random controls in
> multi card stacks is a bug, but my opinion on what is a bug and what isn't
> seems to differ from others on this list so what do you think?  I doubt
> there's any chance of it being fixed but I don;t think that's a reason to
> not report it.
> 
> Phil, thanks for the array tip - turns out I am using an array although not
> for the reason you mentioned.  Sometimes you just get lucky I guess!  Not
> sure how to deal with the backgrounds that aren't on any cards.  I have
> rarely used backgrounds but out of interest, does the IDE Application
> Browser show these unplaced backgrounds?
> 
> 
> Pete
> lcSQL Software <http://www.lcsql.com>
> 
> 
> On Mon, Jan 21, 2013 at 9:48 PM, Phil Davis <revdev at pdslabs.net> wrote:
> 
>> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>>> 
>>> 
>> --
>> Phil Davis
>> 
>> 
>> 
>> ______________________________**_________________
>> 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<http://lists.runrev.com/mailman/listinfo/use-livecode>
>> 
> _______________________________________________
> 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





More information about the use-livecode mailing list