THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/12/2010 at 03:26, xxxxxxxx wrote:
You have to react to the MSG_DESCRIPTION_POPUP message to fill the menu structure.
Here is a simple example of a popup menu with a sub-menu and some separators.
Bool MorphMixerObject::Message(GeListNode *node, LONG type, void *data)
{
if (type==MSG_DESCRIPTION_POPUP)
{
DescriptionPopup *dp = (DescriptionPopup* )data;
if (dp->id[0]==MORPHMIXER_PRESET)
{
if (dp->chosen==0) //fill menu
{
dp->popup.InsData(MORPHMIXER_PRESET+1,"hello");
dp->popup.InsData(MORPHMIXER_PRESET+2,"world");
dp->popup.InsData(0,String()); //separator
BaseContainer child; //sub-container for sub-menu
child.InsData(MORPHMIXER_PRESET+3,"CINEMA 4D");
child.InsData(0,String()); //separator
child.InsData(MORPHMIXER_PRESET+4,"BodyPaint 3D");
child.InsData(1,"Sub-Menu"); //sub-menu name
dp->popup.InsData(0,child); //insert sub-menu
child.FlushAll();
}
else //menu item was chosen
{
GePrint(LongToString(dp->chosen));
}
}
}
return TRUE;
}
Bool MorphMixerObject::GetDDescription(GeListNode *node, Description *description,DESCFLAGS_DESC &flags)
{
if (!description->LoadDescription(node->GetType())) return FALSE;
// important to check for speedup c4d!
const DescID *singleid = description->GetSingleDescID();
LONG index = MORPHMIXER_PRESET;
BaseContainer bc2;
DescID cid = DescLevel(index,DTYPE_POPUP,0);
if (!singleid || cid.IsPartOf(*singleid,NULL)) // important to check for speedup c4d!
{
bc2 = GetCustomDataTypeDefault(DTYPE_POPUP);
bc2.SetLong(DESC_CUSTOMGUI,CUSTOMGUI_POPUP);
bc2.SetLong(DESC_ANIMATE,DESC_ANIMATE_OFF);
bc2.SetBool(DESC_REMOVEABLE,FALSE);
bc2.SetString(DESC_NAME,"Preset");
bc2.SetString(DESC_SHORT_NAME,"Preset");
if (!description->SetParameter(cid,bc2,DescLevel(ID_OBJECTPROPERTIES))) return FALSE;
}
flags |= DESCFLAGS_DESC_LOADED;
return SUPER::GetDDescription(node,description,flags);
}
cheers,
Matthias