THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/04/2009 at 01:20, xxxxxxxx wrote:
Hope it's not too late, anyways here is the working code.
> \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \> LONG tool_id = doc->GetAction(); \> \> BasePlugin \*tool = NULL; \> tool = FindPlugin(tool_id, C4DPL_TOOL); \> if (!tool) return FALSE; \> \> BaseContainer msg(BFM_ACTION); \> msg.SetLong(BFM_ACTION_ID, 1440); \> msg.SetLong(BFM_ACTION_VALUE, TRUE); \> \> DescriptionCommand dc; \> dc.id = DescID(DescLevel(MDATA_APPLY, DTYPE_BUTTON, tool->GetType())); \> \> DescriptionCheckUpdate du; \> du.doc = doc; \> du.descid = &dc.id; \> du.drawflags = 0; \> \> tool->Message(MSG_DESCRIPTION_COMMAND, (void\* )&dc;); \> tool->Message(MSG_DESCRIPTION_CHECKUPDATE, (void\* )&du;); \> tool->Message(MSG_DESCRIPTION_USERINTERACTION_END); \> tool->Message(MSG_TOOL_RESTART); \> \> EventAdd(); \> \> return TRUE; \> } \>
As you can see you have too send some more messages to make it work. This should work with every button. It's almost identically with internal code for CallButton().
cheers,
Matthias