THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/02/2008 at 02:30, xxxxxxxx wrote:
- how can I fit the start-view to the size of the tree, to see the whole tree?
CallCommand(12151L) will "Frame Active Objects". That means that you'll have to set the objects as selected.
> // If you don't have the document already \> BaseDocument\* doc = GetActiveDocument(); \> // op is your BaseObject\* for the tree object \> doc->SetActiveObject(op, SELECTION_NEW); \> // If you need to include children, call this as well \> //(Select Children in Object Manager) : \> CallCommand(100004768L); \> // Frame Active Objects \> CallCommand(12151L);
This is untested so verify its veracity.
- how can I create a drag-and-drop-field,the user can take any leaf-polygon-object (my also be an apple), and how can I use it in my program?
This will depend on if the field is in the Attributes Manager or a Dialog (they have different interfaces). For the Attributes Manager, you create a LINK description in the res file (or dynamically using GetDDescription() in the NodeData for the plugin). For a Dialog, you'll need to use a custom gui element:
> // LinkBox \> BaseContainer tbc; \> tbc.SetBool(LINKBOX_HIDE_ICON, FALSE); \> // this variable is stored in the dialog class for later \> copyLinkBox = (LinkBoxGui\* )AddCustomGui(IP_COPY_SOURCE,CUSTOMGUI_LINKBOX,String(),BFH_SCALEFIT|BFV_SCALEFIT,0L,0L,tbc); \> if (!copyLinkBox) return FALSE;
You'll need to check Message() for drag-n-dop here:
> // GeDialog.Message \> //\*---------------------------------------------------------------------------\* \> LONG IPPDialog::Message(const BaseContainer& msg, BaseContainer& result) \> //\*---------------------------------------------------------------------------\* \> { \> //GePrint(BaseContainerToString(msg)); \> LONG mid = msg.GetId(); \> if (mid == BFM_DRAGRECEIVE) return Msg_DragReceive(msg, result); \> else if (mid == BFM_GETCURSORINFO) return Msg_GetCursorInfo(msg, result); \> return GeDialog::Message(msg, result); \> } \> // IPPDialog.Msg_DragReceive - BFM_DRAGRECEIVE \> //\*---------------------------------------------------------------------------\* \> LONG IPPDialog::Msg_DragReceive(const BaseContainer& msg, BaseContainer& result) \> //\*---------------------------------------------------------------------------\* \> { \> // Copy-Paste LinkBox \> if (!CheckDropArea(IP_COPY_SOURCE, msg, TRUE, TRUE)) return GeDialog::Message(msg, result); \> if (msg.GetLong(BFM_DRAG_LOST)) return GeDialog::Message(msg, result); \> \> LONG cursor = MOUSE_POINT_HAND; \> LONG type = 0L; \> void\* object = NULL; \> BaseObject\* op = NULL; \> \> GetDragObject(msg, &type;, &object;); \> \> if ((type == DRAGTYPE_ATOMARRAY) && (((AtomArray\* )object)->GetCount() == 1L) && ((AtomArray\* )object)->GetIndex(0)) \> { \> op = (BaseObject\* )((AtomArray\* )object)->GetIndex(0L); \> if (op->IsInstanceOf(Obase) && (op->GetTag(ID_IPPFIGURETAG) || op->GetTag(ID_IPPOBJECTTAG))) cursor = MOUSE_INSERTCOPY; \> else \> { \> cursor = MOUSE_FORBIDDEN; \> op = NULL; \> } \> } \> \> if (msg.GetLong(BFM_DRAG_FINISHED)) \> { \> copyLinkBox->SetLink(op); \> copySource = op; \> copyDoc = op->GetDocument(); \> } \> \> return SetDragDestination(cursor); \> }