RE: GtkPlot Sizing



I have found a solution... but there's room for improvement.  Use
gtk_signal_connect() to connect to the gtkplotcanvas "expose_event".  Within
your signal handler use gtk_plot_canvas_set_size() to reset the size,
however, this function will also set the usize (aka the minimum widget size)
of the gtkplotcanvas.  When it does this you won't be able to shrink your
window.  So use gtk_widget_set_usize() to reset the usize to whatever
minimum size you want.  That's it.  In short;

1.) create a signal handler for the "expose_event"
2.) use gtk_plot_canvas_set_size() to reset the widget size
3.) use gtk_widget_set_usize() to reset the minimum widget size

The one thing I don't like about this approach is that the graph get draw
twice.  The first drawing is done at it's original size.  The second drawing
is done at the new size.  If I figure out how to fix this I'll post
something on the mailing lists.



				-- Stupid Genius

> ----------
> From: 	Rasoul Hajikhani[SMTP:rhajikhani exchange office etoys com]
> Sent: 	Tuesday, December 05, 2000 6:18 PM
> To: 	Dugas, Alan
> Cc: 	gtk-app-devel-list gnome org; gtk-list gnome org
> Subject: 	Re: GtkPlot Sizing
> 
> Hey there,
> let me know if you find a solution... I have the same problem.
> Thanks in advance
> -r
> 
> On Mon, 4 Dec 2000, Dugas, Alan wrote:
> 
> > Two questions...
> > 
> > 1.) How do I get a GtkPlot to make full use of a Gtk_Plot_Canvas that is
> in turn
> > packed into a vbox?  Currently I have a gtkplot that does not use all of
> the
> > space allocated to the canvas by the vbox and displays empty gray dead
> space
> > instead.
> > 
> > 2.) Does anyone know how to get a GtkPlot to auto-resize when a window
> is
> > resized?  Is it simply a matter of connecting to the GtkWindow
> "configure_event"
> > signal containing the GtkPlot once I get question #1 working properly?
> > 
> > 
> > Any and all responses would be greatly appreciated!
> > 
> > 
> > 
> > 				-- Stupid Genius
> > 
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> > 
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 




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