Re: Setting scroll bars in TextView



James Becker wrote:

Hello,

I'm attempting to port an application I had working in gtk 1.2.

I had several text widgets all tied to the same vertical scroll bar -
where moving the scroll bar would cause all text widgets to scroll.

I'm having a hard time figuring out how to do this with the TextView
widget, or how it would be recommended.

From looking in the .h file, it appears that I can just reach into the
TextView Structure directly and set the value (hadjustment)- but that
seems a little dangerous. When I first instantiate the textview, the value is null, so I'm assuming it gets set to something later when
data is put in the widget?

It also looks like the parent class (GtkContainer) contains a function
which looks suspiciously like it might work:

gtk_container_set_focus_vadjustment() - but I can't find documentation
of that which I understand.

Any suggestions?

The standard way is to pack GtkTextView into GtkScrolledWindow.
Look at "gtk-demo/textview.c" source, you can also browse it through
'gtk-demo' program - "Text Widget" menu and tab "Source".

Olexiy





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