easy question about viewports



Hi, I'm new to GTK and have a (hopefully) easy question about using
GtkViewport.  I hope this is the right place to ask.

I have a large GtkFrame, and I want to display a 100-by-100 piece in a
GtkViewport.  I'm using Viewport directly, rather than ScrolledWindow,
because I don't want the scrollbars. I thought that the following code
fragment would work:

	hadj = gtk_adjustment_new(0, 0, 1000, 1, 1, 100);
	vadj = gtk_adjustment_new(0, 0, 1000, 1, 1, 100);
	viewport = gtk_viewport_new(GTK_ADJUSTMENT(hadj),
				    GTK_ADJUSTMENT(vadj));
	gtk_container_add(GTK_CONTAINER(viewport), large_frame);
	gtk_container_add(GTK_CONTAINER(main_window), viewport);
	gtk_widget_show_all(main_window);

Instead I find that gtk_widget_show_all() is changing the ->page_size of
both adjustments to some large value (equal to the dimensions of the
frame), rather than keeping ->page_size fixed at 100.  When the main
window appears, it has the large dimensions of the frame (too large to fit
on the screen!), rather than the desired 100-by-100 size.  How can I keep
the window from expanding like this?

Thanks!
 Kendrick



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