I'm working on a plugin that creates PluginGroupArt. The first time I create the result art and set with SetPluginArtResultArt(...) everything works the way it should. I should note that I am not using edit art. The result art is generated from private data.
Then, later, I handle a notifier and want to update the result art.
I have tried a couple different ways unsuccessfully.
1. Call GetPluginArtResultArt(...) and modify the contents of the group. With and without calling SetPluginArtResultArt(...) afterwards.
2. Create a new group art and call SetPluginArtResultArt(...). With and without calling DisposeArt(...) on the previous result art.
Nothing seems to work. I've had the result art just disappear with nothing replacing it. I've had the result art from the first call stay on the page and the new groups appear as ungrouped art. Etc.
Has anyone else figured out the magic formula of calls? Am I on the right track, but something else in my code might be messing it up? It seemed like it should be pretty straightforward, but is seemingly not.
Ok, so I've narrowed it down a little more.
It seems when I create the result group the first time, I add art using ReorderArt(...), placing art kPlaceInsideOnTop in the group art. Then I set the result group using SetPluginArtResultArt(...).
The second time, when I update the result art, I get the result group with GetPluginArtResultArt(...), then add art to it using ReorderArt(...), placing art kPlaceInsideOnTop in the group art. This is where the issue is. ReorderArt returns error 'PARM'.
I'm not sure why I would be getting an error adding art to the group, unless now that the group is a "Result" art, it can't be inserted to anymore?
When I try creating a new group art, I can add objects to it using ReorderArt(...) with no errors. Then I can SetPluginArtResultArt(...), also with no error. But when the plugin finishes, there is no result art displayed on the page, just the PluginArt object.
I'll post this here for posterity:
The missing link was a call to MarkPluginArtDirty(...). Since I wasn't updating any Edit art for this PluginArt, the plugin art needed to be manually marked dirty to trigger the redraw after a call to SetPluginArtResultArt(...).