Re: Scrolledwindow & canvas scrolling problems

Lukas Knutsson wrote:
> I am trying to scroll the canvas inside a scrolledwindow object. Here my
> hacked demo app, based on the gtk tutorial program, displays my problem.
> Scrolling the canvas actually seems to move the canvas item in it.
> Obviously there is a problem with my code, but none of the examples
> involve the canvas.

I do like this:

	sw = gtk_scrolled_window_new (NULL, NULL);
	gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET (canvas));
	vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (canvas));
	hadj = gtk_layout_get_hadjustment (GTK_LAYOUT (canvas));
	gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (sw), vadj);
	gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (sw), hadj);

Hope it helps

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