GtkCombo value || Signals
- From: "MET @ Uber" <met uberstats com>
- To: "GTK-List" <gtk-list gnome org>
- Subject: GtkCombo value || Signals
- Date: Sat, 4 Jan 2003 22:11:32 -0500
I'm trying to start a very simple application where basically the user selects
an item from a combo box and then it's associated data pops up into two
GtkEntry text box's. The data and it's associated information is gathered
from a text file during the applications launch.
So here's my problem, very basic to most I'm sure.
On the combo box's "changed" signal I figured I would have a function retrieve
the combo box's text value and then use it to sort through my GList of
structures, once it finds it's equal value in GList, the other associated
data would need to then populate the two GtkEntry text box's. Make sense?
However, I can't seem to get the value from the combo box.
I understand that the combo box is basically just a glorified GtkEntry box so
you have to use gtk_entry_get_text, but I can't get it quit right, because I
don't know how I pass the combo box to it's own signal's function, or it's
another problem. Take a look.
Here's my gtk signal call:
gtk_signal_connect (GTK_OBJECT (combo), "changed",
GTK_SIGNAL_FUNC (on_combo_changed), NULL);
And here's the associated function for the signal:
void on_combo_changed( GtkEditable * combo, gpointer data )
{
gchar * value;
value = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(combo)->entry));
g_print(" :%s\n", (gchar *) value);
}
This doesn't, it fails during runtime with this error:
Gtk-WARNING **: invalid cast from `GtkEntry' to `GtkCombo'
Segmentation fault
I understand the error, however I have no idea how to make it work. As
always, any help would be greatly appreciated.
~ Metnetsky
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]