A Tk (or rather Ttk) widget that stacks a bunch of widgets on top of each other in a window, with some tabs at the top to allow users to select between the widgets. A common idiom in Windows's Properties dialogs.
A notebook may be used as a pages manager[L1 ] by using a style to turn off the tabs, like this (by Joe English):
style theme settings default { style layout Plain.TNotebook.Tab null } ttk::notebook $nb -style Plain.TNotebook
tonytraductor I have a question. Using a ttk::notebook, how do I pass the currently selected tab's info to a process, as in, say I have:
proc prnt {} {
set data [.txt.$CURRENTAB get 1.0 {end -1c}] set fileid [open $::filename w] puts -nonewline $fileid $data close $fileid exec cat $::filename | lpr
}
Short of giving the proc the tab's windowname (ie. .txt.tab1) how can this be done? I need it to be a variable that I can pass to the process, whether for save/print, etc. for multiple tabs, without writing a new process and menu bar for each tab. The problem is, I don't know how to set currenttab {somethinghere}, or what it is that determines which tab is currently open. I hope my question is clear.
I assume I should be doing something like
menubar.file add command -label print -command {print currenttab} -accelerator Ctrl-P
proc print {currentab} {rest of process}
I've looked at the notebook.tcl demo in ActiveTcl-8.5, and there is nothing in the code that indicates how to determine which tab is open, at least not so far as I can tell. I looked at krocedit [L2 ], too, but that uses a Bwidget, and, I want to just use the activetcl widget, and, still, even looking at that editor, I was unable to determine how it was done, anyway.
I may have answered my own question.
I believe, from look at the tt::notebook doc [L3 ], that it should be something like set ::currentab tabid current. I'm not completely sure, though.
I'm going to try that and get back.