Search code examples
windowsdelphiwinapidelphi-7

Ampersands (&'s) and the different versions of Windows


So I released a quick fix for our software that in a ribbon tab had "Data _Rules" as it's caption a few months back for some people. I found that on Windows Visa and Windows 7 I needed to write the caption as "Data && Rules" instead of "Data & Rules", as versions higher than XP would interpret the first ampersand as a shortcut key.

However, I just got through an email from one of our consultants saying that someone he's working with, using Windows 7, can see "Data && Rules" on the tab.

What is the correct way to deal with things like this? Clearly me checking OS version and deciding that way isn't full proof enough. Have you had to deal with things like this before?

I'm coding in the Delphi language using Delphi 7, but this may be a WIN32 thing.

Thanks!


Solution

  • The use and interpretation of the & as the access character is fairly standard practice, requiring either an explicit flag to turn off or doubling them up to insert a literal &. They normally require explicit support from the control though.

    If a single control is handling it differently based on the OS version then you really need to raise a bug with the authors.