In interface.c I have some code for a graph and some basic set of X Y points
for the plot.
I want to use a button to change the waveform. The code of the button is in
callbacks.c
But how do I reference the the correct GtkWidget?
The error messages when I click on the button are:
(harp_app_0:3806): GLib-GObject-WARNING **: invalid cast from `GtkDataboxLines'
to `GtkDatabox'
** (harp_app_0:3806): CRITICAL **: gtk_databox_graph_add: assertion
`GTK_IS_DATABOX (box)' failed
(harp_app_0:3806): GLib-GObject-WARNING **: invalid cast from `GtkDataboxLines'
to `GtkDatabox'
** (harp_app_0:3806): CRITICAL **: gtk_databox_calculate_extrema: assertion
`GTK_IS_DATABOX (box)' failed
This is what my callbacks.c file, here is my file:
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include <math.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
void
button_clicked(GtkButton *synchioButton,
GtkWindow *parent)
{
//GtkWidget *dialog, *label, *image, *hbox;
GtkWidget*plotbox, *graph;
GdkColor color;
gfloat *X, *Y;
gint i;
g_print("SynchioButton I was clicked!\n");
X = g_new0 (gfloat, POINTS); // WILL PROBABLY HAVE TO GET RID OF THIS
Y = g_new0 (gfloat, POINTS);
for (i = 1 ; i < POINTS + 1; i ++) { X [i] = i; Y [i] = log10 (i); }
color.red = 15535;
color.green = 15535;
color.blue = 15535;
graph = gtk_databox_lines_new (POINTS, X, Y, &color, 1);
gtk_databox_graph_add (GTK_DATABOX (plotbox), graph);
gtk_databox_auto_rescale (GTK_DATABOX (plotbox), 0.05);
}
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list