Insert button to textview

View: New views
2 Messages — Rating Filter:   Alert me  

Insert button to textview

by monouser :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
how do i insert a widget like a button or combobox to a textview.

thank you
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: Insert button to textview

by Matt Guo :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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@...
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>



--
B.R.
GUO Rui (Matt)
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list