[Gtk-sharp-list] Notebook Suggestions
Carlos J. Muentes
carlos at rockwithme.org
Wed Jun 21 10:25:13 EDT 2006
I posted this to the mono mailing list, and someone mentioned I should
post it here instead, so this is _not_ a cross post =^):
I've been working with the Notebook control and there are some quirks
that I wouldn't mind seeing some changes to:
Tab Pages Exposed As A Collection
==================================
- Tab pages should be a collection, with that collection being exposed
as a property of an instance of NoteBook i.e.:
Notebook notebook = new NoteBook();
notebook.TabPages.Add( "This is a new page" );
TabPage tabpage = notebook.TabPages[0];
tabpage.Text = "This is new text on the same tab page";
- The example brings me to my next point: Tab page labels should be
added automatically, and exposed as the "Text" or "Title" property for
a single tab page. In the example above, I am setting the "Text/Title"
property of a new page.
Why expose a collection of tab pages
=====================================
Exposing the child tab pages in a Notebook as a collection would allow
things like:
int i = notebook.TabPages.Count;
TabPage tabpage = notebook.TabPages["page1"];
And would eliminate (IMHO) ugly methods like:
GetNthPage(),
GetTabLabel(),
of which, GetNthPage is misleading because it doesn't even return the
NotebookPage, but returns an instance of Widget, which still cannot be
casted to a NotebookPage!
Can Still Retain Advanced Label Functionality
=============================================
Perhaps for more advanced formatting, you can still expose the tabs
label as a Label property:
TabPage tabpage = notebook.TabPages[0];
tabPage.Label.RederIcon(...);
Reference To Current TabPage, Not Index Of
=========================================
The Page property is also misleading; it should
not return the index of the active page, but rather should return a
reference to the active page:
notebook.Page.Text = "Some new text for this tab(again)";
Summary
========================================
I think with these few changes to the Notebook, it can be a very
powerful tab-based container, and would propel it past the TabControl
control in .NET which (again IMHO) is much easier to work with and more
logically structured.
More information about the Gtk-sharp-list
mailing list