delphidelphi-2009

How to stop Delphi processing the prefix "&" character in some control captions?


I found that if I set the Caption of TPanel, TLabel or TRadioGroup with a string containing "&" character, it is not displayed and the next character is underlined. How can I stop this? I want the caption to be displayed with the exact string I set.


Solution

  • For TLabel and TStaticText, set ShowAccelChar property to False (default is True). For TPanel, TRadioGroup etc you need to use double ampersand.

    You may also want to take a look in help for TLabel.ShowAccelChar, for a description how TLabel.ShowAccelChar and TLabel.FocusControl are related.