Re: How to use GtkAdjustment ?



GtkTextView is a scrollable widget. You shouldn't wrap it in a viewport. GtkTextView does not resize itself when you add more text, so the viewport adjustment will always be zero. Instead, use a GtkScrollWindow and the scrollbars will automatically work.


Tomas Mecir wrote:

Hiya, me again ;)

Figured out some of my probs already, one still
remains though... How do I persuade GtkAdjustment to
get correctly hooked to a GtkTextView?
I have that GtkTextView wrapped in a GtkViewport, and
it seems to work correctly - selecting text with mouse
scrolls the widget nicely.
However, the scrollbar doesn't reflect this - it gets
set to all zeroes, or something like that, and stays
like that forever. Can't use it to scroll the
window... How do I fix that?
The relevant portion of my code follows:

// make scrolling work
GtkAdjustment *vadj;
GtkViewport *vport;
GtkRange *scroll_bar;
vport = (GtkViewport *) interface_get_widget( ret,
"output1_c" );
scroll_bar = (GtkRange *) interface_get_widget (ret,
"output1_scrollbar");
vadj = gtk_viewport_get_vadjustment (vport);
gtk_range_set_adjustment (scroll_bar, vadj);

// scrolling should work from now on - but it doesn't

And yes, interface_get_widget returns the correct
pointers (changing it causes Gtk to yell at me due to
incorrect pointer types)

Awaiting your reply... ;)

/ Tomas



                
__________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail _______________________________________________
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]