[Gtk-sharp-list] Add and remove controls from NotebookPage
countcb
count.cb at gmx.net
Tue Jul 15 14:23:57 EDT 2008
vbtricks wrote:
>
>
> depending on a state at runtime I need to replace the content of a page in
> a Notebook-Control. How do I accomplish this?
>
>
The mono doc is very usefull. Not only for beginners.
The documentation for the gtk notepage:
http://www.go-mono.com/docs/index.aspx?link=T%3aGtk.Notebook%2f*
This two methods are interesting:
AppendPage(Widget, Widget) : int
RemovePage(int)
Example:
// create the widget you want in the notebook. For example a ScrolledWindow
ScrolledWindow scrolledWindow = new ScrolledWindow();
//add content to the scrolledWindow...
// create the second widget you want in the notebook.
ScrolledWindow scrolledWindow2 = new ScrolledWindow();
//add content to the scrolledWindow2...
// create a notebook
Notebook notebook = new Notebook();
// add the first contents, it will return the number of this page
int page = notebook.AppendPage(scrolledWindow, new Label("Tab with
scrolledWindow"));
// remove the page with the numer we got from the add method
notebook.RemovePage(page);
// add the second content, again we save the page number
int page = notebook.AppendPage(scrolledWindow2, new Label("Tab with
scrolledWindow2"));
You could also have a look at
InsertPage(Widget, Widget, int) : int
if you don't want the page to be at the last position but at a specific
position.
Hope that helps!
--
View this message in context: http://www.nabble.com/Add-and-remove-controls-from-NotebookPage-tp18471172p18471844.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
More information about the Gtk-sharp-list
mailing list