Hi!
I have successfully created a procedure to hook F1 keypresses when a tooltip for a ribbon item is displayed, allowing me to go to a URL with our help texts. To find the URL in a .NET programmatically created ribbon, I use HelpTopic. Every time a tooltip opens, I set a global variable currentTooltip which holds this HelpTopic value.
private static void ComponentManager_ToolTipOpened(object sender, EventArgs e)
{
Autodesk.Internal.Windows.ToolTip tt = sender as Autodesk.Internal.Windows.ToolTip;
if (tt == null)
return;
Autodesk.Windows.RibbonToolTip rtt = tt.Content as Autodesk.Windows.RibbonToolTip;
currentTooltip = (rtt == null ? null : rtt.HelpTopic);
}
The problem is with ribbons defined with cui and stored in cuix files. The above function gets rtt == null. So for a cuix ribbon item, it seems the tooltip is not really a Autodesk.Windows.RibbonToolTip. And it seems that although tt (Autodesk.Internal.Windows.ToolTip) is not null, none of the properties have any value! I have tried writing tt.Name, tt.Content, tt.Uid, but they are all empty.
How can I find out which ribbon item triggered this tooltip, so I can map it to a URL? I do _not_ want to rewrite all the cuix definitions, but create a mapping "outside" of this.
Is there maybe an easy way to find out which ribbon item is currently under the cursor?
Thanks for any help!
Solved! Go to Solution.
And as often before: right after asking, you find the answer yourself!
In ToolTipOpened, I can use:
Autodesk.Windows.RibbonItem ri = (e as Autodesk.Windows.RibbonItemToolTipEventArgs).Item;