struct Gtk::ComboBox::FormatEntryTextSignal
- Gtk::ComboBox::FormatEntryTextSignal
- GObject::Signal
- Struct
- Value
- Object
Overview
Emitted to allow changing how the text in a combo box's entry is displayed.
See [property@Gtk.ComboBox:has-entry].
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 [property@Gtk.ComboBox:entry-text-column] model column.
Here's an example signal handler which fetches data from the model and displays it in the entry.
WARNING ⚠️ The following code is in c ⚠️
static char *
format_entry_text_callback (Gtk::ComboBox *combo,
const char *path,
gpointer user_data)
{
Gtk::TreeIter iter;
Gtk::TreeModel model;
double 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);
}
Defined in:
lib/gi-crystal/src/auto/gtk-4.0/combo_box.crInstance Method Summary
- #connect(*, after : Bool = false, &block : Proc(String, String)) : GObject::SignalConnection
- #connect(handler : Proc(String, String), *, after : Bool = false) : GObject::SignalConnection
- #connect(handler : Proc(Gtk::ComboBox, String, String), *, after : Bool = false) : GObject::SignalConnection
- #emit(path : String) : Nil
-
#name : String
The signal name
Instance methods inherited from struct GObject::Signal
[](detail : String) : self
[],
name : String
name
Constructor methods inherited from struct GObject::Signal
new(source : GObject::Object, detail : Nil | String = nil)
new
Instance Method Detail
def connect(handler : Proc(Gtk::ComboBox, String, String), *, after : Bool = false) : GObject::SignalConnection
#