Rename an Icon?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Rename an Icon?
Hello,
I have imported as control some image files and saved them to a separate card in my stack. I want to use these images as button icons. I am making a spinner game and the id of the images keeps changing. For example, my image is called horse and it's ID is 210041 in the icon menu. I go into my code and change it to reflect the ID 210041 and go back and find it is now changed to 210053 (or something similar) I have looked at the remote control tutorial and it mentions going to the "player card" and also the "property inspector" and select "icons." The latest liveCode version doesn't have these and I don't know how to rename the images so that they don't keep changing numbers. I would like to name them "horse" etc. without a number if possible but if I do need to use a number, how do I get an icon number that won't change? Thank you!
I have imported as control some image files and saved them to a separate card in my stack. I want to use these images as button icons. I am making a spinner game and the id of the images keeps changing. For example, my image is called horse and it's ID is 210041 in the icon menu. I go into my code and change it to reflect the ID 210041 and go back and find it is now changed to 210053 (or something similar) I have looked at the remote control tutorial and it mentions going to the "player card" and also the "property inspector" and select "icons." The latest liveCode version doesn't have these and I don't know how to rename the images so that they don't keep changing numbers. I would like to name them "horse" etc. without a number if possible but if I do need to use a number, how do I get an icon number that won't change? Thank you!
Re: Rename an Icon?
The latest livecode has all the stuff you say it doesn’t… but I suppose that’s an indictment of the IDE more than anything else.
The “numbers” you mention are (or should be) the “id” which all controls and visible constructs have. The name is independent of this and. You can carnage the names without consequence.
Be aware the id will change if you copy/past the image however - it’s allocated by the IDE.
The are are multiple nuances to “name”.
The name as such includes the class (ie image <myImage>)
The short name is the purr name (ie <myImage>)
The long name fully qualifies full ownership of the control (ie image <myImage> of card <myCard> of stack <myStack>)
OR you can refer to it by id, which is unique to the stack (ie image id 10024)
Likewise the long id fully qualifies ownership (ie image id 12345 of card 43435 of stack )
The inspector appears any time you double click on a control. In contrast to older tutorials, the various sections in the PI are now tiny icons at the top of the inspector. If you open the PI for a button you will see a section for icons…
Hope this answers your questions?
The “numbers” you mention are (or should be) the “id” which all controls and visible constructs have. The name is independent of this and. You can carnage the names without consequence.
Be aware the id will change if you copy/past the image however - it’s allocated by the IDE.
The are are multiple nuances to “name”.
The name as such includes the class (ie image <myImage>)
The short name is the purr name (ie <myImage>)
The long name fully qualifies full ownership of the control (ie image <myImage> of card <myCard> of stack <myStack>)
OR you can refer to it by id, which is unique to the stack (ie image id 10024)
Likewise the long id fully qualifies ownership (ie image id 12345 of card 43435 of stack )
The inspector appears any time you double click on a control. In contrast to older tutorials, the various sections in the PI are now tiny icons at the top of the inspector. If you open the PI for a button you will see a section for icons…
Hope this answers your questions?
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Rename an Icon?
You can, obviously, name all the images you use as icons.
If you want to give your images numbers, then to avoid the problem with the IDE mucking around with image ID numbers surely the best thing to do is name the images with numbers?
This will mean that the image you name "27" will still be called "27" if the IDE for some reason changes image "27"'s ID from 2013 to 2078.
If you want to give your images numbers, then to avoid the problem with the IDE mucking around with image ID numbers surely the best thing to do is name the images with numbers?
This will mean that the image you name "27" will still be called "27" if the IDE for some reason changes image "27"'s ID from 2013 to 2078.
-
- VIP Livecode Opensource Backer
- Posts: 4036
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Rename an Icon?
Please do not use numbers to name an object.richmond62 wrote: ↑Mon Mar 25, 2024 10:02 amYou can, obviously, name all the images you use as icons.
If you want to give your images numbers, then to avoid the problem with the IDE mucking around with image ID numbers surely the best thing to do is name the images with numbers?
This will mean that the image you name "27" will still be called "27" if the IDE for some reason changes image "27"'s ID from 2013 to 2078.
From the user guide
search for that string in the user guide for an explanation.Avoid using numbers as object names
Also you should avoid using numbers as first character of an object name. It is ok to use numbers in object names like "myButton2"
Kind regards
Bernd
Re: Rename an Icon?
GUYS - the OP never stated (s)he was using numbers as names. Quite the opposite...
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Rename an Icon?
True.
Personally I always do THIS sort of thing when I want numbered image sequences:
'X1', 'X2', 'X3' . . .
Personally I always do THIS sort of thing when I want numbered image sequences:
'X1', 'X2', 'X3' . . .
-
- VIP Livecode Opensource Backer
- Posts: 4036
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Rename an Icon?
Hi Pugalug,
Kind regards
Bernd
You could name your images like "horse1", "horse2" etc. and thenI have imported as control some image files and saved them to a separate card in my stack. I want to use these images as button icons. I am making a spinner game and the id of the images keeps changing
Code: Select all
set the icon of button "myHorseButton" to the short id of image "horse1" of card "myImages"
Code: Select all
set the icon of button "myHorseButton" to the short id of image "horse2" of card "myImages"
Bernd
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Rename an Icon?
Yeeeeees: I got hold of the wrong end of the stick: Sorry.
- -
https://www.dropbox.com/s/kzcrkbqsyfzej ... e.zip?dl=0
- -
https://www.dropbox.com/s/kzcrkbqsyfzej ... e.zip?dl=0
Re: Rename an Icon?
The OP's issue was that the ID he was using appears to be changing. The naming is a different issue.
I'm not aware this can happen unless the image has been duplicated/pasted - but perhaps I'm wrong.
S.
I'm not aware this can happen unless the image has been duplicated/pasted - but perhaps I'm wrong.
S.
-
- Livecode Opensource Backer
- Posts: 9477
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Rename an Icon?
Once an image has been imported into a stack its ID should never change.
The only way I can see someone thinking this is happening is if they are copy-pasting and/or duplicating the image onto different cards.
The only way I can see someone thinking this is happening is if they are copy-pasting and/or duplicating the image onto different cards.
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Rename an Icon?
I imported an image onto a card and recorded the ID that LC assigned to it: 1003
I then cut the image and immediately pasted it. The ID of that image was 1006.
This all makes sense to me. The IDE creates ID's as controls are created, without any thought to maintaining their original assignments. It obviously keeps track of previous assignments, and cares nothing about the fact that it is the very same control put back in the very same location. But is that sort of thing the issue is here?
Craig
I then cut the image and immediately pasted it. The ID of that image was 1006.
This all makes sense to me. The IDE creates ID's as controls are created, without any thought to maintaining their original assignments. It obviously keeps track of previous assignments, and cares nothing about the fact that it is the very same control put back in the very same location. But is that sort of thing the issue is here?
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9785
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Rename an Icon?
Comforting is the fact that all other properties, like the control name, are held constant. The ID is therefore a different kind of property than any other, pertinent to the ongoing development of the controls comprising a stack, as opposed to any information about the controls themselves.
I suppose one could conceivably keep track of all the ID's ever created in a stack, and find a use for that number in some way. My test stack had just one control, but two historical ID's.
Craig
I suppose one could conceivably keep track of all the ID's ever created in a stack, and find a use for that number in some way. My test stack had just one control, but two historical ID's.
Craig
Re: Rename an Icon?
Thank you for your reply. I double clicked on the button with my icon on it and sure enough, it opened the project browser for that icon and now it shows a different id for it. Last night this icon id was 210041 and today it is 210052. I don't understand why and how I can keep it the same so I can code properly.stam wrote: ↑Mon Mar 25, 2024 9:43 am
The inspector appears any time you double click on a control. In contrast to older tutorials, the various sections in the PI are now tiny icons at the top of the inspector. If you open the PI for a button you will see a section for icons…
Hope this answers your questions?
(I'm still studying everything else you and the others mentioned but this stuck out as applying perfectly to my problem) Thank you so much!
Re: Rename an Icon?
Thank you for the reply! No, I don't want to give them numbers for names. I am just trying to figure out how to keep their id the same so I can code my statements properly. I am not understanding why the icon id is changing. Maybe I don't need to worry about the id name? I am still learning - and enjoying doing so.richmond62 wrote: ↑Mon Mar 25, 2024 10:02 amYou can, obviously, name all the images you use as icons.
If you want to give your images numbers, then to avoid the problem with the IDE mucking around with image ID numbers surely the best thing to do is name the images with numbers?
This will mean that the image you name "27" will still be called "27" if the IDE for some reason changes image "27"'s ID from 2013 to 2078.
Re: Rename an Icon?
Yes. This is what is happening. I haven't duplicated or pasted the icon BUT I did duplicate the three buttons. Could that have something to do with the icon names changing?