Re: [gnome-db] input values in SQL view



Rodrigo wrote:
> > > 
> > 
> > Yes, good idea. This way we also could use the plugins from mergeant
> > which explain how to enter data depending on the data type (so no
more
> > worry about the 'value' instead of simply value).
> > 
> yes, sounds good. I'll do it that way. Is there a widget(s) already
for
> that?

I propose the following syntax:
[:field_name type="type_name" descr="the description" default="the
default value"]

where type is mandatory and the other attributes not. Note: it is IMHO
better to user [] instead of <> because we will have some confusions
with the XML's <> when we store the 'enhanced' SQL query in an XML file.

The existing widget for this is the DataEntry widget which can be
obtained following these steps:
-> use server_access_get_type_from_name() to get a ServerDataType object
from the type name given by the user. You get the ServerAccess object
from the ConfManager object.The ServerDataType is the object which
represents the data type in mergeant.
-> use server_access_get_handler_from_type() to get a DataHandler object
from the ServerDataType. This DataHandler is an object which handles the
plugins.
-> use data_entry_new() to get the widget you put in the form

When you want to read the value of this widget, use
data_entry_get_gdavalue() which will return a GdaValue you'll have to
free after usage.

See the header files for more info.

The problem you'll face is the default value. If you want to update the
value in the widget, you have to use the data_handler_widget_update()
function which will update the widget, and this function only accepts a
GdaValue as parameter, not a string.

What I need to do is rationalise a bit the DataEntry's API to enable
setting a default value from a string or from a GdaValue.

It's on my TODO list. While it's not done, I propose that you simply
don't care about the "default" attribute.

How does it sound?

Vivien




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