addIcon issue

Brian Milby brian at milby7.com
Sun Aug 21 14:41:36 EDT 2022


Have you looked at SVG Icon Tool (Sample Stacks)?  It can help manage icon families.  You should be able to set the icon using just the short name.  The icon svg library will check the current library first and then cycle through all loaded families looking for a match.  If there is a collision then you don’t know which one will get used (probably the current family and then the rest in order of creation).

Here is a version with a large number of icons included:
https://milby.us/lc/SvgIconTool.zip

I worked on the family code and doubt much has changed since the source was closed.  Version number matches GitHub in the rc1 of 9.6.9 currently.

Thanks,
Brian

Sent from my iPhone

> On Aug 21, 2022, at 1:58 PM, Mike Kerner via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> reading through the library, it appears that you are correct - you cannot
> add to the default family.
> changing the family using setCurrentIconFamily("custom") does cause the
> picker to show those icons. if i want to select one for assignment to a
> widget, is that the only way to do it? entering custom/test does not seem
> to work. instead i have to set the family and then choose the icon
> 
>> On Sun, Aug 21, 2022 at 1:21 PM J. Landman Gay via use-livecode <
>> use-livecode at lists.runrev.com> wrote:
>> 
>> I don't think you can add to the default icon family. The docs say that if
>> you haven't specified a family then the icon goes into one named "custom".
>> So see what you get when you run iconFamilies() and if "custom" is in
>> there
>> then set the family using setCurrentIconFamily("custom").
>> 
>> If you prefer, you can create your own family with its own name with
>> addIconFamily. In any case you have to set the current family before you
>> can use its icons.
>> --
>> Jacqueline Landman Gay | jacque at hyperactivesw.com
>> HyperActive Software | http://www.hyperactivesw.com
>> On August 21, 2022 7:48:13 AM Mike Kerner via use-livecode
>> <use-livecode at lists.runrev.com> wrote:
>> 
>>> I have an svg widget that draws correctly, so I'm trying to add it to the
>>> library, but addIcon does not seem to be working.
>>> After calling addIcon, I try to search for the icon, but it does not
>> appear
>>> in the icon picker, and adding it by name does not work, either.
>>> Here's the line:
>>> get addIcon("test","m 13,21.59 -4.29,-4.3 -1.42,1.42 5,5 a 1,1 0 0 0
>> 1.41,0
>>> l 13,-13 -1.41,-1.42 z M 25,0 H 7 A 7,7 0 0 0 0,7 v 18 a 7,7 0 0 0 7,7 h
>> 18
>>> a 7,7 0 0 0 7,-7 V 7 A 7,7 0 0 0 25,0 Z m 5,25 a 5,5 0 0 1 -5,5 H 7 A
>> 5,5 0
>>> 0 1 2,25 V 7 A 5,5 0 0 1 7,2 h 18 a 5,5 0 0 1 5,5 z",0)
>>> 
>>> 
>>> --
>>> On the first day, God created the heavens and the Earth
>>> On the second day, God created the oceans.
>>> On the third day, God put the animals on hold for a few hours,
>>>  and did a little diving.
>>> And God said, "This is good."
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> On the first day, God created the heavens and the Earth
> On the second day, God created the oceans.
> On the third day, God put the animals on hold for a few hours,
>   and did a little diving.
> And God said, "This is good."
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


More information about the use-livecode mailing list