There is a variety of "notebook" [widget]s available for [Tcl/Tk]. The term "notebook" can mean many things, but is most often used to describe a widget that has a row of tabs, like a card index. When one of the tabs is clicked, it is "raised", and the page associated with the tab is displayed. This type of widget is very popular in GUI applications (e.g. the tabbed web browser Firefox). Almost every package that provides enhancements to Tk includes a "notebook", "tabbed notebook", or "tabset" widget. There is also a Personal Wiki application called Notebook: see [Notebook App]. ---- * [Tile], which is hopefully coming in [Tk] 8.5, has a notebook. * The [IWidgets] command [tabnotebook] is typical: [http://incrtcl.sourceforge.net/iwidgets/iwidgets/tabnotebook.gif] Docs can be found at http://incrtcl.sourceforge.net/iwidgets/iwidgets/tabnotebook.html and http://purl.org/tcl/home/man/iwidgets3.0/tabnotebook.n.html * The [IWidgets] command "notebook" is slightly different: [http://incrtcl.sourceforge.net/iwidgets/iwidgets/notebook.gif] See docs at http://incrtcl.sourceforge.net/iwidgets/iwidgets/notebook.html and http://purl.org/tcl/home/man/iwidgets3.0/notebook.n.html * [BWidgets] has a NoteBook command - see below for a screenshot. v1.7 has bugs. * [RS] used the BWidget "page manager" to create [a vertical-tab notebook], which conveniently can hold e.g. 26 single-letter tabs. * [BLT] contains a notebook called tabset. Thanks to joheid for the pointer. * [Tix] has a tixNotebook widget: http://tix.sourceforge.net/man/html/TixCmd/tixNoteBook.htm * [Michael McLennan] wrote a plain tcl/tk version for the [BOOK Effective Tcl - Writing Better Programs in Tcl and Tk] - source code available at [http://sourceforge.net/projects/efftcl/]. * [Donal Fellows] has written a notebook [http://www.man.ac.uk/~zzcgudf/tcl/mwidx.html]. Donal "'''strongly''' recommends using the Tile notebook ..." * Pure Tcl/Tk code notebook from [D. Richard Hipp] The source text is about 210 lines (not counting the 40 lines or so of code needed to implement the demo.) The widget will run on Tk4.1 or later. [[But it doesn't avail itself of namespaces?]] http://www.hwaci.com/sw/tk/notebook.tcl * [ClassyTk] has a NoteBook widget [http://rrna.uia.ac.be/classytcl/screenshots/notebook.gif] * [MegaWidget package], by [Jeff Hobbs] contains one. Jeff reports on the [MegaWidget package] page that this package is not yet 100% updated for changes in Tcl/Tk 8.4. * The [Tkcon] application, also by [Jeff Hobbs], uses a simple but effective notebook format for displaying multiple consoles. The notebook is not provided as standalone code: you will need to extract it from the Tkcon source yourself. * [obTcl] for Tcl 7.[[456]] has one * [rnotebook] has one in pure Tcl/Tk with with full resizability [http://membres.lycos.fr/droche/rnotebook/rnotebook.gif] * [another tabbed notebook megawidget] * [Animated Vertical Tabs] A recent article on [comp.lang.tcl] gave a comparison by the author, who was looking for some specific features. Sure wish it was easier to reference Google group articles http://groups.google.com/groups?q=tabbed+notebook+comp.lang.tcl&hl=en&lr=&ie=UTF-8&scoring=d&selm=cj07uf%244p8%241%40wagner.wagner.home&rnum=1 ----- [Rohan Pall] Wow, this page is popular ;) So here's my two cents: I keep examples of each little Tcl/Tk component. This way I don't forget how to do something. Here is my BWidgets NoteBook example. If I remember correctly, I think I learnt this from [Bryan Oakley] in a comp.lang.tcl newsgroup posting. [BWidgets] is an excellent package. The code has been tested with BWidget 1.4.1 on * Windows98 the first release, not second edition * a custom version of Linux (means I don't remember what I did to it ;) package require BWidget set nb [NoteBook .nb -side top] $nb insert 0 foo -text "foo" $nb insert 1 bar -text "bar" set pane [$nb getframe foo] label $pane.hello -text "hello world" pack $pane.hello -fill both -expand 1 set pane [$nb getframe bar] button $pane.fizz -text testing pack $pane.fizz -fill both -expand true pack $nb -fill both -expand 1 $nb raise foo ---- [Michael Jacobson] Oct 8, 2002 ~ I was trying to get the [BWidgets] NoteBook to work with a popup menu displayed on the active tab when you right clicked on the tab. I thought I would document how to do it below. [http://mywebpages.comcast.net/jakeforce/bwidget_notebook.jpg] package require BWidget ## create a notebook with 2 text panes NoteBook .n .n insert 0 text1 -text Text1 .n insert 1 text2 -text Text2 foreach panel {text1 text2} { set pane [.n getframe $panel] text $pane.t pack $pane.t -fill both -expand 1 } pack .n .n raise text1 ## make a popup menu for the tabs (just add commands) menu .popup -tearoff 0 -activeborderwidth 0 .popup add command -label "mess 1" -command [list puts "in mess 1"] .popup add command -label "mess 2" -command [list puts "in mess 2"] .popup add separator .popup add command -label "mess n" -command [list puts "in mess n"] ## bind right mouse button to the popup menus .n bindtabs [list popup .popup %X %Y] proc popup {win X Y pane} { # check to see if current click is on the top tab if {[string equal [.n raise] $pane]} { tk_popup $win $X $Y } } ---- The Tile notebook provides a '''<>''' [virtual event], to be followed typically by '''[[pathname index current]]''' to determine the specific tab selected. ---- Do any notebook implementations allow interaction with sub-elements of the tabs? For example the "Eclipse" IDE organizes its editing tabs with a grey X which turns red when the mouse moves over it, and on which you can click to kill that tab. Alternatively, Firefox has a red X on the far right hand side of the tab area, but separate from the tabs themselves. You can click on that to close the frontmost tab. It appears as if the Tile notebook doesn't support either of these approaches. It also does not handle what happens when there is not enough room for all the tabs Firefox allows multiple rows or scrolling buttons (BLT tab widget allows dragging of the tabs with the middle button). Would it not be possible to change the style for individual tabs rather than for the notebook as a whole ? ---- See also [A tiny notebook] ---- [Category Example] | [Category Widget] | [Category Command]