Version 5 of tabnotebook

Updated 2005-09-10 16:20:26 by LES

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

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

Category Command, a part of incr Widgets Category GUI