format_entry_text


Description:

[ Version ( since = "3.4" ) ]
public virtual signal string format_entry_text (string path)

For combo boxes that are created with an entry (See GtkComboBox:has-entry).

A signal which allows you to change how the text displayed in a combo box's entry is displayed.

Connect a signal handler which returns an allocated string representing path. That string will then be used to set the text in the combo box's entry. The default signal handler uses the text from the GtkComboBox: entry_text_column model column.

Here's an example signal handler which fetches data from the model and displays it in the entry.

static gchar*
format_entry_text_callback (GtkComboBox *combo,
const gchar *path,
gpointer user_data)
{
GtkTreeIter iter;
GtkTreeModel model;
gdouble value;

model = gtk_combo_box_get_model (combo);

gtk_tree_model_get_iter_from_string (model, &iter, path);
gtk_tree_model_get (model, &iter,
THE_DOUBLE_VALUE_COLUMN, &value,
-1);

return g_strdup_printf ("%g", value);
}

Parameters:

path

the GtkTreePath string from the combo box's current model to format text for

Returns:

a newly allocated string representing path for the current GtkComboBox model.




2022 vala-language.org