[Gtk-sharp-list] New in the forum ...

Federico Mena Quintero federico@ximian.com
Mon, 06 Dec 2004 20:02:15 -0600


On Fri, 2004-12-03 at 01:12 +0000, Paulo Aboim Pinto wrote:

> I'm a programmer of .NET and now Mono too. I'm trying to develop some 
> examples in Mono with GTK#
> 
> I want to obtain a select text from a TextView. Until now i can know if 
> any text is selected but i cant obtain it.

Gtk.TextBuffer buf = my_text_view.Buffer;
GtkTextIter start, end;

if (buf.GetSelectionBounds (buf, out start, out end)) {
        string text;

        text = buf.GetText (start, end, false);
        Console.WriteLine ("Selected text: {0}", text);
} else
        Console.WriteLine ("No selected text");

  Federico