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 a lot for the positive feedback! Always nice to hear :-)

I have a more pickier problem I just managed to solve for GTK+ (I'll
test things on Win32 asap) and I would appreciate a lot your ideas on
this issue & my possible fix as this one gets deeper into compositeTable
and SWT. But take your time! I really do not want to put more stress on
you than you certainly already have :-(

The issue can be experienced when you scroll the table by mouse-wheel
very fast and you scroll the current row outside the viewport. It gets
more frequent the more widgets are visible (the more complex a row is).
The issue is that an arbitrary scrolled-in row (after the current row
was scrolled out) gets focused and gets 'current row' - I clearly
tracked it down to focusGained() in InternalComposite. I believe that
the newly focused row is actually the one that got scrolled out and was
repositioned to the top (and refreshed with new model-content). 
I believe that this is due to deferredSetFocus() that gets delayed a lot
and gets executed only when the row was repositioned and scrolled in (on
the top) again.
My possible fix (tested for GTK) is to keep track of the control to
focus delayedly (asyncExec) by setting the instance variable
this.toFocus. Furthermore to clear that instance variable on row
departure & fire a focusOut-event on the other hand. I try to prevent
any deferredSetFocus() that would focus any control that was departed
and is visible again, when asyncExec finally gets executed.

Regards
André 

On Thu, 2007-03-01 at 18:59 -0600, David J. Orme wrote:
> 
> I'll reply to all 3 messages at once: you're doing a great job;
> exactly what I would do.   Please submit a patch. :-)
> 
> 
> Regards,
> 
> Dave
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 26 Feb 2007 20:57:49 +0100
> From: Andr? Dietisheim <dietisheim@xxxxxxxxx>
> Subject: Re: [nebula-dev][compositeTable] per-column color
>         paintListener
> To: Nebula Dev <nebula-dev@xxxxxxxxxxx>
> Message-ID: <1172519869.14599.9.camel@pmobilead>
> Content-Type: text/plain; charset=utf-8
> 
> 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��
> 
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 27 Feb 2007 09:54:28 +0100 (CET)
> From: " Andr? Dietisheim " <dietisheim@xxxxxxxxx>
> Subject: Re: [nebula-dev][compositeTable] per-column color
>         paintListener
> To: <nebula-dev@xxxxxxxxxxx>
> Message-ID:
>         <12621.194.150.244.67.1172566468.squirrel@xxxxxxxxxxxxxxxxxxxxx>
> Content-Type: text/plain; charset=iso-8859-1
> 
> 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
> >
> >
> > 
> 
> 
> -- 
> 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/>
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 27 Feb 2007 11:00:53 +0100 (CET)
> From: " Andr? Dietisheim " <dietisheim@xxxxxxxxx>
> Subject: Re: [nebula-dev][compositeTable] per-column color
>         paintListener
> To: <dietisheim@xxxxxxxxx>, <nebula-dev@xxxxxxxxxxx>
> Message-ID:
>         <48549.194.150.244.67.1172570453.squirrel@xxxxxxxxxxxxxxxxxxxxx>
> Content-Type: text/plain; charset=iso-8859-1
> 
> Hi Dave
> 
> update: sorry!!! my fault! the bugs I experienced were completely my
> fault. There's no bad background-color returned when it has not been
> set
> before!
> Was probably some kind of evil-empire-reflex ;-)))
> The only thing that's not quite accurate is the control that does not
> expand horizontally to the full row-colum area and the background's
> not
> set to its complete horizontal extent (small gaps on the left and on
> the
> right), but no big deal!
> I'll try to patch InternalCompositeTable. I think that it would be
> nice to
> have that background-paining automagically (though handwork is no big
> deal
> either) done. What's your opinion?
> 
> Greets
> Andr�
> 
> > 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
> >>
> >>
> >>
> >
> >
> > --
> > 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/>
> >
> >
> > _______________________________________________
> > nebula-dev mailing list
> > nebula-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/nebula-dev
> >
> >
> > !DSPAM:45e3f1d837528510621087!
> 
> 
> -- 
> 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/>
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> nebula-dev mailing list
> nebula-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/nebula-dev
> 
> 
> End of nebula-dev Digest, Vol 11, Issue 20
> ******************************************
> !DSPAM:45e76a113763936241041! 
> _______________________________________________
> nebula-dev mailing list
> nebula-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/nebula-dev
> 
> 
> !DSPAM:45e76a113763936241041!



Back to the top