[Gtk-sharp-list] Insert button to textview

Matt Guo matt at mattguo.com
Tue Jul 28 02:12:23 EDT 2009


Hey, Darwin,

the following are sample code to insert a button to the current cursor position:

                        TextView textView = ...;
                         ...
			TextBuffer buffer = textView.Buffer;
			var iter = buffer.GetIterAtOffset(buffer.CursorPosition);
			var anchor = buffer.CreateChildAnchor(ref iter);
			Button btn = new Button();
			btn.Label = "Hello";
			textView.AddChildAtAnchor(btn, anchor);
			btn.ShowAll();

You may also want to install/run the gtk-demo, and dig the source code
of "Text Widges|Multiple Views" demo.

On Sun, Jul 19, 2009 at 7:26 AM, Darwin Reynoso<monouser at gmail.com> wrote:
> Hi,
> how do i insert a widget like a button or combobox to a textview.
>
> thank you
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>



-- 
B.R.
GUO Rui (Matt)


More information about the Gtk-sharp-list mailing list