Re: label and entry
- From: Robert Nikander <nikander mindspring com>
- To: <gtk-app-devel-list gnome org>
- Subject: Re: label and entry
- Date: Sat, 16 Jun 2001 09:06:53 -0400
on 6/16/01 6:48 AM, PCc0d3r at pcc0d3r yahoo com wrote:
what is the wrong with this program?
----------------------------------------------------
<snip>
void goster(GtkWidget *widget,
gpointer data)
{
etiket = gtk_label_new("Etiket");
This isn't working right because data is actually a char, when you want a
char *. See below....
gtk_label_set_text(etiket, data);
gtk_box_pack_start(GTK_BOX(box), etiket, TRUE, TRUE, 0);
gtk_widget_show(etiket);
}
int main(int argc, char *argv[])
{
GtkWidget *edit1;
GtkWidget *buton;
GtkWidget *pencere;
char veri;
That should be: char * veri;
gtk_init(&argc, &argv);
<snip>
gtk_box_pack_start(GTK_BOX(box), edit1, TRUE, TRUE, 0);
veri = gtk_entry_get_text(edit1);
And then you would be getting the right value here. I am suprised this
compiles... shouldn't the compiler complain that you are trying to convert a
char * to a char? Maybe add -Wall to your cflags?
And then here you'd be passing in the char * and all would be well...
gtk_signal_connect(GTK_OBJECT(buton), "clicked",
GTK_SIGNAL_FUNC(goster),
(gpointer) veri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]