Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317806 - Cocoa TableItem getImageBounds() always offsets x by 3 pixels
Summary: Cocoa TableItem getImageBounds() always offsets x by 3 pixels
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Scott Kovatch CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-24 08:20 EDT by Anirudh Sasikumar CLA
Modified: 2010-08-23 14:15 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anirudh Sasikumar CLA 2010-06-24 08:20:56 EDT
Build Identifier: 20100617-1415

When using a TableViewer with an editor, on click of a cell, the editor is shown 3 pixels to the right overshooting the cell border.

In TableItem getImageBounds(), there is a rect.x  += Table.IMAGE_GAP at line 512. It seems like that addition should be done only when image != null?

This visual artifact is very noticeable in Adobe Flash Builder and any tips on working around this would be much appreciated.

Reproducible: Always

Steps to Reproduce:
1. Use a TableViewer, assign a ComboBoxCellEditor to it.
2. Every time a cell is clicked, notice that the editor moves 3 pixels to the right causing the arrow to overshoot the cell.
Comment 1 Scott Kovatch CLA 2010-07-07 13:59:38 EDT
(In reply to comment #0)
> In TableItem getImageBounds(), there is a rect.x  += Table.IMAGE_GAP at line
> 512. It seems like that addition should be done only when image != null?

No, this is correct. Run Snippet283 on Carbon and Cocoa -- the left edge of the images and the text are all in line.

I will try to make a test case -- if you have one handy please attach it. I don't doubt this is a bug, but something I can compare against Carbon (for example) would be helpful.
Comment 2 Scott Kovatch CLA 2010-07-07 20:38:52 EDT
I see one possible culprit and one workaround. My guess right now is that the default width of the editor for the ComboBoxCellEditor is now too big, so it's pushing the combo off the edge of the cell.

You can work around that by using a subclass of ComboBoxCellEditor that overrides getLayoutData() to return a smaller minimumWidth. Currently it returns a width that's 10 * average char width for the current font.

The rects returned by getImageBounds, getBounds, and getBounds(int) are different than what Carbon returns, but they are all consistent.
Comment 3 Anirudh Sasikumar CLA 2010-07-16 01:31:59 EDT
Hi Scott,

Thank you, your workaround worked for me. 

I will work on making a small test case for this and posting it here.

Thanks,
Anirudh
Comment 4 Scott Kovatch CLA 2010-08-23 14:15:06 EDT
This might end up going to JFace, but for now this is not a bug on SWT's part.