[Glade-users] Problems with lookup_widget()
- From: asdlinux yahoo se (Magnus Wirström)
- Subject: [Glade-users] Problems with lookup_widget()
- Date: Tue, 10 May 2005 17:14:01 +0200
s=F6ndagen den 8 maj 2005 21.32 skrev Magnus Wirstr=F6m:
Hi
I have a problem with my app. I'm doing kinda lots of lookup_widget()
commands and they work just fine. To save time i hav dublicated much of t=
he
code. The thing is that I have a lookup_widget() that crashes my app but
the duplicate dont, and i can't figure out why. The code looks like this:
*crash here* entry_widget =3D lookup_widget(GTK_WIDGET(button),
"text_paket"); buffer =3D gtk_entry_get_text(GTK_ENTRY(entry_widget));
strncat(post,buffer,cut_string(buffer));
strncat(post,"\t",1);
here is a sample of the code that does work just fine:
entry_widget =3D lookup_widget(GTK_WIDGET(button), "text_personnummer"=
);
buffer =3D gtk_entry_get_text(GTK_ENTRY(entry_widget));
strncat(post,buffer,cut_string(buffer));
strncat(post,"\t",1);
Is there anyone that can help me figure out why i have this behaivour in =
my
app. I would say also it was working before but suddenly stopped without
any reason that i can give.
Thanks for the help.
Magnus
Hi :)
I have now found out that my problem occurs after i call a function i wrot=
e,=20
I am a novice in this so i might have done something stupid then i wrote it=
=2E=20
It works as it intended but after calling it crashes the app at the next=20
lookup_widget i use. Segment fault (11) is the result of the crash. here is=
=20
the function:
=2D- Widget setup ---------------------------------------------------------
comboboxentry1 =3D gtk_combo_box_entry_new_text ();
gtk_widget_show (comboboxentry1);
gtk_table_attach (GTK_TABLE (table3), comboboxentry1, 1, 3, 12, 13,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), _("PN1000#BAS"=
));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1),=20
_("PN1800#BAS/UTLAND"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), _("PK1000#UPP=
=20
TILL 26"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), _("PK1800#UPP=
=20
TILL 26/UTLAND"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1),=20
_("PN1330#KV=C3\204LL&HELG"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1),=20
_("PN1810#KV=C3\204LL&HELG/UTLAND"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), _("PN1450#DYGN=
ET=20
RUNT"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), _("PN1820#DYGN=
ET=20
RUNT/UTLAND"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1), _("PN1770#KOMP=
IS=20
0KR TILL FASTA N=C3\204T OCH TILL ALLA TELE2-MOBILER"));
gtk_combo_box_append_text (GTK_COMBO_BOX (comboboxentry1),=20
_("PN1830#KOMPIS/UTLAND"));
=2D------------------------------------------------------------------------=
=2D------------------------------------
char*
getcat (GtkWidget *button)
{
char *buffer;
GtkWidget *entry_widget;
gchar *string;
=09
entry_widget =3D lookup_widget(GTK_WIDGET(button), "comboboxentry1");
string =3D gtk_combo_box_get_active_text((GtkComboBox*)entry_widget);
=09
strncpy(buffer,string,6);
=09
return(buffer);
}
Anyone see an error ??
Magnus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]