understanding callback functions
- From: Oliver Lamm <oli Athos bordernet de>
- To: gtk-app-devel-list gnome org
- Subject: understanding callback functions
- Date: Sun, 13 May 2001 19:21:16 +0200
Hi !
I've a little porblem which might be simple.
I have the following scenario:
- one main window with one vbox. In the lower vboxpart is a button
called mybutton.
My goal:
- A label should be displayed in the upper vboxpart when the button is pressed.
My problem:
- I create the window, vbox, button with no problems. But then I want
to connect a signal_handler to the clicked-event.
I tried the following:
gtk_signal_connect_object(GTK_OBJECT(mybutton), "clicked",
GTK_SIGNAL_FUNC(klickme),
GTK_OBJECT(myvbox));
This is my callback-function klickme:
void klickme(GtkButton * mybutton, gpointer data){
GtkWidget *label;
label = gtk_label_new("test");
gtk_box_pack_start(GTK_BOX(data),label)
}
The programm compiled, but if i press the button I get the following
failure:
Gtk-CRITICAL **: file gtkbox.c line 330(gtk_box_pack_start):
assertion 'GTK_IS_BOX (box)' failed
Can somebody post perhaps the correct code do do what I trie here ?
Yours, Oliver
--
8<------------------------------------------------------------->8
Oliver Lamm Administrator HDZ/IMA RWTH Aachen
lamm hdz-ima rwth-aachen de Tel.: +49-241-9666-30
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]