Hello,
I have a WinfForms dialog that presents the same drop-down menu options in two different areas - one within an UltraDropDownButton, and the other within the toolbar itself.
Even though both of these areas share a drop-down menu, I need to know which is the source within the ToolClick event.
Does anyone know how to do this? My original thought was that I could just set a flag when the dropdown button opens, and then reset it when it closes - but unfortunately it closes before the ToolClick event is fired, which makes that approach infeasible.
Any help would be greatly appreciated.
When displaying the child tools of a PopupMenuTool in a context of other than a UltraToolbar (such as a context menu or the dropdown of the UltraDropDownButton), the UltraToolbarsManager displays the root tool, and not the instance tool which is displayed on the toolbar.
In your scenario, the first thing you'll need to do is find the top-level tool being used for the display (PopupMenuTool) by recursively checking the Owner property until it is not of type ToolBase. Once you get this tool, you can check the IsRootTool property to determine if it is an instance tool (i.e on a UltraToolbar) or a root tool (i.e being displayed as a dropdown/context menu).
<within the ToolClick event handler>
ToolBase tool = e.Tool; while (tool.Owner is ToolBase) tool = tool.Owner as ToolBase;
if (tool.IsRootTool) { // Perform UltraDropDownButton Tool Click functionality } else { // Perform UltraToolbar Tool Click functionality }
If I can assist you with any other questions regarding this scenario, please don't hesitate to ask.
Thanks,
Chris
Hi, I have the same trouble. I have the popupmenutool on ultradayview and ultraweekview. How can I know the source?