| Summary: | RadioButton get selected when user clicks on a Composite created by FormToolkit | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Jean-Marc <jmp> | ||||
| Component: | User Assistance | Assignee: | platform-ua-inbox <platform-ua-inbox> | ||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||
| Severity: | minor | ||||||
| Priority: | P3 | CC: | cgold | ||||
| Version: | 4.1 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Jean-Marc
Created attachment 189001 [details]
Example to replicate the problem
See code in ApplicationWorkbenchWindowAdvisor::createWindowContents(Shell shell).
This is working as designed. Composites and other controls created by FormToolkit are "adapted" which involves setting the background color and adding a mouse down listener which sets focus. If you want to set the background but not add the listener you can use this kind of sequence:
Composite rbc2 = new Composite(parent, SWT.BORDER);
toolkit.adapt(rbc2, false, false);
I would argue the problem is with the `mouse down listener which sets focus`. If the controls on the composite are radio button, and none are selected, setting the focus on a radio button of the group will select the first radio button which is not what the user intended. I would suggest that in that particular case, no focus change is made. Thoughts ? I don't want to change the current behavior because that would affect the way existing applications work. I agree with you that in the case of Radio buttons this causes some odd side effects but there is a workaround. I did not write the original code and had I done so I probably would not have added the mouse click listener, having said that I would rather leave the current behavior as is since it has been that way for a long time. Understood... That is a better answer than `working as designed`. Work around does not quite work with us for some other reasons, but feel free to close. Thanks JM |