Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347451 - Ampersand gets replaced with _
Summary: Ampersand gets replaced with _
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-27 09:45 EDT by Nicolas Born CLA
Modified: 2021-08-19 11:01 EDT (History)
2 users (show)

See Also:


Attachments
patch to enable escaping of mnemonic characters (12.29 KB, patch)
2011-05-31 07:15 EDT, Bruno Koeferli CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Born CLA 2011-05-27 09:45:00 EDT
Build Identifier: M20110210-1200

If the value in a LabelField contains the ampersand, then the ampersand isn't shown and the next character is underlined (maybe a mnemonics problem). Probably, also other fields are affected by this.

Reproducible: Always

Steps to Reproduce:
1. create a form with a label field
2. set the value of the label field to "Hello&Scout" and open the form
3. the value is shown as HelloScout (the S is underlined)
Comment 1 Bruno Koeferli CLA 2011-05-31 07:13:59 EDT
The described bug is a SWT feature which applies to most controls, f.e. see the javadoc of SWT Label.setText(String) (http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Label.html).

This means every single ampersand "&" will be interpreted as mnemonic character and won't be displayed as text. In Scout this feature does not make sense for the most labels of the Scout-fields (like GroupBox, SequenceBox, StringField, SmartField, CheckBox, ...) or the value of a LabelField. Therefore Ivan and I decided to provide per Scout project a possibility to escape all mnemonic characters for these controls.

In the attached patch you will found a solution which supports the possibility to escape mnemonic characters by extending "decorations" element of the existing extension point "org.eclipse.scout.rt.ui.swt.lookAndFeel" with a new boolean element "escapeMnemonicsOnNonePushControls". If this element is not defined no mnemonic characters will be escaped.
Comment 2 Bruno Koeferli CLA 2011-05-31 07:15:30 EDT
Created attachment 196976 [details]
patch to enable escaping of mnemonic characters

this is patch described in the comment 1
Comment 3 Andreas Hoegger CLA 2011-05-31 09:41:33 EDT
Bruno, as you mentioned the double ampersand (&&) escapes the default mnemonic behavior of any SWT control. To keep the code simple and clean I would prefer to change the text of your project to …&&… Does that work for you?

-Andreas
Comment 4 Bruno Koeferli CLA 2011-06-10 11:41:34 EDT
Ivan and I discussed this problem again and are both in agreement that the mnemonic behaviour should be the same regardless of which ui the client application is running on. Therefore the escaping should not be made in the texts but by the concret ui implementation.
In Scout we have decided to only support mnemonics on actions like Buttons or Menus so the attached patch supports a possibility to disable the "auto mnemonic" feature in SWT to get the same behaviour as in Swing.
Comment 5 Andreas Hoegger CLA 2011-08-10 05:33:35 EDT
The ampersand behavior of SWT will not be changed. So project has to escape their ampersand by themselves. Therefore WONTFIX.