How do I wrap the title on a tool or dropdown button on the ribbon panel?

How do I wrap the title on a tool or dropdown button on the ribbon panel?

amalandfx
Enthusiast Enthusiast
2,015 Views
7 Replies
Message 1 of 8

How do I wrap the title on a tool or dropdown button on the ribbon panel?

amalandfx
Enthusiast
Enthusiast

Hi,

 

I'm customizing a ribbon tab for AutoCAD 2016, and am adding in some tool buttons and split dropdowns using large icons with vertical text.

 

I see on the default ribbon tabs (ie. Insert) that long titles wrap to two lines, but when I try to type in a longer title, it stretches the icon (and panel) and shows it all on one line.

 

How do I add a return or wrap in there?

 

I also tried typing it out like the default buttons appear (ie. EditAttribute), but when I type it like that it still ends up all one line.

 

Thanks for any help,

-A

0 Likes
Accepted solutions (1)
2,016 Views
7 Replies
Replies (7)
Message 2 of 8

maxim_k
Consultant
Consultant

Welcome to Autodesk Forums!

 

Hi,

 

The only one way to force wrap long titles I have found at the moment is to edit CUIX file manually in Text editor and insert special characters to the place where you need a line break.


For example:
You need to split "Drawing Setup" string in two lines. Than you need to extract RibbonRoot.cui file from your custom CUIX file, open RibbonRoot.cui in plain text editor application, find "Text" property of the button with name "Drawing Setup". It should look in the RibbonRoot.cui file  something like this:

 

<RibbonCommandButton UID="RBNU_0077" Id="AcRibbonCommandButton" Text="Drawing Setup" ButtonStyle="LargeWithText" MenuMacroID="MMU_0032" KeyTip="">
          <TooltipTitle xlate="true" UID="XLS_0002">Set DWG</TooltipTitle>
          <ModifiedRev MajorVersion="21" MinorVersion="0" UserVersion="1" />
        </RibbonCommandButton>

Now you need to insert special code - &#xD;- between words "Drawing" and "Setup", now it should look like this:

 

 

<RibbonCommandButton UID="RBNU_0077" Id="AcRibbonCommandButton" Text="Drawing&#xD;Setup" ButtonStyle="LargeWithText" MenuMacroID="MMU_0032" KeyTip="">
          <TooltipTitle xlate="true" UID="XLS_0002">Set DWG</TooltipTitle>
          <ModifiedRev MajorVersion="21" MinorVersion="0" UserVersion="1" />
        </RibbonCommandButton>

Than you need save RibbonRoot.cui file and replace old RibbonRoot.cui inside your CUIX file with this new version.

 

 

Now if you launch AutoCAD and look at your custom button, the text will be splitted into two lines. In CUI editor the "Name property of the button will show "DrawingSetup" without special characters.

 

Maxim


Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 3 of 8

maxim_k
Consultant
Consultant
Accepted solution
In fact the solution is even easier :-))

In the Name properties of the button you need to use the “\n” character sequence to represent a line break and display a command label on more than one line. The “\n” character sequence is displayed as a space instead of the characters “\n” after the changes to the command are saved.

Maxim

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
Message 4 of 8

ВeekeeCZ
Consultant
Consultant
I always thought it was \r
Apparently both works.
Message 5 of 8

amalandfx
Enthusiast
Enthusiast

Thank you both! \r and \n work. That's exactly what I was looking for!

 

Thanks again,

-A

0 Likes
Message 6 of 8

dtimm8RCUM
Contributor
Contributor

This doesn't seem to work in Inventor 2019, unless I'm missing something.

 

In my code I have tried using \r, \n, and then both of them together, like follows:

myBtn =controlDefs.AddButtonDefinition("Flange\r\nPlate", <...>)

 

Each time, I see the escape sequence showing up in the label instead of acting as an escape sequence.

image.png

 

Is the DisplayName parameter for the AddButtonDefinition function not the right place to add the escape sequence?

0 Likes
Message 7 of 8

maxim_k
Consultant
Consultant
Hi @dtimm8RCUM ,

Inventor is not the same as AutoCAD.
I think it is better to ask your question here:
https://forums.autodesk.com/t5/inventor-customization/bd-p/120

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.


Maxim Kanaev
Architect
MARSS

MacACAD | Linkedin

Etiquette and Ground Rules of Autodesk Community
0 Likes
Message 8 of 8

dtimm8RCUM
Contributor
Contributor

Oh whoops. I was following some links from google after searching for how to do it, and I didn't notice this one wasn't for the Inventor forums. They were all grouped under the same domain, so I thought all the links would be for Inventor subforums. That explains why it wasn't working.

 

(I did just recently find out you can just do a '& Chr(10) &' in Inventor, in case anybody else's google search results takes them here instead of to the Inventor form section.)

0 Likes