| Summary: | Link widget has problems with mnemonics | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Dani Megert <daniel_megert> | ||||||
| Component: | SWT | Assignee: | Felipe Heidrich <eclipse.felipe> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | contact, mark.k.mclaren, markus.kell.r | ||||||
| Version: | 3.3 | ||||||||
| Target Milestone: | 3.6 M3 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Dani Megert
*** Bug 276621 has been marked as a duplicate of this bug. *** Created attachment 147129 [details]
Fix
If you add a TraverseListener to the Link control, the 'doit' field also doesn't get set to true if the key matches the mnemonic character.
Here's a simple fix (first method copied from Label).
IMO, the code in Label doesn't make sense for Link. A link is in the format: (atext link)* ptext? for example: "&some text <a>a link</a> some text at the end" In this case: atext = &some text link = a link ptext = some text at the end (atext link)* can repeat zero or more ptext? can repeat zero or one mnemonics in link and ptext are ignored. when the mnemonic in the ith atext is hit, the ith link should receive focus. Created attachment 147377 [details]
patch
Hi Markus, I released the patch in comment 4 which implements the behaviour described in comment 3. Let me know if that is useful to you. Fixed in HEAD > 20090921 > Hi Markus, I released the patch in comment 4 which implements the behaviour
> described in comment 3. Let me know if that is useful to you.
That's also fine for me, thx.
Verified in I20091027-0100: mnemonics inside the link are now ignored. I would still like to see the Javadoc of Link.setText(String) be more clear about this. Of course one can infer that a link does not have a mnemonic but a small additional comment would clarify this. Adding this: * <p> * Mnemonics are indicated by an '&' that causes the next * character to be the mnemonic. The receiver can have a * mnemonic in the text preceding each link. When the user presses a * key sequence that matches the mnemonic, focus is assigned * to the link that follows the text. Mnemonics in links and in * the trailing text are ignored. On most platforms, * the mnemonic appears underlined but may be emphasised in a * platform specific manner. The mnemonic indicator character * '&' can be escaped by doubling it in the string, causing * a single '&' to be displayed. * </p> Perfect! :-) |