nemyax Posted April 12, 2016 Posted April 12, 2016 I can't work out how to make a plugin's menu entry visible when CPs are selected. Presumably this is determined by the HxtLoadCommandEntry function, but the entry gets hidden whenever any CPs are selected. Even an always-true definition like the one below doesn't make a difference: extern "C" __declspec(dllexport) BOOL HxtOnAddCommandMenu( HTreeObject *htreeobject, UINT index, String &menuname, MenuCategory &mc, BOOL &disabled) { menuname = g_str_menu_name; disabled = FALSE; mc = MC_GENERAL; return TRUE; } How do I control availability correctly? Quote
Developer yoda64 Posted April 30, 2016 Developer Posted April 30, 2016 Try this (entry.cpp) #include "StdAfx.h" #include "Resource.h" #include "MeasureDist.h" enum {CP,MGROUP}; extern "C" __declspec(dllexport) const BOOL HxtLoadCommandEntry(UINT index, ObjectType &objtype) { switch (index) { case CP: objtype = HOT_CP; return TRUE; case MGROUP: objtype = HOT_GROUP; return TRUE; } return FALSE; } extern "C" __declspec(dllexport) BOOL HxtOnAddCommandMenu(HTreeObject *htreeobject, UINT index, String &menuname, MenuCategory &mc, BOOL &disabled) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CString string; string.LoadString(IDS_STRING1); menuname = (LPCTSTR)string; disabled = FALSE; mc = MC_WIZARD; switch (index) { case CP: return TRUE; case MGROUP: return TRUE; } return FALSE; } extern "C" __declspec(dllexport) BOOL HxtOnCommand(HTreeObject *htreeobject, UINT index) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); switch (index) { case CP: return ((CMeasureDistApp *)AfxGetApp())->OnCP((HCP *)htreeobject); case MGROUP: return ((CMeasureDistApp *)AfxGetApp())->OnGroup((HGroup *)htreeobject); break; } return FALSE; } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.