Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311916

Summary: [Forms] FormEditor focus behavior ignores IManagedForm for IFormPage pages
Product: [Eclipse Project] Platform Reporter: Kahmyong Moon <kmoon>
Component: User AssistanceAssignee: platform-ua-inbox <platform-ua-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: cgold, pwebster
Version: 3.5.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=509486
Whiteboard: stalebug
Attachments:
Description Flags
FormEditor focus behavior example none

Description Kahmyong Moon CLA 2010-05-06 12:00:35 EDT
Build Identifier: 20100218-1602

setFocus() on FormEditor inherits from MultiPageEditorPart. In the case of an IFormPage page, this sends focus directly to the ScrolledForm control managed by ManagedForm, bypassing the focus behavior implemented by ManagedForm and using the behavior of ScrolledForm, which is the same as any other Composite.

I suggest that either ManagedForm should return a control that delegates focus traversal to the managed form, or FormEditor's setFocus() should override MultiPageEditorPart to explicitly handle focus for form pages.

A workaround is to override setFocus() in the editor (MyLyn's TaskEditor appears to do this), or in the child controls (the PDE editor seems to take this approach).

Reproducible: Always

Steps to Reproduce:
1. Create a FormEditor.
2. Add an IFormPage to the editor with some child controls and IFormParts.
3. Open the editor.
4. Defocus and refocus on the page (for example, by switching editors/pages).
5. Focus will be on the first control accepting focus, not the first IFormPart.
Comment 1 Chris Goldthorpe CLA 2010-11-11 16:38:43 EST
Can you attach an example plug-in which illustrates the problem?
Comment 2 Kahmyong Moon CLA 2010-11-11 19:26:48 EST
Created attachment 182943 [details]
FormEditor focus behavior example

Source code for a simple example FormEditor, demonstrating inconsistent focus behavior.

The form consists of two identical pages containing two SectionPart objects, each containing a Composite with two Text controls and a Button control.

The left SectionPart attempts to control focus using IFormPart.setFocus(). This only works when programmatically triggered using the "Focus IFormPart" button.

The right SectionPart attempts to control focus using Control.setFocus(). This works when the Section client is focused (by clicking on it, for example).

Flipping pages should demonstrate the focus behavior of FormEditor.setFocus() (inherited from MultiPageEditorPart), which is to focus on the first focusable control. (In this case, the first Section's description.) ManagedForm.setFocus() is not used.

I don't recall why this behavior bothered me originally. Perhaps I expected too much of the IFormPart focus mechanism.
Comment 3 Eclipse Genie CLA 2020-05-22 16:06:10 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.