On 07/08/2014 at 14:42, xxxxxxxx wrote:
I could be completely off base here. But humor me anyway.
You might not be grabbing the object.
The tool AM is really a subdialog. Which is different from the AM in Tag or Object plugins.
So it might be that you're using the Linkfield code for Node plugins instead of the Linkfield code for GeDialog and subdialogs.
Here's some code I ripped out of a tool plugin
//The subdialog class for the tool plugin
class ToolDialog: public SubDialog
{
private:
LinkBoxGui *myLink;
public:
BaseContainer *toolData; //A container we'll save the dialog values in so they don't constantly re-set
virtual Bool CreateLayout(void);
virtual Bool InitValues(void);
virtual LONG Message(const BaseContainer& msg, BaseContainer& result);
virtual Bool Command(LONG id,const BaseContainer &msg);
};
// ....the other subdialog methods here .....
LONG ToolDialog::Message(const BaseContainer &msg, BaseContainer &result)
{
LONG mid = msg.GetId();
//Use one of the BFM messages to get the link
//Because BFM messages are intended to be used with dialogs
if(mid == BFM_SYNC_MESSAGE)
{
BaseObject *lop = (BaseObject* )myLink->GetLink(GetActiveDocument());
if(!lop) GePrint("empty");
else GePrint(lop->GetName());
}
return GeDialog::Message(msg, result);
}
// ....the other subdialog methods here .....
//The actual Tool plugin class where the tool does it's thing based on the subdialog settings above
class MyTool : public ToolData
{
public:
ToolDialog *dlg;
virtual SubDialog *AllocSubDialog(BaseContainer *bc);
MyTool() :ToolData(), dlg(nullptr){ }
virtual LONG GetToolPluginId() { return PLUGIN_ID; }
virtual Bool InitTool(BaseDocument* doc, BaseContainer& data, BaseThread* bt);
virtual const String GetResourceSymbol() { return String("mytool"); } //The name of the .res file
virtual Bool GetCursorInfo(BaseDocument *doc, BaseContainer &data, BaseDraw *bd, Real x, Real y, BaseContainer &bc);
virtual Bool MouseInput(BaseDocument *doc, BaseContainer &data, BaseDraw *bd, EditorWindow *win, const BaseContainer &msg);
virtual void FreeTool(BaseDocument *doc, BaseContainer &data);
};
//etc....
What I'm saying is...Are you 100% sure you're really grabbing the linked object correctly?
Have you tested it by asking for the object's name, or something like that before trying to run Remo's code on it?
-ScottA