Re: Different Prima-Widgets within a grid

From: Dmitry Karasik <>
Date: 27 Apr 2005 14:53:03 +0200

        Hi Johannes!

On 27 Apr 05 at 09:20, "Johannes" (Johannes Blankenstein) wrote:

 Johannes> Good Morning, I have a 'little' question regarding grids.

 Johannes> Is it possible to include an Prima-Object within a grid cell?

 Johannes> For example:

 Johannes> I would like to create a grid (2x2) size.

 Johannes> Within cell (0, 0) I would like to insert a Prima::ComboBox.
 Johannes> Within cell (0, 1) a Prima::Calendar. Within cell (1, 0) a
 Johannes> Prima::Label, and in (1,1) a Prima::Button.

 Johannes> How would this be done? I only found to insert text or grafic
 Johannes> (via canvas) into a grid cell.

That's tricky, and what's worse, has no generic solution ( in Prima ).
The problem is not how to insert a widget; this part is trivial. The problem is
how to track correctly whenever a cell is shown, hidden, or is moved. Of course,
if one creates a non-scrollable non-resizeable grid, these problems are void.

Grid (and List, Outline, etc) doesn't provide these kinds of callbacks,
so one has to track all Grid-specific scrolling and moving events .
My best advice is to derive a class from Grid, overload all relevant
properties that are called when the Grid is scrolled or resized, -
dx(), dy(), reset(), and show, hide, or move the widgets together
after the cell. Also, note that Grid dimensions can be arbitrarily large,
while OS-dependent widget coordinate dimensions end around 16-32K.

Another problem is that a widget can overlap Grid exterior decorations,
say, when a cell is only partially seen. Straightforward change of the
widget size probably won't work, because the widget will try to accomodate
to the new size, and what is needed is to create an impression as if the
widget is overshadowed by the decorations. To fix that, one can insert a
dummy Prima::Widget, and the needed widget in it, so, when a cell is
fully visible, both are resized, and only Prima::Widget when the cell is
partially seen.

I never tried to implement this functionality, so I don't know how
hard is it, but if you'll try, I'm very curious to look at the results.

	Dmitry Karasik
Received on Wed 27 Apr 2005 - 14:53:06 CEST

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:05 CET