[Gtk-sharp-list] ScrolledWindow and TextView
Jestin Stoffel
jestin.stoffel at gmail.com
Sat Jun 28 17:03:43 EDT 2008
On Sat, 2008-06-28 at 15:32 -0400, Michael Hutchinson wrote:
> On Fri, Jun 27, 2008 at 12:14 AM, Jestin Stoffel
> <jestin.stoffel at gmail.com> wrote:
> > I am using a TextView inside a ScrolledWindow in an application designed
> > using Monodevelop 1.0 with the Stetic designer. When I type text into
> > the TextView, it works but does not scroll with the text. A little
> > research into this helped me find a solution where I add the TextView to
> > the ScrolledWindow first, and then add the ScrolledWindow to its
> > container. Since I am using the Stetic designer, and not adding my GUI
> > elements in code, is there any way to get the desired result, or do
> > TextViews simply not work with ScrolledWindows in the designer?
>
> They certainly *should* work; this sounds like a strange bug, and I
> dont know if it's in GTK, GTK# or Stetic...
>
> In fact, the following code generated by stetic seems to indicate that
> it does things in the "correct" order:
>
> this.scrolledwindow4.Add(this.extraCompilerTextView);
> this.table5.Add(this.scrolledwindow4);
>
> Could you take a look at the stetic-generated code in the gtk-gui
> directory to check whether it's ordering things differently for you?
>
Here is my generated code:
// Container child GtkAlignment.Gtk.Container+ContainerChild
this.scrolledwindow1 = new Gtk.ScrolledWindow();
this.scrolledwindow1.CanFocus = true;
this.scrolledwindow1.Name = "scrolledwindow1";
this.scrolledwindow1.ShadowType = ((Gtk.ShadowType)(1));
// Container child scrolledwindow1.Gtk.Container+ContainerChild
Gtk.Viewport w65 = new Gtk.Viewport();
w65.ShadowType = ((Gtk.ShadowType)(0));
// Container child GtkViewport3.Gtk.Container+ContainerChild
this.textview1 = new Gtk.TextView();
this.textview1.CanFocus = true;
this.textview1.Name = "textview1";
w65.Add(this.textview1);
this.scrolledwindow1.Add(w65);
this.GtkAlignment.Add(this.scrolledwindow1);
this.frame2.Add(this.GtkAlignment);
Apparently there is a Gtk.Viewport that gets created, and that is what
the ScrolledWindow contains. Checking the gui.stetic file showed that
Stetic is adding in the Viewport. It seems that Stetic automatically
assumes add_with_viewport instead of a normal add, and creates a
Viewport in gui.stetic. Since a TextView is something that handle's
it's own scrolling, this Viewport is just mucking things up. Thanks for
pointing me in the right direction, but I still don't know how to use
the Stetic designer to accomplish a TextView inside a ScrolledWindow. I
looked for some sort of configuration option, but couldn't find one. I
can probably just work around the issue by creating a custom
"scrolledtextview" widget where I do my add()'s in code (without
Stetic), but it is starting to look like there's a bug somewhere.
Thanks for the help.
--Jestin
More information about the Gtk-sharp-list
mailing list