Re: libglade+gnome-db example (was Re: Connecting by data source?)
- From: Brian Jepson <bjepson home com>
- To: gnome-db-list gnome org
- Subject: Re: libglade+gnome-db example (was Re: Connecting by data source?)
- Date: Fri, 4 Feb 2000 13:15:09 -0500 (EST)
On Fri, 4 Feb 2000, Rodrigo Moya Piernavieja wrote:
> I'm not very sure of this (so check it), but I think you can retrieve the
> GtkCombo's list selection, which is done like this:
>
> GList* selected = GTK_LIST(GTK_COMBO(combo)->list)->selection;
> guint index = GPOINTER_TO_UINT(selected->data);
>
Thanks - I ended up doing things a little differently (but not much
differently):
/* Find the index of the current combo selection */
selected = GTK_LIST(GTK_COMBO(combo)->list)->selection;
item = GTK_WIDGET(selected->data);
row_index = gtk_list_child_position(GTK_LIST(GTK_COMBO(combo)->list),
item);
and here is how I am repositioning the record set:
/* Reposition the record set */
grs = gnome_db_combo_get_recordset(GNOME_DB_COMBO(combo));
gda_recordset_move_first(grs);
gda_recordset_move(grs, row_index, NULL);
fprintf(stderr, "SELECTED: %d\n", row_index);
and finally, this is how I get the underlying field:
/* retrieve the field we're interested in and return it */
field = gda_recordset_field_idx(grs, column_index);
gda_stringify_value(buffer, sizeof(buffer), field);
fprintf(stderr, "%s\n", buffer);
return g_strdup(buffer);
Does it make sense for gnome-db-combo to have this functionality (at least
repositioning the recordset on the selection)? In my example, I only
reposition it when I want to query the underlying data, but it might be
nice that anytime I do gnome_db_combo_get_recordset, I get a recordset
that is positioned on the current selection.
Also, I've updated the tar file with this example, which is available at:
www.as220.org/~bjepson/gnome-db/db_login.tar.gz
> There were no very important changes from this date, the only thing, which is
> committed today, is the username stuff we talked about yesterday.
Thanks - I just did a new build, and that feature works great!
Brian Jepson * (bjepson@ids.net) * http://users.ids.net/~bjepson
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]