[Gtk-sharp-list] TextView wonkyness!

Jeroen Zwartepoorte jeroen.zwartepoorte at gmail.com
Thu Jul 21 05:22:30 EDT 2005


You need to put the TextView in a ScrolledWindow. Why would you want
to put it into a Layout?

Jeroen

On 7/21/05, ted leslie <tleslie at tcn.net> wrote:
> 
> I have a TextView
> that renders text just fine in a Window, ScrollWindow, Vbox, etc,
> but for some reason when I but the
> TextView into a Layout, no matter what I do
> the text has a fix width of about 100 pixels, and grows just fine (downwards) as
> amount of text increases.
> But by placing the TextView into a Layout (as apposed to anything else),
> its width is some how restricted even though the window, Layout are all
> big enough to hold 5 times the width of the text, it still
> sticks at 100 pixels and doesnt grow/fill horizontally as it should.
> 
> Any ideas?
> 
> changing any of the size values, and scroll adjust values ... doesn't alter the text width, it just stays the same.
> 
> here is the relavent code, its trival, so i am not sure if there may be a bug in gtk-sharp?
> 
> 
> 
> 
>           TextView view = new TextView();
>           TextView view2 = new TextView();
>           TextBuffer buffer;
>           TextBuffer buffer2;
> 
>           view.SetBorderWindowSize(TextWindowType.Top, 8);
>           view.SetBorderWindowSize(TextWindowType.Bottom, 8);
>           view.SetBorderWindowSize(TextWindowType.Right, 8);
>           view.SetBorderWindowSize(TextWindowType.Left, 8);
> 
>           view.Editable=false;
>           view.WrapMode=WrapMode.Word;
>           view2.Editable=false;
>           view2.WrapMode=WrapMode.Word;
> 
>           buffer = view.Buffer;
>           buffer2 = view2.Buffer;
>           buffer.Text =
>             "The Rain in Spain stays mainly on the Plain, and This is a test of the wrap mode Does it happen on "+
>             "The Rain in Spain stays mainly on the Plain, and This is a test of the wrap mode Does it happen on "+
>             "The Rain in Spain stays mainly on the Plain, and This is a test of the wrap mode Does it happen on "+
>             " or on OTEHR big words and smalersmallersmallersmaler words;";
>           buffer2.Text =
>             "The Rain in Spain stays mainly on the Plain, and This is a test of the wrap mode Does it happen on "+
>             " or on OTEHR big words and smalersmallersmallersmaler wordsZ;";
> 
> 
>           Adjustment ad1= new  Adjustment(200,0,200,1,1,200);
>           Adjustment ad2= new  Adjustment(200,0,200,1,1,200);
>           Layout lo2 = new Layout( ad1, ad2);
> 
>           lo2.SetSize(400,1000);
>           lo2.Put(view, 0,0);  // put my text into layout
>           lo2.Put(view2,0,480);
> 
> 
> 
>       Window window = new Window ("helloworld");
>       window.DeleteEvent += delete_event;
>       window.SetDefaultSize(400,400);
>       window.Add(lo2);
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>


More information about the Gtk-sharp-list mailing list