Tk Library Source Code

Check-in [4ac704f65d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tsw: Minor cleanup in the reference manual.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4ac704f65d72b42c1cd893533c2d36e7cf30d704db05c2a4cb979e627d06c670
User & Date: csaba 2025-03-17 14:00:13.906
Context
2025-03-18
16:25
Tsw: Guarded against the deletion of namespace qualifiers for the value of the "-variable" option. check-in: f94f2c324b user: csaba tags: trunk
2025-03-17
14:00
Tsw: Minor cleanup in the reference manual. check-in: 4ac704f65d user: csaba tags: trunk
13:54
Tsw: Added the "-offvalue", "-onvalue", and "-variable" toggleswitch widget options. check-in: 6f53fcb652 user: csaba tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to modules/tsw/doc/toggleswitch.html.
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
          <td>Database Class:</td>
          <td><code><b>&nbsp;OffValue</b></code></td>
        </tr>
      </table>

      <blockquote>
        <p>The value to store in the associated <a href=
	"#variable">variable</a> when the widget's switch state is set to
	off.&nbsp; Defaults to <code>0</code>.</p>
      </blockquote>
    </dd>

    <dd id="onvalue">
      <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td>Command-Line Name:&nbsp;</td>







|
|







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
          <td>Database Class:</td>
          <td><code><b>&nbsp;OffValue</b></code></td>
        </tr>
      </table>

      <blockquote>
        <p>The value to store in the associated <a href=
        "#variable">variable</a> when the widget's switch state is set to
        off.&nbsp; Defaults to <code>0</code>.</p>
      </blockquote>
    </dd>

    <dd id="onvalue">
      <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td>Command-Line Name:&nbsp;</td>
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
          <td>Database Class:</td>
          <td><code><b>&nbsp;OnValue</b></code></td>
        </tr>
      </table>

      <blockquote>
        <p>The value to store in the associated <a href=
	"#variable">variable</a> when the widget's switch state is set to
	on.&nbsp; Defaults to <code>1</code>.</p>
      </blockquote>
    </dd>

    <dd id="size">
      <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td>Command-Line Name:&nbsp;</td>







|
|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
          <td>Database Class:</td>
          <td><code><b>&nbsp;OnValue</b></code></td>
        </tr>
      </table>

      <blockquote>
        <p>The value to store in the associated <a href=
        "#variable">variable</a> when the widget's switch state is set to
        on.&nbsp; Defaults to <code>1</code>.</p>
      </blockquote>
    </dd>

    <dd id="size">
      <table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td>Command-Line Name:&nbsp;</td>
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
          <td>Database Class:</td>
          <td><code><b>&nbsp;Variable</b></code></td>
        </tr>
      </table>

      <blockquote>
        <p>The name of a global variable whose value is linked to the
	toggleswitch.&nbsp; The widget's switch state changes to on when this
	variable is set to the value specified by the <code><b><a href=
	"#onvalue">-onvalue</a></b></code> option and to off otherwise.&nbsp;
	Defaults to the widget's pathname if not specified.</p>
      </blockquote>
    </dd>

    <dt class="tm" id="widget_command"><b>WIDGET COMMAND</b></dt>

    <dd>
      The <code><b>tsw::toggleswitch</b></code> command creates a new Tcl







|
|
|
|







382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
          <td>Database Class:</td>
          <td><code><b>&nbsp;Variable</b></code></td>
        </tr>
      </table>

      <blockquote>
        <p>The name of a global variable whose value is linked to the
        toggleswitch.&nbsp; The widget's switch state changes to on when this
        variable is set to the value specified by the <code><b><a href=
        "#onvalue">-onvalue</a></b></code> option and to off otherwise.&nbsp;
        Defaults to the widget's pathname if not specified.</p>
      </blockquote>
    </dd>

    <dt class="tm" id="widget_command"><b>WIDGET COMMAND</b></dt>

    <dd>
      The <code><b>tsw::toggleswitch</b></code> command creates a new Tcl
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523

        <dd>See the <b>ttk_widget</b> manual entry.</dd>

        <dt class="tm" id="style"><code><i>pathName</i>
        <b>style</b></code></dt>

        <dd>Returns the style used by the underlying ttk::scale widget.&nbsp;
	This can be one of <code><b>Toggleswitch1</b></code>,
	<code><b>Toggleswitch2</b></code>, or
	<code><b>Toggleswitch3</b></code>, depending on the value of the
        <code><b><a href="#size">-size</a></b></code> option.&nbsp; For Tk
        themed widgets this subcommand was introduced in Tk 8.7a4, but the
        toggleswitch widget provides it for all supported Tk versions.</dd>

        <dt class="tm" id="switchstate"><code><i>pathName</i>
        <b>switchstate</b> ?<i>boolean</i>?</code></dt>

        <dd>Modifies or inquires the widget's switch state.&nbsp; If the
        optional argument is present then it must be a boolean (a numeric
        value, where 0 is false and anything else is true, or a string such as
        <code><b>true</b>/<b>yes</b>/<b>on</b></code> or
        <code><b>false</b>/<b>no</b>/<b>off</b></code>).&nbsp; If it is true
        then the command sets the <code><b>selected</b></code> flag of the
        underlying ttk::scale widget, moves the slider to the end of the
        trough, and sets the associated <a href="#variable">variable</a> to the
	value specified by the <code><b><a href=
        "#onvalue">-onvalue</a></b></code> option; otherwise it clears the
	<code><b>selected</b></code> flag, moves the slider to the beginning of
	the trough, and sets the associated variable to the value specified by
	the <code><b><a href="#offvalue">-offvalue</a></b></code> option.&nbsp;
	If the argument's value causes the widget's switch state to get toggled
	and the script specified as the value of the <code><b><a href=
        "#command">-command</a></b></code> option is a nonempty string then the
        subcommand evaluates that script at global scope and returns its
	result; otherwise the return value is an empty string.&nbsp; If the
	optional argument is not present then the command returns the widget's
	current switch state as <code>0</code> or <code>1</code>.&nbsp; When a
        toggleswitch widget is created, its switch state is initialized with
        <code>0</code>.</dd>

        <dt class="tm" id="toggle"><code><i>pathName</i>
        <b>toggle</b></code></dt>

        <dd>







|
|
|















|

|
|
|
|
|


|
|
|







480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523

        <dd>See the <b>ttk_widget</b> manual entry.</dd>

        <dt class="tm" id="style"><code><i>pathName</i>
        <b>style</b></code></dt>

        <dd>Returns the style used by the underlying ttk::scale widget.&nbsp;
        This can be one of <code><b>Toggleswitch1</b></code>,
        <code><b>Toggleswitch2</b></code>, or
        <code><b>Toggleswitch3</b></code>, depending on the value of the
        <code><b><a href="#size">-size</a></b></code> option.&nbsp; For Tk
        themed widgets this subcommand was introduced in Tk 8.7a4, but the
        toggleswitch widget provides it for all supported Tk versions.</dd>

        <dt class="tm" id="switchstate"><code><i>pathName</i>
        <b>switchstate</b> ?<i>boolean</i>?</code></dt>

        <dd>Modifies or inquires the widget's switch state.&nbsp; If the
        optional argument is present then it must be a boolean (a numeric
        value, where 0 is false and anything else is true, or a string such as
        <code><b>true</b>/<b>yes</b>/<b>on</b></code> or
        <code><b>false</b>/<b>no</b>/<b>off</b></code>).&nbsp; If it is true
        then the command sets the <code><b>selected</b></code> flag of the
        underlying ttk::scale widget, moves the slider to the end of the
        trough, and sets the associated <a href="#variable">variable</a> to the
        value specified by the <code><b><a href=
        "#onvalue">-onvalue</a></b></code> option; otherwise it clears the
        <code><b>selected</b></code> flag, moves the slider to the beginning of
        the trough, and sets the associated variable to the value specified by
        the <code><b><a href="#offvalue">-offvalue</a></b></code> option.&nbsp;
        If the argument's value causes the widget's switch state to get toggled
        and the script specified as the value of the <code><b><a href=
        "#command">-command</a></b></code> option is a nonempty string then the
        subcommand evaluates that script at global scope and returns its
        result; otherwise the return value is an empty string.&nbsp; If the
        optional argument is not present then the command returns the widget's
        current switch state as <code>0</code> or <code>1</code>.&nbsp; When a
        toggleswitch widget is created, its switch state is initialized with
        <code>0</code>.</dd>

        <dt class="tm" id="toggle"><code><i>pathName</i>
        <b>toggle</b></code></dt>

        <dd>