JayBy 2016-05-30
xtk::notebook extends the ttk::notebook with buttons for scrolling, add and remove tabs.
xtk::notebook creates two new styles based on the default TNotebook style. TNotebookX will be used with the scroll buttons and TNotebookX+ for add and scroll buttons. This means, you can use the default TNotebook style only before creating the notebook.
package require xtk::notebook ?0.1?
COMMANDS
NOTEBOOK OPTIONS
Default options from ttk::notebook and new added options:
TAB OPTIONS
Options for the builtin addTab command:
MG just tried this out on Windows 7, out of curiosity, and ran into a few problems:
can't read "_W": no such variable can't read "_W": no such variable while executing "::xtk::notebook::addTab $_W" invoked from within ".nb.addButton invoke " invoked from within ".nb.addButton instate !disabled { .nb.addButton invoke } " invoked from within ".nb.addButton instate pressed { .nb.addButton state !pressed; .nb.addButton instate !disabled { .nb.addButton invoke } } " (command bound to event)
JayBy 2016-05-31
I've updated the download package concerning the addTab error.
I don't use the notebook in my scripts for the moment, it's for later use, but I prefer the '-addcommand' option, with the help of the builtin command to get the frame inside the new tab:
proc crTab {Nb} { set p [::xtk::notebook::addTab $Nb -index c] # Now you can use your stuff with $p # $p is the same you get with [$Nb select] ... }
(This should work also with the 'old' version.)
You have to use the builtin command inside the proc, because it tries to adjust the tabs. Then the scroll buttons should work.
The adjustment of the tabs is a problem, because the ttk::notebook shrinks the tabs automatically, if they reach the end of the line. For the moment, it should be a better solution to fix the width of the tabs with a style like "ttk::style configure TNotebook.Tab -width 10". But, I know, this will cut long titles.
I've planned to insert tooltips for the tab titles and I will rewrite the parts for the adjustment, but this will need some time.