I'd like to set up my DgnElementSetTool such that any existing Fence or Selection Set prior to my tool installing will immediately call _OnElementModify() upon a datapoint. I'd also like to support the creation of a SelectionSet in my tool once loaded (if one did not exist prior to the tool loading). Lastly, I'd like to prevent the user from doing a "single pick" of an element and immediately firing _OnElementModify(). This is what I've got so far:
private: bool _NeedAcceptPoint() override { return false; }
private: UsesSelection _AllowSelection() override { return USES_SS_Check; }
private: UsesFence _AllowFence() override { return USES_FENCE_Check; } // I *think* you need to have "fence use" turn ON as well
private: bool _UseActiveFence() override { return true; } // If true, datapoint causes fence contents to be processed
private: UsesDragSelect _AllowDragSelect() override { return USES_DRAGSELECT_Box; }
private: bool _WantDynamics() override { return false; } // needed for DragSelect to NOT continually call _OnElementModify()
which does most of what I want. The only thing it doesn't do is prevent a user from "single pick" and immediate execution of _OnElementModify(). I understand that when _NeedAcceptPoint() is false, that picked element will immediately cause _OnElementModify() to fire. How can I allow the creation of a SelectionSet and disallow the single "pick" of an element? I tried to use _OnDataButton() and call __Super::_OnDataButton() when there is a fence or selection set, and not call __super, but tell the user to click-drag for a SelectionSet. Unfortunately, the initial depress of the mouse button always causes the message box to appear:
private: virtual bool _OnDataButton(DgnButtonEventCR ev) override
{
SelectionSetManagerR selection{ SelectionSetManager::GetManager() };
FenceManagerR fence{ FenceManager::GetManager() };
if (fence.IsFenceActive() || selection.IsActive() )
{
__super::_OnDataButton(ev);
}
else
{
mdlDialog_openInfoBox(L"Please Create Selection Set by Click-Dragging the Cursor First");
}
return false;
}