> El 24 ene 2020, a las 21:52, Christophe Demarey <christophe.dema...@inria.fr> > escribió: > > Hi Kasper, > >> Le 24 janv. 2020 à 20:14, Kasper Østerbye <kasper.oster...@gmail.com >> <mailto:kasper.oster...@gmail.com>> a écrit : >> Do not silently delete features. Be brave and include a method oddRowColor >> with a comment saying it is not going to be implemented in this version, and >> why > I add the same issue and I wrote a small fix for TablePresenter. > See > https://github.com/pharo-project/pharo-launcher/commit/28fb65151a6341f26b912a1d2d1034779a49727d > > <https://github.com/pharo-project/pharo-launcher/commit/28fb65151a6341f26b912a1d2d1034779a49727d> > I have only a few changes but I add to copy FTTableContainerMorph and > FTSelectableMorph to add an instance variable on each. Except that, I had 4 > methods to implement a basic row color alternance. > > You can use it as follow in an SpPresenter: > self newTable > items: #(1 2 3); > whenBuiltDo: [ :table | table widget alternateRowsColor ]
Be careful, this is no solution but a patch that will work in some cases only, it is an architectural violation. Widgets should never be accessed from presenters directly. The support for row color should be exposed from the presenter, and the widget should use it (if supported). I remember with Pablo we did a POC to see how this would be supported both by Gtk and morphic and we kind of conclude that the row color should be specified in the datasource. This allows each row (and cells in case of tables) to have its (their) own background color. Gtk (and morphic too) then also have support for alternate row colors, but it is different. While morphic’s depend on the underlying theme, in Gtk we can further specialize the colors. See for example: https://developer.gnome.org/gtk3/stable/GtkTreeView.html#GtkTreeView--s-even-row-color <https://developer.gnome.org/gtk3/stable/GtkTreeView.html#GtkTreeView--s-even-row-color> > > I will try to do a PR next week for this. > > Regards, > Christophe.