[Gtk-sharp-list] Notebook Widget

Darwin Reynoso monouser at gmail.com
Sun Feb 24 08:49:15 EST 2008


Chris never mind i got it working anyway thanks so much for your help.

On Sun, Feb 24, 2008 at 7:36 AM, Darwin Reynoso <monouser at gmail.com> wrote:
> Hi Chris, can you please tell me what i'm doing wrong i'm using monodevelop RC1
>
>
>  //create a page with a textview widget
>         protected virtual void onclicked (object sender, System.EventArgs e)
>         {
>                 string label = "Hex File";
>
>
>                 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);
>                 notebook1.ShowAll();
>
>
>
>         }
>
>  On Sun, Feb 24, 2008 at 6:08 AM, Chris Howie <cdhowie at gmail.com> wrote:
>  >
>  > 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