GnomeDbCombo

Name

GnomeDbCombo -- A data-bound combo box widget

Synopsis



GtkWidget*  gnome_db_combo_new              (GdaRecordset *recset,
                                             gint pos);
gboolean    gnome_db_combo_get_editable     (GnomeDbCombo *dbcombo);
void        gnome_db_combo_set_editable     (GnomeDbCombo *dbcombo,
                                             gboolean editable);
void        gnome_db_combo_refresh          (GnomeDbCombo *dbcombo);
gint        gnome_db_combo_get_row_count    (GnomeDbCombo *dbcombo);
gchar*      gnome_db_combo_get_string       (GnomeDbCombo *dbcombo);
GdaRecordset* gnome_db_combo_get_recordset  (GnomeDbCombo *dbcombo);
void        gnome_db_combo_set_recordset    (GnomeDbCombo *dbcombo,
                                             GdaRecordset *recset,
                                             gint pos);
void        gnome_db_combo_sync             (GnomeDbCombo *dbcombo);

Description

The GnomeDbCombo widget is a normal combo box widget with the addition of being data bound. That is, you can associate a GdaRecordset with it and it will show all the rows in the recordset for the user to choose one among the list.

This widget is specially useful for data entry screens.

Details

gnome_db_combo_new ()

GtkWidget*  gnome_db_combo_new              (GdaRecordset *recset,
                                             gint pos);

Creates a new GnomeDbCombo widget. You can optionally specify a GdaRecordset object which will be used by the GnomeDbCombo widget

recset :

recordset to be shown

pos :

position of the field being shown

Returns :

a pointer to the new widget, or NULL on error


gnome_db_combo_get_editable ()

gboolean    gnome_db_combo_get_editable     (GnomeDbCombo *dbcombo);

Gets the editing mode for the given GnomeDbCombo widget.

dbcombo :

the GnomeDbCombo widget

Returns :

TRUE if the combo box is editable , or FALSE if not


gnome_db_combo_set_editable ()

void        gnome_db_combo_set_editable     (GnomeDbCombo *dbcombo,
                                             gboolean editable);

Sets the editing mode for the given GnomeDbCombo widget. When the editing mode is set to TRUE, it means that users can type on the combo entry widget, thus making this widget useful for data entry screens where you want users to be able to make modifications.

dbcombo :

a GnomeDbCombo widget

editable :

whether to let (TRUE) or nor let (FALSE) editing


gnome_db_combo_refresh ()

void        gnome_db_combo_refresh          (GnomeDbCombo *dbcombo);

Refreshes the data being displayed by the given GnomeDbCombo widget. This means that the same query is executed on the connection associated with this combo widget.

dbcombo :

a GnomeDbCombo widget


gnome_db_combo_get_row_count ()

gint        gnome_db_combo_get_row_count    (GnomeDbCombo *dbcombo);

Returns the number of rows being currently displayed by the given GnomeDbCombo widget.

dbcombo :

a GnomeDbCombo widget

Returns :

the number of rows


gnome_db_combo_get_string ()

gchar*      gnome_db_combo_get_string       (GnomeDbCombo *dbcombo);

Returns the current selection in the given GnomeDbCombo widget as a string.

dbcombo :

a GnomeDbCombo widget

Returns :

the currently selected item's string


gnome_db_combo_get_recordset ()

GdaRecordset* gnome_db_combo_get_recordset  (GnomeDbCombo *dbcombo);

Gets the GdaRecordset being displayed by the given GnomeDbCombo widget

dbcombo :

a GnomeDbCombo widget

Returns :

the GdaRecordset object associated with the combo widget, or NULL if none.


gnome_db_combo_set_recordset ()

void        gnome_db_combo_set_recordset    (GnomeDbCombo *dbcombo,
                                             GdaRecordset *recset,
                                             gint pos);

Associates a GdaRecordset object with the given GnomeDbCombo widget. This forces the combo widget to get the new set of rows from the database and display them.

It's important to note that the GnomeDbCombo widget keeps a reference to the GdaRecordset object, so it's safe if you call gda_recordset_free on the same recordset you used in the call to this function. Note however that if you close the recordset (by calling gda_recordset_close), this will indeed affect the combo widget if it's keeping a reference to that recordset.

dbcombo :

a GnomeDbCombo widget

recset :

the recordset to be shown

pos :

the column to be shown


gnome_db_combo_sync ()

void        gnome_db_combo_sync             (GnomeDbCombo *dbcombo);

Synchronizes the underlying GdaRecordset object associated with the given GnomeDbCombo widget so that its current row is set to the row selected in the GnomeDbCombo widget.

This is specially useful for data entry screens, where you can have a list of all primary keys in a GnomeDbCombo widget, and, when the user selects an entry in the combo pop-down list, other data entry widgets (such as GnomeDbTable, for instance) update themselves with the contents of the new selected row.

dbcombo :

a GnomeDbCombo widget

See Also

GnomeDbLabel GnomeDbList GnomeDbEntry GnomeDbGrid