Getting a literal tilda (~) in menu item text

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
kwalcock
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am

Getting a literal tilda (~) in menu item text

Post by kwalcock »

Including a tilda (~) in menu item text will create a handy shortcut, but how can I get a plain, literal tilda character? I can find no documentation about how to "escape" the special character. None of ~~, '~, \~ work. The tildas are all removed. It works for the undo and redo menu items, so there must be a secret way. Who knows it?
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
User avatar
kingfisher
Volunteer
Posts: 2123
Joined: Tue Nov 20, 2007 10:53 am

Re: Getting a literal tilda (~) in menu item text

Post by kingfisher »

Code to set a tilde to a cell is quite simple. Exactly what do you mean ? Are you trying to add a menu item with Tools > Customise ?
Apache OpenOffice 4.1.9 on Linux
kwalcock
Posts: 24
Joined: Thu Oct 09, 2014 11:54 am

Re: Getting a literal tilda (~) in menu item text

Post by kwalcock »

I wouldn't say there was a cell involved. This is a custom menu and menu items for an addon. Showing that it can be done from Addons.xcu would be a first step. Because I change the menu item text on the fly, I change the menu item text using FeatureStateEvent.State. The changed text may have its own tildas in addition to the tilda that is used for the shortcut. For example, the text could end up being "~Undo: Typing: 'he~llo'". I see that OpenOffice gets it wrong on Windows. This particular tilda in 'he~llo' does not show up correctly.
Apache OpenOffice 4.0.1
Windows, Linux, MacOS
Post Reply