SetButtonName(id, name)

Feature requests for future versions of Hollywood can be voiced here
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

SetButtonName(id, name)

Post by Bugala »

It would be nice to have a way to change Buttons ID, or even better, set a name for them (which could be later on changed the same way as layers names)

For I am actually right now having bit of a problem with my code that I need to rewrite since I only now noticed i cant change buttons ID.

For so far my program had relied on knowing which button number was being pressed, and that way knowing which layer etc. to move.

But now that I am removing a button from middle, it is going to be very problematic since so far I had made the program to be in way that there was always numbers from 1 to n available for layers and all, and now it seems i need to rethink the system.
PEB
Posts: 569
Joined: Sun Feb 21, 2010 1:28 am

Re: SetButtonName(id, name)

Post by PEB »

Creating a custom name by using Nil in the id with MakeButton() doesn't do what you want?
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: SetButtonName(id, name)

Post by Bugala »

hmm, didnt notice that one before.

the problem with my program is that i use things like:

Code: Select all

for n = 1 to numberofbuttons
   do something for ("buttonlayer"..n)
   do something for ("buttonhighlightlayer"..n)
next

or

function OnMouseUp(msg)
do something for ("buttonlayer"..msg.id)
The rest of the program works in way that if button2 is removed, then layers 3 and 4 are renamed as "layer2" and "layer3" making things go again in way of 1, 2 and 3. (to make usage of for n = 1 to x working)

So if i remove button id 2 and layer2 then problem comes when i mexecuting for n = 1 to numberofbuttons, for it would try to do something not just for layers 1, 3 and 4, but also for number 2 that doesnt exist anymore.

But I might be able to figure out some solution based upon that NIL feature, for i suppose it works in way that if i have buttons 1, 3 and 4, then using NIL would fill the number 2.
PEB
Posts: 569
Joined: Sun Feb 21, 2010 1:28 am

Re: SetButtonName(id, name)

Post by PEB »

You should probably read the documentation dealing with the auto ID selection.
Post Reply