A slave widget for a specific element is created as a child window of the master widget that contains this element. Only one slave widget can be created for each element in the master widget.
| slave pathName handle ?specs? | |
| Creates a slave widget pathName for the element identified by handle and configures it with specs. | |
If a slave widget is created for an SGML element in a master widget, the content of the SGML element is displayed twice: once by the sgml widget thats contains the SGML document, and again by the slave widget that shows only the content of the element in question (without the element's start and end tags).
If the content of the element in the master widget is changed, all changes are reflected by the slave widget that keeps an up-to-date display of the element's content. If the element that is displayed by a slave widget is deleted from the document in the master widget, the window of the slave widget is destroyed by the master widget.
Slave widgets are dynamically resized to accomodate all of the content of the element that they display. If the content of the element does not fit within the slave widget's window, the window of the slave widget is enlarged vertically until all of the element content can be displayed.
The widget command for creating slave widgets has the following general form:
pathname slave childPath handle ?options?
pathname is the pathname of the sgml widget containing the parent element and the childPath argument is the path name for the new slave window. The handle is the handle for the parent element. Additional configuration options can be specified and will be used to configure the slave widget.
Slave widgets must be created as child windows of the sgml widget that contains the parent element.
Slave widgets can be created for individual elements in an sgml widget. If a slave widget has been created for an element, the content of this element is displayed in the window of the slave widget and any alterations made to this element will be shown in the slave widget.
Slave widgets support a subset of the configuration options for sgml widgets.
Specifies the normal background color to use when displaying the widget.
Specifies a non-negative value indicating the width
of the 3-D border to draw around the outside of the widget (if such a
border is being drawn; the -relief option typically determines
this). The value may also be used when drawing 3-D effects in the
interior of the widget. The value specifies a screen distance as
described in section
.
Specifies the mouse cursor to be used for the widget. Please refer to the Tk documention for details on specifying mouse cursors.
Specifies the font to use when drawing text inside the widget.
This option is supported for compatibility with other Tk widgets and
applications only. Using the more flexible options -family,
-size, -bold, and -italic (see below) is
preferred since these options provide smoother interaction with the
text property inheritance scheme described in section
.
Specifies the normal foreground color to use when displaying the widget.
Specifies the color to display in the traversal highlight region when the widget does not have the input focus.
Specifies the color to use for the traversal highlight rectangle that is drawn around the widget when it has the input focus.
Specifies a non-negative value indicating the width of the highlight
rectangle to draw around the outside of the widget when it has the
input focus. The value specifies a screen distance as described in
section
.
If the value is zero, no focus highlight is drawn around the widget.
Specifies the color to use as background in the area covered by the insertion cursor. This color will normally override either the normal background for the widget (or the selection background if the insertion cursor happens to fall in the selection).
Specifies a non-negative value indicating the width of the 3-D border to draw around the insertion cursor.
Specifies a value indicating the total width of the insertion cursor.
The value specifies a screen distance as described in
section
.
If a border has been specified for the insertion cursor (using the -insertBorderWidth option), the border will be drawn inside the width specified by the -insertWidth option.
Specifies a non-negative screen distance indicating how much extra space to request for the widget in the X-direction.
When computing how large a window it needs, the widget will add this amount to the width it would normally need (as determined by the width of the things displayed in the widget); if the geometry manager can satisfy this request, the widget will end up with extra internal space to the left and/or right of what it displays inside.
Specifies a non-negative value indicating how much extra space to request for the widget in the Y-direction. When computing how large a window it needs, the widget will add this amount to the height it would normally need (as determined by the height of the things displayed in the widget); if the geometry manager can satisfy this request, the widget will end up with extra internal space above and/or below what it displays inside.
Specifies the 3-D effect desired for the widget. Acceptable values are raised, sunken, flat, ridge, solid , and groove.
The value indicates how the interior of the widget should appear relative to its exterior; for example, raised means the interior of the widget should appear to protrude from the screen, relative to the exterior of the widget.
Specifies the background color to use when displaying selected items.
Specifies a non-negative value indicating the width of the 3-D border to draw around selected items.
Specifies the foreground color to use when displaying selected items.
If the -setGrid option is set to true then the widget will communicate with the window manager so that when the user interactively resizes the top-level window that contains the widget, the dimensions of the window will be displayed to the user in grid units and the window size will be constrained to integral numbers of grid units.
Determines whether the window accepts the focus during keyboard traversal (e.g., Tab and Shift-Tab). Before setting the focus to a window, the traversal scripts consult the value of the -takeFocus option. A value of 0 means that the window should be skipped entirely during keyboard traversal. 1 means that the window should receive the input focus as long as it is viewable (it and all of its ancestors are mapped). An empty value for the option means that the traversal scripts make the decision about whether or not to focus on the window: the current algorithm is to skip the window if it is disabled, if it has no key bindings, or if it is not viewable. If the value has any other form, then the traversal scripts take the value, append the name of the window to it (with a separator space), and evaluate the resulting string as a Tcl script. The script must return 0, 1, or an empty string: a 0 or 1 value specifies whether the window will receive the input focus, and an empty string results in the default decision described above.
Note: this interpretation of the option is defined entirely by the Tcl scripts that implement traversal: the widget implementation ignores the option entirely, so you can change its meaning if you redefine the keyboard traversal scripts.
Specifies the initial desired height for the window, in units of characters in the font given by the -font option. Must be at least one.
Requests additional space above each text line in the widget, using any of the standard forms for screen distances. If a line wraps, this option only applies to the first line on the display. This option may be overriden with -spacing1 options in tags and elements.
For lines that wrap (so that they cover more than one line on the display) this option specifies additional space to provide between the display lines that represent a single line of text. The value may have any of the standard forms for screen distances. This option may be overriden with -spacing2 options in tags and elements.
Requests additional space below each text line in the widget, using any of the standard forms for screen distances. If a line wraps, this option only applies to the last line on the display. This option may be overriden with -spacing3 options in tags and elements.
Specifies a set of tab stops for the window. The option's value consists of a list of screen distances giving the positions of the tab stops. Each position may optionally be followed in the next list element by one of the keywords left , right , center , or numeric , which specifies how to justify text relative to the tab stop.
The default is left ; it causes the text following the tab character to be positioned with its left edge at the tab position. Right means that the right edge of the text following the tab character is positioned at the tab position, and center means that the text is centered at the tab position. Numeric means that the decimal point in the text is positioned at the tab position; if there is no decimal point then the least significant digit of the number is positioned just to the left of the tab position; if there is no number in the text then the text is right-justified at the tab position.
For example, -tabs {2c left 4c 6c center} creates three tab stops at two-centimeter intervals; the first two use left justification and the third uses center justification. If the list of tab stops does not have enough elements to cover all of the tabs in a text line, then Tk extrapolates new tab stops using the spacing and alignment from the last tab stop in the list.
The value of the -tabs option may be overridden by -tabs options in tags and elements. If no -tabs option is specified, or if it is specified as an empty list, then Tk uses default tabs spaced every eight (average size) characters.
Specifies background color to use when drawing sgml tags.
Specifies the width of the border to draw around sgml tags. If set to 0, no border will be drawn around the tags.
Specifies the font to use for drawing the contents of sgml tags.
Specifies the color to use for drawing the foreground text of a tag. This color is used when drawing all text in an sgml tag with the exception of invalid elements.
Specifies the foreground color to use for drawing the foreground text of an sgml tag for an incomplete or invalid element.
Specifies a non-negative value indicating how much additional internal
space to use for an sgml tag in the X-direction. The value specifies a
screen distance as described in section
.
When computing how large the tag will be, the widget will add this amount to the width the tag would normally need (as determined by the width of the things displayed in the tag). The sgml tag will end up with extra internal space to the left and right of what it displays inside.
Specifies a non-negative value indicating how much additional internal space to use for an sgml tag in the Y-direction.
When computing how large the tag will be, the widget will add this amount to the height the tag would normally need (as determined by the height of the things displayed in the tag). The sgml tag will end up with extra internal space to the top and bottom of what it displays inside.
Specifies a non-negative value indicating how much additional external space to request for an sgml tag in the X-direction. The extra space is added to the left and right of each sgml tag.
Specifies a non-negative value indicating how much additional external space to request for an sgml tag in the Y-direction. The extra space is added above the top and below the bottom of each sgml tag.
Specifies whether attributes should be shown inside sgml tags. The value may have any of the forms accepted by Tcl_GetBoolean, such as true, false, 0, 1, yes, or no.
Specifies whether or not to draw an underline underneath characters.
The value may have any of the forms accepted for boolean values as
described in section
.
Specifies whether or not to draw an horizontal line through the middle
of characters. The value may have any of the forms described in
section
.
Specifies whether characters are to be italicised or not.
Specifies whether characters are to be printed in bold font or not.
Specifies the default font size of the widget. If the size argument is a positive number, it is interpreted as a size in points. If size is a negative number, its absolute value is interpreted as a size in pixels. If a font cannot be displayed at the specified size, a nearby size will be chosen. If size is unspecified or zero, a platform-dependent default size will be chosen.
Specifies the default font family of the widget. Tk guarantees to support the font families named Courier (a monospaced ``typewriter'' font), Times (a serifed ``newspaper'' font), and Helvetica (a sans-serif ``European'' font). The most closely matching native font family will automatically be substituted when one of the above font families is used. The name may also be the name of a native, platform-specific font family; in that case it will work as desired on one platform but may not display correctly on other platforms. If the family is unspecified or unrecognized, a platform-specific default font will be chosen.
Specifies the desired width for the window in units of characters in the font given by the -font option. If the font doesn't have a uniform width then the width of the character 0 is used in translating from character units to screen units.
The special value 0 can be used to configure a slave widget for dynamically adjusting its width so that the widget will request a new size equal to the width of the longest word in the window. A value of 0 will only be if the wrap option is set to word.
Specifies how to handle lines in the text that are too long to be displayed in a single line of the window. The value must be none or char or word.
A wrap mode of none means that each line of text appears as exactly one line on the screen; extra characters that don't fit on the screen are not displayed.
In the other modes each line of text will be broken up into several screen lines if necessary to keep all the characters visible. In char mode a screen line break may occur after any character; in word mode a line break will only be made at word boundaries.
Some commands, however, work differently for slave widgets. They are shown in the table below: