.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modify Tooltips of RibbonItems

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
tbrammer
682 Views, 7 Replies

Modify Tooltips of RibbonItems

We want to deliver a language independend CUIX-File and translate the UI at runtime after loading the CUIX like this:

 

foreach (RibbonTab tab in ComponentManager.Ribbon.Tabs)

{

       foreach (RibbonPanel panel in tab.Panels)

       {

             foreach (RibbonItem item in panel.Source.Items)

              {

                    TransRibbonItem(item);

              }

       }

}

 

TransRibbonItem(item)should translate the Item text displayed in the UI as well as the tooltip text.

I found a good way to translate RibbonItem texts. But the only solution I found to translate tooltips is the approach that Kean Walmsley posted in his blog here and here.

 

This solution has some drawbacks:

  • It uses Autodesk.Internal.Windows.ToolTip, which Kean rates as "risky".
  • It can not be used in my TransRibbonItem(item) function because it uses an ToolTipOpened event-handler that modifies a tooltip just when it is created.
  • I found that this mechanism does not work very well in AutoCAD 2014: When a tooltip is created the first time, the handler is called before it is completely initialized. The posted solution reloads the tooltip in this case - which leads to a delay and display flash.

Any Ideas?

 

Cheers

--Thomas


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

7 REPLIES 7
Message 2 of 8
dgorsman
in reply to: tbrammer

Users aren't switching languages frequently, if ever past the installation.  That makes real-time translation each time, every time unnecessary.  You might want to consider something that makes the translation *once*, then does something like re-points/re-loads the CUIx with a translated copy, if not using it as an internal development tool to quickly generate language specific CUIx files for distribution.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 3 of 8
tbrammer
in reply to: dgorsman

I agree. This is exactly what I told our product manager.
This issue is not about "switching languages at runtime" but about language independend setup and deployment.
And our setup guys insist upon this approach.

So I still need a solution.

--Thomas

Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 4 of 8
dgorsman
in reply to: tbrammer

*facepalm*  Good luck.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 5 of 8
tbrammer
in reply to: tbrammer

(In the meantime this has been escalated to DevSup. But the link to DevSup doesn't work and I can't find it in my "Cases". So I add here...)

 

I have an additional question:

As for ribbonitems and tooltips I need to translate toolbars. Toolbars have names that are displayed as tooltip if you hover the mousepointer over the toolbar. See attached screenshot. The names are also visible in the list of available toolbars that pops up when you click on the “AcToolbarsCheckList” ribbon-button.

 

How can I translate these toolbar names at runtime?

 

 Toolbars.png

 

Note: This screenshot was taken after a test-version of my translation function was run. It replaces each item's UI-text with the item's ID.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 6 of 8
Balaji_Ram
in reply to: tbrammer

Hi Thomas,

 

Sorry, there is no inbuilt mechanism in the API to do such runtime translation.

 

As you may be aware, AutoCAD also does not permit switching languages at runtime.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Message 7 of 8
tbrammer
in reply to: Balaji_Ram

@Balaji_Ram:

 

  > Sorry, there is no inbuilt mechanism in the API to do such runtime translation.

 

Your statement is very general. Do you mean that there is

 

  1. no _other_ mechanism to translate tootips 
  2. absolutely no mechanism to translate toolbars at all

at runtime?

 

I have attached a test project. If you want to try it:

 

Build the project, netload the RibbonTranslate.dll in AutoCAD.

Enter command “TRANSRIB”

Press RETURN at the „Messagefile:“ prompt.

Enter “ID” at the “Language:” prompt.

The function will translate the ribbon menu items and tooltips with the approach pointed out in my first posting.

 

--Thomas


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 8 of 8
Balaji_Ram
in reply to: tbrammer

There may be workarounds to do this but I am not aware of it.

 

What I meant in my previous reply was that there is no direct way designed right into the API to do such translation.

 

What you are using is a workaround and can stop working / behave differently in any of the AutoCAD releases as that event handler was not specifically meant for such runtime translation.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost