Bug 6775 - Radio button setSelection changes focus
Summary: Radio button setSelection changes focus
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 98
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-12-10 22:45 EST by Nick Edgar CLA
Modified: 2002-07-12 19:05 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2001-12-10 22:45:04 EST
Build 20011206

- Window / Preferences
- the focus is on the first selected radio button in the last group

This is because Button.setSelection(boolean) always sets the shell's saved 
focus if the selection is true.
Here, preference pages are created invisibly, then made visible so the saved 
focus becomes the actual focus.

So preference pages with radio buttons will always give focus to the last 
selected radio button.

I will add a workaround to PreferenceDialog to set the focus back to the tree.
Comment 1 Mike Wilson CLA 2001-12-11 13:31:24 EST
Which o/s is this? If it's win32, then there's nothing we can do about it. 
Calling setSelection on a radio button causes the focus to be set to that 
widget.
Comment 2 Nick Edgar CLA 2001-12-11 13:55:57 EST
Yes, windows.  It's SWT that's setting the remembered focus, not Windows, to 
work around a Windows bug.  It seems the current workaround does not properly 
handle the case where the widget isn't visible yet.
Even if Windows does set it, it would seem the workaround should remember the 
old focus, then restore it after.
Comment 3 Mike Wilson CLA 2001-12-11 15:43:02 EST
See comments by Nick.
Comment 4 Steve Northover CLA 2002-07-12 19:05:19 EDT
Fixed > 20020212.  The new fix is to detect when the saved focus is a radio 
button that is not selected and restore the focus to the first widget that will 
take focus instead of the radio button.  Note that if the radio button is 
selected, focus will be restored to it.

I hope no one is relying on focus being given to the selected radio item ...