As per this video: http://www.screencast.com/t/NGVhNmM1Yzg
I am seeing the following:
If you use the IE API to try to get access to a Class' data when it is created - only empty data is returned. The workaround is to manually open Class Properties Dialog Box, then open the Icon Editor and select Ok. After which the IE API correctly returns the data. I don't know if this is a problem with the IE API or Class' themselves?
What are your thoughts?
Is there a way to programmatically solve this?
I have even found that saving the Class, closing it then reopening does not fix the problem (only the above workaround)
I have not tested this for other IE API interfaces (e.g. VI)
Attached is the VI used in the video.
Tom, you will see why I am calling it data corruption from the following video which may help illustrate the problem further.
If I start with a new Class then set the User Data Layers, the Text Layers update with the default data hence corrupting the icon!
I can get the icon from the VI Server method ok... ...so maybe its something in the IE API??
Sorry, didn't get a chance to get to it earlier this week.
It is indeed a bug in the API. It doesn't catch any maiden VI, CTL or library.
I guess I was being lazy on that one. I knew that I don't catch it but I thought, that one wouldn't care about it since there is the SET xxx VIs which have to be used first in order to read back the icon editor data.
At least the default VI Icon is returned now.
Concerning the default data, I need to look for a mouse for my lap top. It *** to work without it...
I have extended the API to take care of default values.
I have added two new VIs which take care on that.
Both are not password-protected. Take a look at them and tell me if you think that this is sufficient.
The one VI is used to set the default values (if you don't call it, I just take the most common default values).
As long as you keep this VI in memory, user defined default values are persistent.
The other one is called whenever I set the caller's icon editor data, whereas I only overwrite the data that I read from the caller in case that there is no data stored. That is why I use the error case in 'Check and Update Default values.vi'. In case an error is passed in (I don't even check the error code itself, since the caller will take care of the error to handle it properly) I just go ahead and replace the data with the default data and return it to the caller.
Cheers for this Tom
This week I have been implementing a solution myself too so I will check out your solution as well, and see what is best for what I am doing.
This is a summary of what I have done (for the Class only at the moment):
I read the Layers and precheck the Class to see if the Icon is "empty" (taking into account the icon may not have any User Layers actually present)
If so I find the LVOOP Theme by reading back the Class Control Icon via VI Server.
This will gives me the image data merged, but that ok because if Icon is Empty = TRUE then I am dealing with a new Class so there is (currently) only one layer in the control.
I then resolve the LVOOP theme from this info, create a banner of the same color add in a User Layer and viola - I don't loose any information!!
That doesn't sound too bad.
But as a matter of fact, the corruption of the default data in the icon editor won't be resolved unless you update to the new API stack.
Once you have done this, it will do it automatically, since I have added the code in the SET VIs itself.
I did think about it but came to the conclusion that I didn't want to update the icon with any data unless I was actually going to do a change.
So it only gets set at the end if the user presses ok.
If the user presses cancel, I did not want to change any data.
I do the precheck every time at startup anyways to cover all bases.
The only reason I did the above was to proceed with a release.
If you want to have a gander at what i've done - check out it out my new vids here
I even attempted to add in Parent-Child Class transparency support (as mentioned by AQ).