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
See notebook for discussion of similar widgets.
skm 2005.07.01
Is there a way to update the style of the tabnotebook Iwdiget when the user changes the color scheme in winXP or win2K?
consider this code snippet
package require Iwidgets option add *textBackground white option add *Scale.width 8 option add *Tabnotebook.backdrop SystemDisabledText option add *Tabnotebook.background SystemButtonFace option add *Optionmenu.tabbackground SystemButtonFace option add *Optionmenu.background SystemButtonFace option add *Entryfield.background SystemButtonFace option add *Label.background SystemButtonFace set tabw [iwidgets::tabnotebook \ .tabw\ -tabpos n \ -margin 5 \ -raiseselect true \ -bevelamount 1 \ -tabborders false \ -angle 0 \ -gap 3 \ -font {{tahoma bold} 8} \ -padx 5 \ -pady 5 \ ] $tabw configure -tabbackground SystemButtonFace pack $tabw -expand true -fill both set nw [$tabw add -label Notes] set fw [$tabw add -label Foo]
Consider the case where I run it while windows is using the Windows Classic color scheme. It gets rendered with those colors. After it has been created, if I change the Windows display properties, the widget colors are not updated. Is there an event I can bind to to know when the windows display properties have changed?
Here are screen shots, if anyone is interested. I won't do them inline because I do not want to inconvenience anyone who happens to be loading the page with a slow connection.
loading tabnotebook in windows classics colors: http://starkravingsane.org/tcl/tabnotebook.png
changing colors: http://starkravingsane.org/tcl/rosetabnotebook.png
Btw, where can I get a list of all of the named system colors?
MG On Windows XP, I found the list of colors in the registry, by searching for "buttonface" with regedit, and found some in
HKEY_CURRENT_USER\Control Panel\Colors
Only some of the colors appear in Tcl, though - I'm not sure why - and all have the prefix "System", added on to the names given in the registry. So, here's some code which returns a list of them, and displays them graphically (badly - you can't read the text on ones which are dark, for instance - but it's better than nothing;):
proc cols {} { package require registry foreach x [registry values {HKEY_CURRENT_USER\Control Panel\Colors}] { if { ![catch {winfo rgb . "System$x"}] } { lappend goodCol "System$x" } } pack [frame .l] [frame .r] -side left foreach {x y} $goodCol { pack [label .l.w$x -background $x -text $x] catch {pack [label .r.w$y -background $y -text $y]} } return $goodCol }
For me (Win XP Home SP2), this gives me
SystemActiveBorder SystemAppWorkSpace SystemBackground SystemButtonFace SystemButtonShadow SystemButtonText SystemGrayText SystemInactiveBorder SystemInfoText SystemMenu SystemMenuText SystemScrollbar SystemWindow SystemWindowFrame SystemWindowText
LV Recently someone emailed me asking how they could determine which tab had been selected. I pointed them to the reference page (see above) where the following code is a demo of the process:
$ tclsh % package require Iwidgets 4.0.2 % iwidgets::tabnotebook .t .t % .t add -label "0" .t.canvas.notebook.cs.page1.cs % .t add -label "1" .t.canvas.notebook.cs.page2.cs % .t add -label "2" .t.canvas.notebook.cs.page3.cs % pack .t % # now I click on the tab labeled 1 % .t index select 1
HD Note that .t index returns the position of the tab, which happens to be the same as the name in the above example. Here's a more realistic example:
.t add -label Fred .t add -label Joe .t add -label Bob # Click on "Bob" .t pagecget select -label
On older versions you may have to do:
lindex [.t pageconfigure select -label] end
One problem I've noticed is that as you add tabs and fill up the visible space, latter tabs drop off at the right and you can't see them even if you have added a scrollbar. The only way to see them is to enlarge the application window. Tabs seem to be anchored at the left. Has this been fixed in a later version?
C. Arnold 2008.06.13 You can scroll the tabset using the middle mouse button (don't know when this feature was added). I haven't figured out how to make a scrollbar do this yet though. If you have an older 2-button mouse you can emulate the middle button by simultaneously pressing both buttons.
Category Command, a part of incr Widgets Category GUI