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

Bug 341539

Summary: TableEditor setting a Button control in a Table is not aligned properly
Product: [Eclipse Project] Platform Reporter: Kevin Tapperson <kevintap>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: ericwill, remy.suen
Version: 4.1Keywords: triaged
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
screenshot on Linux
none
screenshot on Windows
none
sample code none

Description Kevin Tapperson CLA 2011-03-31 15:47:29 EDT
Build Identifier: M20100909-0800

When using a TableEditor to operate on a Table and setting the editor control to a Button, the Button is not properly aligned within the table cell.  On Windows, there is a slight alignment problem, but on Linux, the alignment problem is extreme.  In the attached sample code and screenshots, the Button on Linux is being drawn almost entirely in the following table column with a large amount of whitespace preceeding the Button in the column.

Reproducible: Always
Comment 1 Kevin Tapperson CLA 2011-03-31 15:48:34 EDT
Created attachment 192321 [details]
screenshot on Linux
Comment 2 Kevin Tapperson CLA 2011-03-31 15:49:20 EDT
Created attachment 192322 [details]
screenshot on Windows
Comment 3 Kevin Tapperson CLA 2011-03-31 15:51:42 EDT
Created attachment 192323 [details]
sample code

Attached is a simple test case which brings up an SWT window and renders a table using a TableEditor.  The TableEditor sets a button to be the editor control for a cell in the table, which is rendered with inappropriate spacing.
Comment 4 Eric Williams CLA 2018-05-14 13:56:12 EDT
Still reproducible on 4.8 M7, GTK3.22, and Fedora 28.
Comment 5 Eric Williams CLA 2018-05-25 15:15:04 EDT
(In reply to Eric Williams from comment #4)
> Still reproducible on 4.8 M7, GTK3.22, and Fedora 28.

In addition, it seems that the image isn't being set properly on the button -- the button is blank.
Comment 6 Eric Williams CLA 2018-05-28 13:45:19 EDT
After further investigation I've determined that this is desired behaviour. I tested on Mac -- the button appears at the intended place, but is glitchy. Clicking the button works but it hops around to the offset (the size of the image + 2px), and then back.

Looking into the code, TableEditor.computeBounds() queries the size of the image when determining where to place the editor widget. This in turn calls TableItem.getImageBounds(), which (on GTK2 and 3) correctly returns a rectangle describing the position and size of the images set in the Table. I'm not sure why this only "kind of" works on Mac, but Windows seems to do this as well.

I'll look into the button image issue, and file a separate ticket for that bug. Otherwise this one will be closed as WONTFIX.
Comment 7 Eric Williams CLA 2018-05-29 10:45:47 EDT
(In reply to Eric Williams from comment #6)
> I'll look into the button image issue, and file a separate ticket for that
> bug. Otherwise this one will be closed as WONTFIX.

I couldn't get the image issue to reproduce further in a separate snippet. Closing this ticket now.