next up previous contents index
Next: III. System Integration Up: II. Widget Commands Previous: 22. Display commands   Contents   Index

23. Slave widgets

A slave widget is specialized form of the sgml widget that displays the content of a single SGML element. The element displayed is part of an SGML document which has been loaded into an sgml widget (the master widget) that owns the slave widget.

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.



Widget commands for creating slave widgets


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.

23.1 Configuring slave widgets

Slave widgets support a subset of the configuration options for sgml widgets.

23.2 Widget commands for slave widgets

Slave widgets support only a few widget commands of their own; alterations to the document must be performed by widget commands for the master widget that owns the slave.

Some commands, however, work differently for slave widgets. They are shown in the table below:



Widget commands for slave widgets


bbox index
  Returns a list describing the screen area occupied by index in the slave widget.
cget option
  Returns the current value of the specified configuration option for the slave widget.
configure option ?value option value ...?
  Configures the slave widget.
dlineinfo index
  Returns information about the display line containing index.
element
  Returns a handle for the element that is shown in the slave widget.
index index
  Adjusts the specified index so that is in the range of text displayed by the slave widget.
master
  Returns the path name of the sgml widget owning the slave widget.



next up previous contents index
Next: III. System Integration Up: II. Widget Commands Previous: 22. Display commands   Contents   Index
TkSGML Reference Manual