Reset Control ID Numbering

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
raugert
Posts: 112
Joined: Thu May 26, 2016 9:30 pm

Reset Control ID Numbering

Post by raugert » Thu Jan 31, 2019 11:37 pm

I have an app where it generates new controls from a .csv file each time it is opened. So the control ID numbers are being regenerated each time and are getting up to 7 digit numbers now. I understand from previous posts that the newly generated control ID numbers continue off from the last saved version when developing. But I couldn't find a solution to reset these. I'm still developing the same app and I save and test often, so the numbers will keep augmenting. Is there any way to reset them so they don't continue to grow ?

thanks,
Richard
Livecode Indy 9.6.11 (Stable)
MacOS Sonoma 14.2
Xcode 15.0.1 SDK 17.0

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Reset Control ID Numbering

Post by dunbarx » Thu Jan 31, 2019 11:44 pm

Hi.

For controls, ID's are assigned at creation and cannot be changed. In fact, the ID for a deleted object is retired, and cannot be used.

See the dictionary. Stacks and images are different in this regard, but that will not help you.

Might you ignore the actual ID, and use the "altID" instead? This is a property that is open to you.

Craig Newman

raugert
Posts: 112
Joined: Thu May 26, 2016 9:30 pm

Re: Reset Control ID Numbering

Post by raugert » Fri Feb 01, 2019 12:41 am

Thanks for the quick reply Craig !

I thought that might be the case. A large part of my app is built around using the control ID's from the newly generated controls. It works well as is, I just thought the numbers were getting a little big:) . As long as it doesn't affect the performance, I'm ok with it..

much appreciated,
Richard
Livecode Indy 9.6.11 (Stable)
MacOS Sonoma 14.2
Xcode 15.0.1 SDK 17.0

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Reset Control ID Numbering

Post by FourthWorld » Fri Feb 01, 2019 12:49 am

You'll have at least two billion new objects before you need to think about a reset. An automated moving of objects to a new stack can cover that - if you get that far let us know. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Reset Control ID Numbering

Post by mwieder » Fri Feb 01, 2019 5:14 am

Richard (raugert) - you can change object IDs after creation, as long as you don't duplicate existing ones.

In general, new objects are created with sequential IDs, starting from the ID of the stack itself. You can set the ID of the stack itself, but that's not very rewarding since you can only bump it up, not down. But all other controls (and cards) have mutable IDs.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Reset Control ID Numbering

Post by dunbarx » Fri Feb 01, 2019 3:26 pm

Yep, Mark is correct.

You know, I knew this about LC. I was still stuck in HC thinking, where you cannot change the ID.

But the dictionary explicitly says it ain't so, that a control's ID is immutable. This seems to be, er, wrong. I am sending this to QCC.

Craig

Post Reply