• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

SWT tableitem, image not displaying properly.

Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a tableItem in an swtTable where I use an image in the first cell *with indent*.

A few problems -
first, I discovered the table background color bug, where the background behind my image is reverting to the *table* bgColor, and not the table *item* bgColor (result is that even though my row is blue, the image column has a black background (black is the table background color, also the area that is 'indented' is the same black color.

Second, i figured that the easiest way would be to custom draw the indented image (instead of using tableitem.setImageIndent()) with the indent already in the image, and just setting the image into the tableitem and drawing the background correctly, on the fly.
this does not work either, because now, even though the background color behind the image is correct, the column has a black border between all the cells. this only affects the column with the image, and it looks very ugly.

Third, i tried just manually drawing the image using the table's GC (gc = new GC(table)), which actually looks good (i guess the black borders above were coming from code in the standard item drawing, whereas here i am actually drawing 'over' the table, hence it is not subject to any of those issues.)
HOWEVER, now, when i select a row, the image i draw gets clobbered when the row selection highlight is drawn in. i have some listeners in place to take care of redrawing , but here's the catch - we have DND (drag and drop) enabled on this table, which hangs the redrawing until the drag is done. so when you click on a row, you get these ugly flickers while the mouse is down (and windows is waiting to see if a drag is going to start, during which it eats event and drawing is halted).

any of those solutions would work fine if not for a small issue. can anyone help?

P.S. i forgot - I also tried one other strategy, which was drawing in the background manually, using an EraseItem listener. this looks fine, but is very slow (we have upwards of 50 columns, potentially more) when scrolling horizontally.
A timing clock, fuse wire, high explosives and a tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic