| Summary: | Control.getBorderWidth () always returns 0 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | William Kilian <william.kilian> | ||||||
| Component: | SWT | Assignee: | Lakshmi P Shanmugam <lshanmug> | ||||||
| Status: | CLOSED WONTFIX | QA Contact: | Silenio Quarti <Silenio_Quarti> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | lshanmug, william.kilian | ||||||
| Version: | 3.6.2 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Mac OS X | ||||||||
| Whiteboard: | stalebug | ||||||||
| Attachments: |
|
||||||||
|
Description
William Kilian
Are you using the Cocoa or Carbon build? I'm using the Cocoa build. Created attachment 192920 [details]
patch
patch implements getBorderWidth() for the controls that have border.
Silenio, please review.
These are the values I am getting for border width of some widgets (with patch):
Canvas {} 2
List {} 2
Table {} 2
Tree {} 2
Text {MULTI} 2
Text {SINGLE} 4
Link {} 2
Label {} 0
Spinner {} 4
DateTime {} 0
I am sure the values are right for Table/Tree/List, given that they have the focus ring. Note that the value for Text {SINGLE} is 4 because of the focus ring. I believe Link, Canvas and Text {MULTI} are right (no focus ring).
Label is actually reporting the right value, because we are not adding border. We should have a separate bug for this problem.
I am not sure about DateTime and Spinner. Which one is correct? Given that the border/focus ring is not around the whole widget. I would say Spinner.
Unrelated problems:
- I think DateTime should turn of the focus ring when SWT.BORDER is not set.
- the DateTime border is a black. Not the same is the "Date & Time" tab in the System Preferences.
Note that I released a fix for the unrelated problems I mentioned above. Created attachment 192975 [details]
patch-2
Thanks Silenio, I didn't see that the border width was related to focus ring. I've modified the patch so that if the control has border but will not show focus ring then the border width is 0. The getBorderWidth() is implemented in the controls and not in Scrollable.
Text {MULTI} should draw the focus ring so it still returns 2 for border width.
I'm not sure how to get the border width for the DateTime widget, so
hardcoded the value to 2 because it is using bezel border style. Please review.
(In reply to comment #6) > Created attachment 192975 [details] > patch-2 The border width is related to the focus ring because when you create a widget with SWT.BORDER you get both: the bezel border and the focus ring. I believe the previous patch was closer. With this patch Canvas{SWT.BORDER} returns 0 for example. My concern with the previous patch was that Table/Tree/List/DateTime were not returning 4. I think they should since Text{SWT.SINGLE} returns 4. Table/Tree/List/DateTime/Text{SWT.SINGLE} show the focus ring, so the border should be bigger. While looking at an unrelated bug, noticed this is unchanged in 3.7.2. 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. If you have further information on the current state of the bug, please add it. 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. If the bug is still relevant, please remove the stalebug whiteboard tag. |