Bug 172464 - Table Editors on First line have a drawing problem
Summary: Table Editors on First line have a drawing problem
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: PC All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-01 07:04 EST by Anibal Maffioletti de Deus CLA
Modified: 2019-09-06 16:14 EDT (History)
3 users (show)

See Also:


Attachments
Picture showing the bad drawn column (6.74 KB, image/jpeg)
2007-02-01 07:06 EST, Anibal Maffioletti de Deus CLA
no flags Details
Snippet showing the bug described (4.05 KB, text/java)
2007-02-01 07:07 EST, Anibal Maffioletti de Deus CLA
no flags Details
Revised example (3.38 KB, application/octet-stream)
2007-02-05 15:34 EST, Duong Nguyen CLA
no flags Details
A new revision making the Snippet more like what happens on my app (3.47 KB, text/java)
2007-03-12 09:27 EDT, Anibal Maffioletti de Deus CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anibal Maffioletti de Deus CLA 2007-02-01 07:04:42 EST
Build ID: M20060921-0945

Steps To Reproduce:
Insert a table editor with a size bigger then the default line height, then insert another row: in the first one, the editor will be cutted, but from the second on, it will be ok.

More information:
There is a post in the newsgroup dated Jan/15 at 10h52 posted by me (Anibal Maffioletti de Deus). I'm also including some pictures and even a snippet that shows the especified problem.
Comment 1 Anibal Maffioletti de Deus CLA 2007-02-01 07:06:12 EST
Created attachment 57997 [details]
Picture showing the bad drawn column
Comment 2 Anibal Maffioletti de Deus CLA 2007-02-01 07:07:47 EST
Created attachment 57998 [details]
Snippet showing the bug described

Snippet that shows the problem I'm 
facing. The idea of the snippet is simple: when you press some key, the 
first Table Editor is created (and appears cuted), and then, when you focus 
on the Text it creates another line (perfect).
It resambles my problem: while I don't have an textbox, lines should appear 
thinner, the when I have the first Text they can get bigger. Also, I can't 
make thinner Texts, they need to be of that size.
Comment 3 Steve Northover CLA 2007-02-05 11:58:27 EST
Duong, looks like Windows 2000.  Can you recreate this and find me.
Comment 4 Duong Nguyen CLA 2007-02-05 15:34:34 EST
Created attachment 58279 [details]
Revised example

This problem appears to happen in XP too but I believe it's a user error.

The item height is set a bit too late such that when the first editor is created it's still using the old height. If you move the following lines outside of the filter handle event, the problem is fixed:

	table.addListener(SWT.MeasureItem, new Listener() {
		public void handleEvent(Event event) {
			if (event.type == SWT.MeasureItem)
				event.height = 22;
		}
	});

Please see attachment.
Comment 5 Anibal Maffioletti de Deus CLA 2007-03-12 09:27:19 EDT
Created attachment 60548 [details]
A new revision making the Snippet more like what happens on my app

Ok, the modification worked in the Snippet, but not yet on my app. It took a bit to understand what was the problem that made the problem persist: when the textbox is created on my app, the Table is hidden (it is visible, but in another TabItem), so I think that the problem is that the SWT.MeasureItem is not called before the textbox be inserted. Do you have any new clue? I created a new snippet showing the problem (the Table is hidden until after the textbox is inserted, then, the 'cut' problem keeps happening).
Comment 6 Anibal Maffioletti de Deus CLA 2007-04-10 10:17:17 EDT
If it helps, I managed a workaround with the following code:

uiTable.addPaintListener(new PaintListener() {
    public void paintControl(PaintEvent e) {
        OS.SendMessage(uiTable.handle, OS.WM_HSCROLL, 0x00000004, 0x00000000);
    }
});
Comment 7 Mike CLA 2008-07-08 14:51:54 EDT
This bug still exists in 3.4, I was able to fix it on windows using OS.SendMessage(uiTable.handle, OS.WM_HSCROLL, 0x00000004, 0x00000000 - Thanks Anibal for this

but how to fix it in linux? any idea

Mike
-----------------------------------------
http://www.ldapsoft.com
http://www.ldapadmintool.com
Comment 8 Anibal Maffioletti de Deus CLA 2008-07-08 15:08:37 EDT
Well, if workarounds are the go, I can tell how I figured it out on Windows:
I started a MessageSpy (from Visual Studio) and catched all messages sent to the handle of the grid until see it fixed (I figured it out that scrolling fixes the problem at least on Windows), so I forced a scroll repaint sending that message.
But since I don't know Linux internals, I can't help you more than that. Hope it helps... And get a definitive fix soon.
Comment 9 Steve Northover CLA 2008-07-08 16:52:53 EDT
If you do this in the first line of your key down filter, it works:

	table.setVisible(true);
	table.update();

The update() us needed to force the repaint (and hence the measure event) to happen before you call getItemHeight().  This should work on all platforms.
Comment 10 Eclipse Webmaster CLA 2019-09-06 16:14:02 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.

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.