I think your best bet is to isolate the problem down to a small amount
of stand-alone code.  You will most likely discover the problem in the
process of isolation.  If you don't, re-post the isolated code (the
smaller the better), and I'll take a look again.

-Anthony Vallone

> Hi Anthony,
> 
> thank you for your help, but I really do not see where the 
> pointers are changed and I also didn't experienced any memory 
> problems, here the complete simulation_page.cpp (the third 
> file, where the boxes are attached to the buttons, and where 
> only the first box maintain its proper pointer value):
> 
> 
> #include <simulation_page.h>
> #include <gtk/gtk.h>
> 
> void start_button_callback (GtkWidget *widget, gpointer data) {
>       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
>       {
> 
> //            gtk_widget_ref(( ( Surgery* )data 
> )->getGui()->getStartButtonBox());
>               gtk_container_remove(GTK_CONTAINER (widget), ( 
> ( Surgery* )data )->getGui()->getStartButtonBox());
> //            gtk_container_add(GTK_CONTAINER (widget), ( ( 
> Surgery* )data
> )->getGui()->getStopButtonBox());
> //            gtk_widget_unref(( ( Surgery* )data 
> )->getGui()->getStartButtonBox());
> 
>               gtk_widget_show (( ( Surgery* )data 
> )->getGui()->getStopButtonBox());
>               gtk_container_add (GTK_CONTAINER (widget), ( ( 
> Surgery* )data )->getGui()->getStopButtonBox());
>               gtk_widget_show (widget);
> 
> //            ( ( Surgery* )data )->startSimulation();
>       } else {
> 
>               gtk_container_remove(GTK_CONTAINER (widget), ( 
> ( Surgery* )data )->getGui()->getStopButtonBox());
>               gtk_widget_show (( ( Surgery* )data 
> )->getGui()->getStartButtonBox());
>               gtk_container_add (GTK_CONTAINER (widget), ( ( 
> Surgery* )data )->getGui()->getStartButtonBox());
>               gtk_widget_show (widget);
> 
> //            ( ( Surgery* )data )->stopSimulation();
>       }
> }
> 
> void record_button_callback (GtkWidget *widget, gpointer data) {
>       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
>       {
>               ( ( Surgery* )data )->startRecording();
>       } else {
>               ( ( Surgery* )data )->stopRecording();
>       }
> }
> 
> void createSimulationPage(GtkWidget *notebook, Surgery *s) {
>       
>       GtkWidget *boxH;
>       GtkWidget *boxV;
>       GtkWidget *box;
>       GtkWidget *button;
>       GtkWidget *toggle_button;
>       GtkWidget *frame;
>       GtkWidget *label;
> 
>       boxH =  gtk_hbox_new (FALSE, 10);
>       boxV =  gtk_vbox_new (FALSE, 10);
> 
>       toggle_button = gtk_toggle_button_new();
> //    box = png_label_box ("gui/icons/player_play.png", "Start");
>       gtk_widget_show (s->getGui()->getStartButtonBox());
>       gtk_container_add (GTK_CONTAINER (toggle_button),
> s->getGui()->getStartButtonBox());
>       gtk_widget_show (toggle_button);
>       gtk_box_pack_start (GTK_BOX (boxV), toggle_button, 
> TRUE, FALSE, 20);
>       g_signal_connect (G_OBJECT (toggle_button), "clicked", 
> G_CALLBACK (start_button_callback), (gpointer) s);
> g_print("record: %d\n", s->getGui()->getStartButtonBox());
> 
>       toggle_button = gtk_toggle_button_new();
> //    box = png_label_box ("gui/icons/player_record.png", "Record");
>       gtk_widget_show (s->getGui()->getRecordButtonBox());
>       gtk_container_add (GTK_CONTAINER (toggle_button),
> s->getGui()->getRecordButtonBox());
>       gtk_widget_show (toggle_button);
>       gtk_box_pack_start (GTK_BOX (boxV), toggle_button, 
> TRUE, FALSE, 0);
>       g_signal_connect (G_OBJECT (toggle_button), "clicked", 
> G_CALLBACK (record_button_callback), (gpointer) s);
> g_print("record: %d\n", s->getGui()->getRecordButtonBox());
> 
>       button = gtk_button_new();
> //    box = 
> png_label_box("gui/icons/applets-screenshooter.png", "Screenshot");
>       gtk_widget_show(s->getGui()->getScreenshotButtonBox());
>       gtk_container_add(GTK_CONTAINER (button),
> s->getGui()->getScreenshotButtonBox());
>       gtk_widget_show(button);
>       gtk_box_pack_start(GTK_BOX (boxV), button, TRUE, FALSE, 0);
> g_print("record: %d\n", s->getGui()->getScreenshotButtonBox());
> 
>       frame = gtk_frame_new ("Cryoprobes");
>       gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
>       gtk_widget_set_size_request (frame, 150, 75);
>       gtk_widget_show (frame);
>       gtk_box_pack_start (GTK_BOX (boxV), frame, FALSE, TRUE, 5);
> 
>       frame = gtk_frame_new ("Isotherms");
>       gtk_container_set_border_width (GTK_CONTAINER (frame), 10);
>       gtk_widget_set_size_request (frame, 150, 75);
>       gtk_widget_show (frame);
>       gtk_box_pack_start (GTK_BOX (boxV), frame, FALSE, TRUE, 5);
> 
>       gtk_widget_show (boxV);
>       gtk_box_pack_start (GTK_BOX (boxH), boxV, FALSE, TRUE, 5);
>       gtk_widget_show (boxH);
> 
> // including Drawing Area
>       GtkWidget *vtk_area;
>       vtk_area = s->getDrawingArea();
>       gtk_box_pack_start (GTK_BOX (boxH), vtk_area, 1,1,0);
>       gtk_widget_set_size_request(vtk_area, 400,400);
>       gtk_widget_show (vtk_area);
> 
>       label = gtk_label_new ("Simulation");
>       gtk_notebook_append_page (GTK_NOTEBOOK (notebook), boxH, label);
> 
> }
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to