Question

(C language, GTK library)

On my form, I have a GtkDrawingArea widget on which I draw GdkPixbufs (loaded from files) with Cairo. What I'd like to accomplish is to be able to scroll the drawing area with scrollbars while window size remains fixed (the image drawn is larger than the window). How can I do that? Putting GtkDrawingArea in ScrolledWindow container didn't work (or maybe I have done something wrong - I'm new to GTK).

The simpler solution the better. Cheers!

Était-ce utile?

La solution

Some widgets don't have scrolling capability. GtkDrawingArea is one of them. You can adapt these widgets by putting them first inside a GtkViewport then into a GtkScrolledWindow In versions before GTK 3.8 gtk_scrolled_window_add_with_viewport is a convenience method to do this.

In later versions it is done automatically by gtk_container_add.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top