Which button is showing it's tooltip?

Which button is showing it's tooltip?

Anonymous
Not applicable
645 Views
1 Reply
Message 1 of 2

Which button is showing it's tooltip?

Anonymous
Not applicable

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!

0 Likes
Accepted solutions (1)
646 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted 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;

 

0 Likes