How to Reset ID's of Controls

Ender Nafi Elekcioglu endernafi at keehuna.com
Tue Jan 28 02:18:28 EST 2014


As Alan and John suggested;
The standalone reverts back to its initial state; no matter how many controls/ids are created during runtime.
*answer the id of this stack* returns 1.008.815 each time I open the app in the simulator or device.

Combining this fact with Richard's info:
"IDs are 4-byte integers, so the range goes all the way up to 4294967295. "

All in all, it seems that there's little to worry about.


Gerry:
"No one ever quits Ender's apps (they are just too good) so he still has a problem :)"

I hope nobody loves my apps that much :)

~ ~ ~

Mark:
"That sounds wrong. Controls in a background group should also be in the
background."

I couldn't find the reason nor the solution to this.
I've checked the properties of the background group until my eyes pop out.
No luck, it's background group, it's shared.
Of course, the id of it is same on each card: 1024.
But the contents change across cards with no clear pattern to pinpoint where the actual problem lays.

That happened after I copied my cards to an empty stack to reset the ids.
So, I reverted back to my previous build with high ID numbers.
It works now and I believe in *Don't fix if it works!*


Mark:
"> I have tens of cards, each one has hundreds of controls 
> and I create those controls on each time the user navigates to those cards.

Why? When I need to do something like that I will most likely show/hide
groups of controls rather than copying them or making them from scratch.
That way you don't have to be concerned about the id pool, as nothing is
being created or destroyed."

Stephen:
"not to mention it would take more computing time to create and display 
rather than show and hide."


Ok, I'm open to new ideas here.
This is a news app, so the content change dynamically.
Which controls should I show/hide?
I don't know beforehand how many images/fields my app will need.
Every minute or so, a new content arrives 
and I have to create a new group {thumbnail, header, summary} for it.

Is this a wrong approach, am I mistaking?


Regards,

~ Ender


More information about the use-livecode mailing list