I'm programming in C and using Source Insight.
I have an enum type with a lot of constants (like 100). I have debug prints that print out variable values, but they (of course) print out as integers.
What I'd like to do is click on the name of an enum constant, and see its numeric value displayed somewhere. (I've seen this done in a Visual Studio plugin, so it must be possible.)
That is, assume I have
enum colors {
ORANGE, PURPLE, PINK
};
I want to click on (or select, or something) PURPLE
and see the value 1
somewhere visible (ideally, the symbol window or context window, but I'm not particular).
Is there an easy way to do this in Source Insight? Is there a difficult way, at least (such as writing a macro)?
The only way I've found to do this is to give each member of the enumeration a specific value - then it shows up in the context window when it finds the enum constant. eg:
It's not great but it works...
It looks like it would be possible to write a macro that popped up a message box with the value but I can't get it to work properly in 3.50.0064 - it seems to think the wrong enum is under the cursor. My test macro code is
For me, this returns a random item from the enum list as the "found" one. If returned the right one we could look up the parent with SymbolParent() then iterate through the children using SymbolChildren() / SymListCount()