[ABU] 1-oct-2023 - znotebook 1.0 ====== === ZNOTEBOOK ================================================================ znotebook is an extension of the standard [ttk::notebook] widget. -- variation inspired by the scrollutil::scrollednotebook (by Csaba Nemethi) ============================================================================== All ttk::notebook's options and commands are supported. znotebook comes with 5 new options for controlling its new interactive features. All znotebooks' tabs can be interactively rearranged (Click and drag). If a tab is dragged outside the tabs-area, it becomes a "detached tab", i.e. a new toplevel window. Detached.tabs have a small special button (rejoin-button) to bring it back to the notebook. All znotebook's tabs have a small [x] button for destroying the tab. New options (-preclosetab and -postclosetab) can be used to control which tabs can be removed and for doing some cleanup after the tab has been (interactively) removed. Znotebook provides a default [+] button (wholly programmable) for adding new tabs. Znotebook tabs can be renamed interactively. ====== [Image_notebook1%|% width=930height=550] [Image_notebookAnim1] A full app: see [Highlighter 2.x] : [znotebook] + [pdfviewer] [Image_notebook2] <> Short Reference Guide ====== All ttk::notebook's options and commands are supported. znotebook comes with 4 new options for controlling its new interactive features. All notebook tabs can be interactively rearranged (Click and drag). If a tab is dragged outside the tabs-area, it becomes a "detached tab", i.e. a new toplevel window. Detached-tabs have a small special button (rejoin-button) to bring it back to the notebook. All notebook tabs have a small [x] button for destroying the tab. New options (-preclosetab and -postclosetab) can be used to control which tabs can be removed and for doing some cleanup after the tab has been (interactively) removed. Znotebook tabs can be renamed interactively. Znotebook provides a default [+] button (wholly programmable) for adding new tabs. ---- NEW OPTIONS: -showaddbutton _bool_ if _bool_ is true, then a small [+] button is placed to the left of the first tab. -addcommand _cmdPrefix_ Specifies the prefix of a Tcl command to invoke whenever the special [+] button is pressed. The actual command consists of this option concatenated with the pathname of the znotebook widget. It is responsibility of this command to create a (composite) widget (typically a frame with some sub-widgets), and then attach this new widget by issuing a standard "add" or "insert" command Example: znotebook .nb1 .nb1 configure -showaddbutton true -addcommad AddTab proc AddTab {nb} { set f [frame $nb.tab_[newID]] ;# [newID] should generate a new unique id ... .... .. populate $f with some sub-widget .... .... # ... if everything is OK .... $nb add $f -text "some text.." } -preclosetabcommand _cmdPrefix_ Specifies the prefix of a Tcl command to be invoked when a tabs' [x] button is pressed. The actual command consists of this option concatenated with the pathname of the znotebook widget and the pathname of the tab's related window. If the return value of this command is true then the tab is removed (i.e. the "forget" subcommand is automatically executed), and then the script related with the "-postclosetabcommand" option is executed. -postclosetabcommand _prefixCmd_ Specifies the prefix of a Tcl command to be invoked after a tab has been *interactively* removed. The actual command consists of this option concatenated with the pathname of the (removed) tab's related widgets. Note that when a tab is removed, its contents (the related widgets) are simply unmanaged; it is user's responsibility to destroy/release all the unmanaged resources. Example: znotebook .nb2 .nb2 configure \ -preclosetabcommand AskConfirm \ -postclosetabcommand TabCleanupTab proc AskConfirm {nb w} { set x [tk_messageBox -type yesnocancel -message "Are you sure you want to close this tab \"$tabName\" ?"] return [expr {$x eq "yes" ? true : false}] } proc TabCleanup {w} { ... release all the related resources ... destroy $w } -renametab _bool_ If _bool_ is "true", then tabs can be interactively renamed with a double-click on the tab. Editing is closed when the user presses or clicks outside the editing window. ====== <> ***Download*** https://sourceforge.net/projects/irrational-numbers/files/znotebook/znotebook-1.0.zip/download%|%Download znotebook 1.0%|% ----