Scrolling multiple widgets at once




	I'm working on a text editor using Gtk+.

	One feature of my text editor will be line numbers; that is,
showing line numbers next to each line of text.  It will be a togglable
option--toggling it "on" will put another GtkSCText widget directly to the
left of the GtkSCText widget showing the text file's contents (call that
the "linenumbers" widget, and call the widget holding the actual text
file the "textfile" widget).

	To the user, it will appear as a single, white-backgrounded text
area, but the line numbers will not be editable, and will appear in a
different font color.  To turn off line numbers, I will simply hide the
linenumbers widget.

	When I scroll my textfile widget, I want to automatically scroll
the linenumbers widget too.  Again, it should look like a single widget to
the user.

	I'm trying to figure out how to implement this.  I thought I could
put the text widgets into a GtkHbox inside of a GtkViewport inside of a
GtkScrolledWindow.  I tried putting together a prototype with Glade and it
didn't work--the GtkScrolledWindow doesn't know whether it should adjust
its scrollbars for the linenumbers widget or the textfile widget.  I
believe it is looking at the hbox widget, which does not need to be
scrolled at all :).

	How can I tell the GtkViewport to scroll according to the needs of
the textfile widget?  Can I use the hbox to hold the two GtkSCText
widgets, or will that prevent me from being able to have the correct
signal sent to the viewport?

	If anyone can point me to the correct reference information and/or
source code examples, or could describe to me what I need to do, I would
be very grateful.  I have a feeling it has something to do with signals,
but I'm not sure...


Thank You,
Derek Simkowiak
dereks@kd-dev.com




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