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

You're completely right with your guess that things break on windows.
Controls do not have the right color initialized - in other words:
controls look white but you get gray when you call getBackground(). In
cosequence my paintListener only works if you set background explicitly.
Is in a bug in the win32 SWT implementation (the java layer does not
reflect the real widget state) or is it a feature of the platform ;-) ?
I think it has to stay in the snippets rather than being called in
CompositeTable after replicating a row (which would have been neat).

Regards
André

> 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é
>
>
> _______________________________________________
> nebula-dev mailing list
> nebula-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/nebula-dev
>
>
> !DSPAM:45e33bed160651044727653!


-- 
André Dietisheim
Stv-Bereichsleiter Products

Puzzle ITC GmbH
Eigerplatz 4
CH-3007 Bern
Telefon +41 31 370 22 00
Mobile  +41 76 423 03 02
Fax     +41 31 370 22 01

Puzzle ist Mitglied der ODF Alliance:
<http://www.puzzle.ch/odfalliance/>




Back to the top