Re: [gnome-db] Formatting numbers in Form/Grid



On 1/31/07, Murray Cumming <murrayc murrayc com> wrote:
On Wed, 2007-01-31 at 20:45 +0100, Vivien Malerba wrote:
> On 1/31/07, Murray Cumming <murrayc murrayc com> wrote:
> > On Wed, 2007-01-31 at 19:35 +0100, Vivien Malerba wrote:
> > [snip]
> > > So for your specific problem, I suggest you write a GnomeDbDataEntry
> > > and a GtkCellRenderer which display dates in the way you want. Also if
> > > you want and if the plugin you write could be usefull to others, we
> > > could include it into the libgnomedb's sources.
> > >
> >
> > Couldn't we just extend the existing widgets? They must do some kind of
> > sprintf() at the moment, so we could just provide API to allow you to
> > specify a different sprintf format. Or maybe a cell_data_func callback.
> >
> > I would prefer a more meaningful way to define formatting, which would
> > be used for interpretation too, but that can be added in a future
> > version. For instance, Glom has this simple data structure:
> > http://svn.gnome.org/viewcvs/glom/trunk/glom/libglom/data_structure/numeric_format.h?rev=845&view=markup
>
> I suppose you could also modify one of the GnomeDbEntryDate for dates
> (or GnomeDbEntryTime for time, ...) for example to add some format
> specification, and then one could set that format as with any other
> plugin (exactly in the same way). This could also be applied to the
> GnomeDbEntryString (for numbers and strings).
>
> As a matter of fact I was planning to add a way to specify a mask to
> enter data (as for example like
> http://gtkmaskedentry.sourceforge.net/), and other attributes such as
> text max length; so if you can wait till next week (I probably won't
> have the time to do it before), you'll have the framework in place to
> add more format spec.

Great. Are you sure that that will deal with the same problem as
numerical representation, or just what formats may be entered?

It's up to you to define what the attributes will be and what they
will do. The only constraint is that the GnomeDbDataEntry or
GtkCellRenderer used take a GValue as input and returns a GValue when
the data being displayed is modified.

Cheers,

Vivien



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]