What is the correct way to call ContainsCustomIcon?

Frank S. shared this question 2 years ago
Answered

Hello,

In a macro I have the following code

For Each m_icon In m_topic.AllIcons 
Debug.Print m_icon.Name 
Next
And the output is 

CustomIcon--717189169

Now I'm trying to query whether this icon is included

If m_topic.AllIcons.ContainsCustomIcon("CustomIcon--717189169") Then Debug.Print "yes" Else Debug.Print "no" End If
I always get a "no" no matter what text I pass (just the number, the icon file name, ...) 

What do I really have to enter?

Thank you for your help!

Frank

Replies (1)

photo
2

Hello Frank. Custom icons are identified by a signature which can be calculated from an icon file. The icon name returns the icon base filename, which is different to the custom icon signature. Once a custom icon has been used in a map, the signature does not change, so it need be calculated only once.

The method for getting the custom icon signature is

Utilities.GetCustomIconSignature(filename)

photo
1

Hello Nick

Yes it works!
I am deeply impressed... where in the documentation is this found?!?

photo
2

Hello Frank

There is online documentation at

https://www.mindmanager.com/en/pages/developers/api/22/#MindManager~Icons~ContainsCustomIcon.html

However many of the methods and properties have only the single-line comment from the source code. As there are over two thousand altogether, only the most-used ones get additional explanation.

---