Bug 508680 - [win32] Finish custom Button foreground/background color feature
Summary: [win32] Finish custom Button foreground/background color feature
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.7   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: 4.7 M7   Edit
Assignee: Conrad Groth CLA
QA Contact: Niraj Modi CLA
URL:
Whiteboard:
Keywords:
Depends on: 23837
Blocks:
  Show dependency tree
 
Reported: 2016-12-05 11:20 EST by Markus Keller CLA
Modified: 2017-05-10 07:44 EDT (History)
4 users (show)

See Also:


Attachments
test application with different button styles (2.77 KB, application/octet-stream)
2017-02-05 07:36 EST, Conrad Groth CLA
no flags Details
Proposed solution for Push_Button_Left_Right_FocusRing problem (84.92 KB, image/png)
2017-04-28 12:23 EDT, Niraj Modi CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2016-12-05 11:20:35 EST
Rigorously test the attempt of bug 23837 to turn SWT into a Swing-like toolkit.

When re-implementing native widgets, the ControlExample is a good test bed to verify an initial contribution. Launch it once without the changes, and then launch it again with the changes, place the two windows on top of each other, and then visually compare them by switching between the two (Alt+Tab).

This verification needs to be done with different OS fonts and at different resolutions.


Notable differences in master (after bug 508141 comment 6) for custom-drawn Button widgets on Windows 7 100% with Tahoma 8 as system font:

- CHECK and RADIO buttons with Image and Text: should draw focus ring only around text

- PUSH and TOGGLE buttons with Image and Text: text is moved 1 px to the left; image is moved 3 px to the left

Enable Horizontal and Vertical Fill.

- CHECK and RADIO buttons with Text (and Image): Focus ring is around whole button instead of just around the text

- PUSH Buttons with Text, Alignment > Left/Right: text is 1 px too close to the margin

- CHECK and RADIO buttons with Text and Image: Alignment of native buttons stays at Left regardless of the current setting; For owner-drawn buttons, alignment stays at Center instead. (Alignment at Center for PUSH and TOGGLE buttons is correct in owner-draw mode.)
Comment 1 Niraj Modi CLA 2017-01-20 02:26:41 EST
Hi Conrad/Lars, Please this bug plan for 4.7
Comment 2 Niraj Modi CLA 2017-01-20 02:27:15 EST
Hi Conrad/Lars, Please plan this bug plan for 4.7
Comment 3 Eclipse Genie CLA 2017-02-05 07:32:45 EST
New Gerrit change created: https://git.eclipse.org/r/90362
Comment 4 Conrad Groth CLA 2017-02-05 07:36:20 EST
Created attachment 266638 [details]
test application with different button styles
Comment 5 Lars Vogel CLA 2017-03-29 05:17:37 EDT
(In reply to Eclipse Genie from comment #3)
> New Gerrit change created: https://git.eclipse.org/r/90362

Niraj, please review.
Comment 6 Niraj Modi CLA 2017-04-28 04:25:12 EDT
Tested with patch set 2.

(In reply to Markus Keller from comment #0)
> Rigorously test the attempt of bug 23837 to turn SWT into a Swing-like
> toolkit.
> 
> When re-implementing native widgets, the ControlExample is a good test bed
> to verify an initial contribution. Launch it once without the changes, and
> then launch it again with the changes, place the two windows on top of each
> other, and then visually compare them by switching between the two (Alt+Tab).
> 
> This verification needs to be done with different OS fonts and at different
> resolutions.
> 
> 
> Notable differences in master (after bug 508141 comment 6) for custom-drawn
> Button widgets on Windows 7 100% with Tahoma 8 as system font:
> 
> - CHECK and RADIO buttons with Image and Text: should draw focus ring only
> around text
Fixed with patch set 2

> - PUSH and TOGGLE buttons with Image and Text: text is moved 1 px to the
> left; image is moved 3 px to the left
Fixed with patch set 2

> Enable Horizontal and Vertical Fill.
> 
> - CHECK and RADIO buttons with Text (and Image): Focus ring is around whole
> button instead of just around the text
Fixed with patch set 2

> - PUSH Buttons with Text, Alignment > Left/Right: text is 1 px too close to
> the margin
Not fixed yet.

> - CHECK and RADIO buttons with Text and Image: Alignment of native buttons
> stays at Left regardless of the current setting; For owner-drawn buttons,
> alignment stays at Center instead. (Alignment at Center for PUSH and TOGGLE
> buttons is correct in owner-draw mode.)
I didn't noticed this problem.

Apart from this notice, patch set 2 introduced below problem:
- CHECK and RADIO buttons without Vertical fill, top part of the focus ring is not drawn properly.
I have a fix for this, will update the gerrit patch shortly.
Comment 8 Niraj Modi CLA 2017-04-28 11:56:17 EDT
(In reply to Eclipse Genie from comment #7)
> Gerrit change https://git.eclipse.org/r/90362 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=82b8cf40f11f7c0a7dd0bd7e6d9bcc1e41f1c10e
> 
Committed above patch, which fixes most of the issues related to focus ring.

Below issue can be addressed as a separate patch:
- PUSH Buttons with Text, Alignment > Left/Right: text is 1 px too close to the margin
Comment 9 Niraj Modi CLA 2017-04-28 12:23:16 EDT
Created attachment 268071 [details]
Proposed solution for Push_Button_Left_Right_FocusRing problem

(In reply to Niraj Modi from comment #8)
> Below issue can be addressed as a separate patch:
> - PUSH Buttons with Text, Alignment > Left/Right: text is 1 px too close to
> the margin
There can be two possible solutions to this (both have a down side):
1. We shift the text 1px away from the current position of focus ring, so that it doesn't touches the focus ring.
Down side of this approach: Text location of colored buttons will differ from that of Default native buttons(Push/Toggle)
2. Second solution is we shift the focus ring further closer to the edges on Left and Right sides. So the text location remains exactly at the same location as default native buttons(Push/Toggle)
Down side of this approach: Focus ring is not equidistant from the edges of the buttons(Push/Toggle)

IMO, second solution looks better of the two.(Sharing a screen shot for Push button with Left/Right alignment with this fix)
Will share a gerrit patch for this, shortly.
Comment 10 Eclipse Genie CLA 2017-04-28 12:36:25 EDT
New Gerrit change created: https://git.eclipse.org/r/96049
Comment 11 Niraj Modi CLA 2017-05-02 04:47:17 EDT
(In reply to Niraj Modi from comment #6)
> Tested with patch set 2.

> > - CHECK and RADIO buttons with Text and Image: Alignment of native buttons
> > stays at Left regardless of the current setting; For owner-drawn buttons,
> > alignment stays at Center instead. (Alignment at Center for PUSH and TOGGLE
> > buttons is correct in owner-draw mode.)
> I didn't noticed this problem.
Note: This problem is also fixed, by patch committed in comment 7
Comment 13 Niraj Modi CLA 2017-05-03 05:04:26 EDT
Thanks Conrad for the patch, resolving now.
Comment 14 Niraj Modi CLA 2017-05-10 07:44:34 EDT
Verified fix on Win7 using Eclipse Build id: I20170508-2000