Quantcast
Channel: LiveCode Forums
Viewing all articles
Browse latest Browse all 440

Getting Started with LiveCode - Experienced Developers • Cards controls loop?

$
0
0
Hello,

I would like to search for all occurrences of a string in all scripts of a stack.
My first idea was to loop over all cards in the stack, and then loop over all controls of that card. But the problem is that if some cards contain "behave like a background" groups, the controls of those groups will appear on all those cards - that's the principle of a background - and therefore my loop will contain repetitions in the occurrences found.

I don't know if I'm very clear, so here's a diagram of a stack as it appears in the Project Browser:

CODE:

MyStackCard_1Background_Group_A // Behave like a backgroundBtn_A_1Btn_A_2Background_Group_B // Behave like a backgroundBtn_B_1Card_1_Group// card groupFld_1Card_2Background_Group_ABtn_A_1Btn_A_2Background_Group_BBtn_B_1
My loop will search in the scripts of the control Btn_A_1 of card Card_1, and also in the control Btn_A_1 of card Card_2, which is an unnecessary repetition and produces duplicate results.

Of course, I could list the controls as I loop, and then test if the current control is already listed, but that seems a bit slow and crude. Is there a more elegant and faster way?

Statistics: Posted by Zax — Thu Aug 08, 2024 7:42 am



Viewing all articles
Browse latest Browse all 440

Trending Articles