scrollutil::scrollednotebook
Commandscrollutil::scrollednotebook
– Create and manipulate
scrollednotebook widgetspackage require scrollutil_tile scrollutil::scrollednotebook pathName ?options?
-cursor -style
-height
screenDistance
-padding
paddingSpec
-takefocus
0|1|""|command
-width
screenDistance
pathName see
tabId
scrollutil::scrollednotebook
– Create and manipulate
scrollednotebook widgetspackage require scrollutil_tile scrollutil::scrollednotebook pathName ?options?
scrollutil::scrollednotebook
command
is provided by the Scrollutil_tile package, but not by Scrollutil.scrollutil::scrollednotebook
command creates a
new window named pathName
and of the class
Scrollednotebook
, and makes it into a
scrollednotebook widget. Additional options, described below,
may be specified on the command line or in the option database to configure
aspects of the scrollednotebook widget such as its width, height, and
style. The scrollutil::scrollednotebook
command
returns its pathName
argument. At the time this
command is invoked, there must not exist a window named
pathName
, but pathName
's parent
must exist.see
subcommand. It is made
sure that the currently selected tab is always visible.see
subcommand, the Tcl command associated with a
scrollednotebook widget provides the same subcommands as the one associated
with a ttk::notebook. Note that the API doesn't provide any command
for retrieving the path name of the ttk::notebook widget contained in a
scrollednotebook, because there is no need to access that widget
directly. Moreover, using its subcommands instead of those of the
scrollednotebook widget would result in an unpredictable behavior.-cursor -style
-style
option refers to the style of
the ttk::notebook widget contained in the scrollednotebook. The value
of the -tabposition
option of the style specified by
this Ttk widget option must be one of nw
(the default),
n
(the default for the aqua
theme),
ne
, sw
, s
, or
se
. These values will result in a horizontal tab
layout (the scrollednotebook widget doesn't support vertical tab
layouts).-cursor "" -style TNotebook
Command-Line Name: | -height |
Database Name: | height |
Database Class: | Height |
If present and greater than zero, specifies the desired height for the widget in any of the forms acceptable to
Tk_GetPixels
. Otherwise, the widget's height is set to the requested height of the ttk::notebook contained in it (which in turn depends on the maximum height of all panes and tabs), immediately after the scrollednotebook gets mapped. The default is0
.
Command-Line Name: | -padding |
Database Name: | padding |
Database Class: | Padding |
Specifies the amount of extra space to add around the outside of the ttk::notebook widget contained in the scrollednotebook. See the ttk_notebook manual entry for details. The default is an empty string. Note that if this default value is used then the ttk::notebook widget will be drawn with the external padding specified by the
-padding
option of the widget's style.
Command-Line Name: | -takefocus |
Database Name: | takeFocus |
Database Class: | TakeFocus |
This option determines whether the scrollednotebook widget accepts the focus during keyboard traversal. It is almost identical to the standard option of the same name (see the options manual entry for details). The only difference is that not the scrollednotebook widget itself but the ttk::notebook contained in it will receive the focus during keyboard traversal with the standard keys (
Tab
andShift-Tab
). The default is"ttk::takefocus"
.
Command-Line Name: | -width |
Database Name: | width |
Database Class: | Width |
If present and greater than zero, specifies the desired width for the widget in any of the forms acceptable to
Tk_GetPixels
. Otherwise, the widget's width is set to the requested width of the ttk::notebook contained in it (which in turn depends, among others, on the maximum width of all panes and the total width of the tabs), immediately after the scrollednotebook gets mapped. The default is10c
, which should be overridden with a suitable application-specific value.
scrollutil::scrollednotebook
command creates a
new Tcl command whose name is pathName
. This
command may be used to invoke various operations on the widget. It
has the following general form:
pathName option ?arg arg ...?
option
and the arg
s determine
the exact behavior of the command. The commands possible for
scrollednotebook widgets are the same as those for ttk::notebook widgets
(see the ttk_notebook manual entry for details), except that
scrollednotebook widgets provide the following additional command:pathName see
tabId
tabId
becomes visible in
it. Note that when a tab gets selected, this command is
automatically invoked for it, in order to make that tab visible.
In addition, the currently selected tab is always kept visible, by
invoking this command whenever necessary.<<NotebookTabChanged>>
virtual event.
This holds true for scrollednotebook widgets, too.<<Button3>>
as
<Button-3>
for all windowing systems and
additionally as <Control-Button-1>
for Mac OS
X/11. If this event occurs over a tab of a ttk::notebook or
scrollednotebook whose disabled
widget state flag is
not set, and the Tk version is 8.5a2 or later, then the widget generates
a <<MenuItemsRequested>>
virtual event,
by invoking event generate
with the
-data
option set to a list consisting of the path
name of an empty pop-up menu and the numerical index of the tab in
question. (The support for this option was introduced in Tk
8.5a2.) If the application creates a binding for this virtual
event, the binding script can access the user data as the value of the
%d
field, with the goal to populate the menu with
application-specific entries. Note that the pop-up menu is posted
with a delay of 100 ms, to make sure that it will appear readily
populated by the application.
The following example provides a pop-up menu item for closing the tabs
of a ttk::notebook or scrollednotebook widget $nb
:
bind $nb <<MenuItemsRequested>> { populateMenu %W %d } proc populateMenu {nb data} { foreach {menu tabIdx} $data {} $menu add command -label "Close Tab" -command [list $nb forget $tabIdx] }
See the next section for the description of the virtual event
<<NotebookTabMoved>>
, which is generated
when a ttk::notebook or scrollednotebook tab is moved interactively to a
new position.
aqua
, if the Option
key is down
while the mouse wheel is being rotated then a wheel tick selects the tab
whose numerical index is 10 greater/less than that of the currently
selected one (modulo the number of tabs). The same holds true on the
windowing systems x11
and win32
if
the Tk version is 8.7a4 or later and the mouse wheel is rotated with the
Alt
key down.Right
, Left
, Control-Tab
, and
Control-Shift-Tab
.Escape
key. In both
cases, the mouse cursor is reset to its original value, specified by the
-cursor
configuration option. After releasing
mouse button 1, the source tab is moved to the position previously pointed
to by the arrow (provided that the action was not canceled via
Escape
). If the Tk version is 8.5a2 or later then after
moving the tab to its new position, the widget generates a
<<NotebookTabMoved>>
virtual event, by
invoking event generate
with the
-data
option set to a list consisting of the path name
of the widget contained in the source pane and the numerical index of the
target tab position. (The support for this option was introduced in
Tk 8.5a2.) All the above works also for a ttk::notebook with vertical
tab layout, with the only difference that for the duration of the drag, the
cursor is set to one having the shape of an up/down arrow.disabled
state flag is
set then none of the above actions occur: the tabs are completely
insensitive.