Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [nebula-dev][compositeTable] per-column color paintListener

Hi Dave

thanks for the hint! I posted the shots to flickr.com:

http://www.flickr.com/photos/23655688@N00/

I thought of putting this stuff to the snippets or maybe to a utility
class (RowCompositeUtils.attachBackgroundPainter(Control control)?).
That would keep full freedom in choosing row-objects.
I developed that stuff on GTK+ (at home :-)) and I'll check tomorrow on
windows (at work) if everything's fine in redmond land.

to resume up things, here once more (for the list) the reason for this
stuff:

Screenshot1 shows that a text control does not take the whole vertical
space in a column (same applies to checkboxes) if there are combos and
buttons in the same row. If you put the background-color to the
text-control only, it looks very ugly. It is no solution to stretch the
text-control to fit to the vertical size of the row. Text control
vertical align text to the top.

Screenshot2 shows the results after appending my little paintListener. I
fill the 'column'-area in the row with the same color as the control.
Things look now right!


Control rowControl = control.getParent();
            rowControl.addPaintListener(new PaintListener() {

                public void paintControl(PaintEvent e) {
                    Color initialBackground = e.gc.getBackground();
                    e.gc.setBackground(control.getBackground());
                    Control rowControl = ((Control) e.widget);
                    Rectangle cellBounds = control.getBounds();
                    Rectangle bounds = new Rectangle(
                       cellBounds.x, 
                       0,
                       cellBounds.width, 
                       rowControl.getBounds().height);
                    e.gc.fillRectangle(bounds);
                    e.gc.setBackground(initialBackground);
                }
            });

Thanks for your feedback!!
André




Back to the top