[Gtk-sharp-list] Notebook Widget
Chris Howie
cdhowie at gmail.com
Sun Feb 24 06:08:50 EST 2008
On Sat, Feb 23, 2008 at 7:36 PM, Darwin Reynoso <monouser at gmail.com> wrote:
> Hi,
> how do i add a close button widget to a notebook page kind of like
> monodevelop tabs.
>
> here is my code
>
> //create a page with a textview widget
> protected virtual void onclicked (object sender, System.EventArgs e)
> {
> //i need a textview so i can show a hex file
> textview = new TextView();
>
> string label = "Hex output";
>
> notebook1.AppendPage (textview , new Label (label));
>
> notebook1.ShowAll();
> }
> i need to be able to close the page
>
> thanks
Replace your AppendPage call with something like:
------8<------
HBox hbox = new HBox();
hbox.PackStart(new Label(label));
Button close = new Button("X"); // Set this up with an image or whatever.
close.Relief = ReliefStyle.None;
close.FocusOnClick = false;
close.Clicked += delegate {
hbox.Destroy();
textview.Destroy();
};
hbox.PackStart(close);
hbox.ShowAll();
notebook1.AppendPage(textview, hbox);
------8<------
--
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers
More information about the Gtk-sharp-list
mailing list