THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 21/04/2012 at 09:12, xxxxxxxx wrote:
I've never tried to use customgui like that with an object plugin. But I have created custom bitmap buttons on tags.
I used GetD&SetDParameter() methods to make them work.
But I have no idea if this applies at all to what you're trying to do.
...The class
class SimpleTag : public TagData
{
INSTANCEOF(SimpleTag,TagData)
public:
virtual Bool Message(GeListNode *node, LONG type, void *t_data);
virtual Bool Init(GeListNode *node);
virtual Bool GetDDescription(GeListNode *node, Description *description,DESCFLAGS_DESC &flags);
virtual Bool GetDParameter(GeListNode *node, const DescID &id,GeData &t_data,DESCFLAGS_GET &flags);
virtual Bool SetDParameter(GeListNode *node, const DescID &id,const GeData &t_data,DESCFLAGS_SET &flags);
virtual EXECUTIONRESULT Execute(BaseTag *tag, BaseDocument *doc, BaseObject *op, BaseThread *bt, LONG priority, EXECUTIONFLAGS flags);
static NodeData *Alloc(void) { return gNew SimpleTag; }
};
...The GetD method
Bool SimpleTag::GetDParameter(GeListNode *node, const DescID &id, GeData &t_data, DESCFLAGS_GET &flags) //Used to get the decriptions data
{
switch(id[0].id) //Get the id's in the tag
{
case TEST_BUTTON:
{
LONG dirty = 0;
BitmapButtonStruct bbs(static_cast<BaseObject*>(node), id, dirty); //The tag is the op, 'TEST_BUTTON' is the id, 'dirty' is the dirty option value
t_data = GeData(CUSTOMDATATYPE_BITMAPBUTTON, bbs);
flags |= DESCFLAGS_GET_PARAM_GET;
break;
}
}
return SUPER::GetDParameter(node, id, t_data, flags);
}
...The SetD method
Bool SimpleTag::SetDParameter(GeListNode *node, const DescID &id, const GeData &t_data, DESCFLAGS_SET &flags) //Used to change the decriptions data
{
switch(id[0].id) //Get the id's in the tag
{
case TEST_BUTTON: //If the id is 'TEST_BUTTON' from the .res file
GePrint("Custom Button Pressed"); //Do this
break;
}
return SUPER::SetDParameter(node, id, t_data, flags);
}
...The Message method
Bool SimpleTag::Message(GeListNode *node, LONG type, void *data)
{
//Bunch of stuff here
////////////// This code loads an image for the bitmap button in the AM /////////////////////////
if (type == MSG_DESCRIPTION_GETBITMAP)
{
DescriptionGetBitmap *dgb = static_cast<DescriptionGetBitmap*>(data);//Create a variable to hold one of the tag's descriptions
AutoAlloc<BaseBitmap> bm; //Create an instance of the BaseBitmap calss
Filename fn = GeGetPluginPath()+"res"+"myicon.tif"; //Get the file path
String image = fn.GetString(); //Get the string name of the file path
bm->Init(fn); //Initialize the BaseBitmap instance
dgb->bmp = bm.Release();
}
//////////////////////////////////////////////////////////////////////////////////////////////////
//Continue on with other stuff
tag->SetDirty(DIRTYFLAGS_DATA); //Used to update a Tag's AM GUI items
return TRUE;
}
That's about all the help I can offer on this.
I still don't understand a lot about customgui stuff myself. And the C++ SDK is very lacking in that area.
I always use a .res file when making non-dialog based plugins.
I have no idea what problems not using them might, or might not, cause.
-ScottA