GtkCurveTypeProblem



I encountered a problem while using GtkCurve. Following is a fragment of my code.

  main_curve = gtk_curve_new ();
  gtk_widget_ref (main_curve);
  gtk_object_set_data_full (GTK_OBJECT (main_window), "main_curve", main_curve,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (main_curve);
  gtk_box_pack_start (GTK_BOX (vertival_box_top), main_curve, TRUE, TRUE, 0);
  gtk_curve_set_range (GTK_CURVE (main_curve), 0, 100, 0, 100);
  fill_vector();
  gtk_curve_set_vector(GTK_CURVE(main_curve), 50, vec);
  
  In this code, as per documentation, the GtkCurveType will automatically set to GTK_CURVE_TYPE_FREE, since I 
have used gtk_curve_set_vector(blah, blah). I have got intermittant horizontal lines of 50 numbers plotted 
instead of points. At this point I wanted to change the curve to GTK_CURVE_TYPE_SPLINE in order to get a 
smooth graph. When I insert the line,

 gtk_curve_set_curve_type(GTK_CURVE(main_curve), GTK_CURVE_TYPE_SPLINE);

 I was able to make it without any problem. But when I executed the program, I was encountered the following 
problem.

 Glib-ERROR **: could not allocate -20 bytes
 aborting...
 Aborted

My questions are these.
1) Is it not possible to have the curve type changed after having the curve plotted using GTK_CURVE_TYPE_FREE 
?

2) Is the functionality of GtkCurve widget limited to that of gamma graphs? I need to get a graph with 
xlables, ylables, marked and labeled axes etc. If it is indeed limited, can someone guide me how to modify 
the GtkCurve widget to suit my needs. 

I am a novice programmer in Gtk. Please help me out this problem.

~surej
--




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]