Re: [gtk-list] Gtk--: adding scrollbars to text widget
- From: Joe Pfeiffer <pfeiffer cs nmsu edu>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Gtk--: adding scrollbars to text widget
- Date: Sun, 5 Jul 1998 17:38:04 -0600
tfishwick@coastnet.com writes:
I'm having one heck of a time adding a vertical scrollbar to a Gtk_Text
object. I've figured out that Gtk_Text has a 'vadj' and 'hadj' of type
Gtk_Adjustment. And so I need to give Gtk_VScrollBar the 'vadj' to get
it to work. But I couldn't figure out how to do that :-(. I've tried
useing gtkobj() to get it, and some other stuff, but....nope.
I came across this problem two days ago. Near as I can tell, if you
try to create a Text object and then extract its vadj component, you
will end up with an unwrapped adjustment, instead of one that's
wrapped up in a class. So, you have to explicitly create the
adjustment, and use it in creating both the text area and the
scrollbar. The code I wound up with was:
textBox = new Gtk_HBox();
windowFrame->add(textBox);
vadj = new Gtk_Adjustment(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
textArea = new Gtk_Text(NULL, vadj);
textArea->set_usize(600, 350);
textBox->add(textArea);
textScroll = new Gtk_VScrollbar(vadj);
textBox->add(textScroll);
--
Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Department of Computer Science FAX -- (505) 646-1002
New Mexico State University http://www.cs.nmsu.edu/~pfeiffer
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]