diff --git a/embedded/man/files/apps/bitmap-editor.n b/embedded/man/files/apps/bitmap-editor.n index 62c76d21..c6494ba2 100644 --- a/embedded/man/files/apps/bitmap-editor.n +++ b/embedded/man/files/apps/bitmap-editor.n @@ -320,4 +320,4 @@ Image processing .nf Copyright (c) -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/apps/diagram-viewer.n b/embedded/man/files/apps/diagram-viewer.n index 0e45f86c..0c7a22df 100644 --- a/embedded/man/files/apps/diagram-viewer.n +++ b/embedded/man/files/apps/diagram-viewer.n @@ -356,4 +356,4 @@ Documentation tools .nf Copyright (c) 2010 Andreas Kupries -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/autoscroll/autoscroll.n b/embedded/man/files/modules/autoscroll/autoscroll.n index 6a4abe53..c3cbbd2a 100644 --- a/embedded/man/files/modules/autoscroll/autoscroll.n +++ b/embedded/man/files/modules/autoscroll/autoscroll.n @@ -340,4 +340,4 @@ Please report such in the category \fIautoscroll\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -scroll, scrollbar \ No newline at end of file +scroll, scrollbar diff --git a/embedded/man/files/modules/canvas/canvas_drag.n b/embedded/man/files/modules/canvas/canvas_drag.n index e5b547f3..82130a18 100644 --- a/embedded/man/files/modules/canvas/canvas_drag.n +++ b/embedded/man/files/modules/canvas/canvas_drag.n @@ -414,4 +414,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -canvas, dragging \ No newline at end of file +canvas, dragging diff --git a/embedded/man/files/modules/canvas/canvas_epoints.n b/embedded/man/files/modules/canvas/canvas_epoints.n index 74b42f70..f51b93bf 100644 --- a/embedded/man/files/modules/canvas/canvas_epoints.n +++ b/embedded/man/files/modules/canvas/canvas_epoints.n @@ -538,4 +538,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -canvas, editing, point cloud, points \ No newline at end of file +canvas, editing, point cloud, points diff --git a/embedded/man/files/modules/canvas/canvas_epolyline.n b/embedded/man/files/modules/canvas/canvas_epolyline.n index df24f724..d3f7d6d1 100644 --- a/embedded/man/files/modules/canvas/canvas_epolyline.n +++ b/embedded/man/files/modules/canvas/canvas_epolyline.n @@ -490,4 +490,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -canvas, editing, polyline \ No newline at end of file +canvas, editing, polyline diff --git a/embedded/man/files/modules/canvas/canvas_equad.n b/embedded/man/files/modules/canvas/canvas_equad.n index d144b72b..9bbee884 100644 --- a/embedded/man/files/modules/canvas/canvas_equad.n +++ b/embedded/man/files/modules/canvas/canvas_equad.n @@ -496,4 +496,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -canvas, concave, convex, editing, non-convex, quadrilateral \ No newline at end of file +canvas, concave, convex, editing, non-convex, quadrilateral diff --git a/embedded/man/files/modules/canvas/canvas_gradient.n b/embedded/man/files/modules/canvas/canvas_gradient.n index ec86e4b5..663eb7d8 100644 --- a/embedded/man/files/modules/canvas/canvas_gradient.n +++ b/embedded/man/files/modules/canvas/canvas_gradient.n @@ -378,4 +378,4 @@ Copyright (c) Origin http://wiki\&.tcl\&.tk/6100 Copyright (c) Origin http://wiki\&.tcl\&.tk/37242 Copyright (c) Origin http://wiki\&.tcl\&.tk/9079 -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/canvas/canvas_highlight.n b/embedded/man/files/modules/canvas/canvas_highlight.n index 2ce7d6a6..0a81a6e7 100644 --- a/embedded/man/files/modules/canvas/canvas_highlight.n +++ b/embedded/man/files/modules/canvas/canvas_highlight.n @@ -356,4 +356,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -canvas, enter callback, highlighting, leave callback \ No newline at end of file +canvas, enter callback, highlighting, leave callback diff --git a/embedded/man/files/modules/canvas/canvas_mvg.n b/embedded/man/files/modules/canvas/canvas_mvg.n index 0ad04501..f65d0de6 100644 --- a/embedded/man/files/modules/canvas/canvas_mvg.n +++ b/embedded/man/files/modules/canvas/canvas_mvg.n @@ -307,4 +307,4 @@ canvas, graphics, imagemagick, magick vector graphics, mvg, print screen, serial Copyright (c) 2010 Wolf-Dieter Busch (http://wiki\&.tcl\&.tk/15505) Copyright (c) 2010 Documentation, Andreas Kupries -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/canvas/canvas_snap.n b/embedded/man/files/modules/canvas/canvas_snap.n index 8d051f83..d6ddcd8f 100644 --- a/embedded/man/files/modules/canvas/canvas_snap.n +++ b/embedded/man/files/modules/canvas/canvas_snap.n @@ -314,4 +314,4 @@ canvas, image, photo, print screen, snapshot Copyright (c) 2004 George Petasis (http://wiki\&.tcl\&.tk/1404) Copyright (c) 2010 Documentation, Andreas Kupries -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/canvas/canvas_sqmap.n b/embedded/man/files/modules/canvas/canvas_sqmap.n index 44e658f5..c605a2b4 100644 --- a/embedded/man/files/modules/canvas/canvas_sqmap.n +++ b/embedded/man/files/modules/canvas/canvas_sqmap.n @@ -396,4 +396,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -canvas, cell, grid, image, map, square map, tile \ No newline at end of file +canvas, cell, grid, image, map, square map, tile diff --git a/embedded/man/files/modules/canvas/canvas_tags.n b/embedded/man/files/modules/canvas/canvas_tags.n index 8cb874e5..ed923760 100644 --- a/embedded/man/files/modules/canvas/canvas_tags.n +++ b/embedded/man/files/modules/canvas/canvas_tags.n @@ -350,4 +350,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -append tag, canvas, insert tag, remove tag, tags \ No newline at end of file +append tag, canvas, insert tag, remove tag, tags diff --git a/embedded/man/files/modules/canvas/canvas_trlines.n b/embedded/man/files/modules/canvas/canvas_trlines.n index 5cbb2657..050fc33b 100644 --- a/embedded/man/files/modules/canvas/canvas_trlines.n +++ b/embedded/man/files/modules/canvas/canvas_trlines.n @@ -347,4 +347,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -canvas, crosshair, rubberband, tracking \ No newline at end of file +canvas, crosshair, rubberband, tracking diff --git a/embedded/man/files/modules/canvas/canvas_zoom.n b/embedded/man/files/modules/canvas/canvas_zoom.n index 2e4c3998..c17ba974 100644 --- a/embedded/man/files/modules/canvas/canvas_zoom.n +++ b/embedded/man/files/modules/canvas/canvas_zoom.n @@ -332,4 +332,4 @@ Please report such in the category \fIcanvas\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -zoom \ No newline at end of file +zoom diff --git a/embedded/man/files/modules/chatwidget/chatwidget.n b/embedded/man/files/modules/chatwidget/chatwidget.n index 289e63ee..48f80462 100644 --- a/embedded/man/files/modules/chatwidget/chatwidget.n +++ b/embedded/man/files/modules/chatwidget/chatwidget.n @@ -399,4 +399,4 @@ package and/or documentation\&. .SH "SEE ALSO" text(n) .SH KEYWORDS -chat, chatwidget, composite widget, irc, mega-widget, widget \ No newline at end of file +chat, chatwidget, composite widget, irc, mega-widget, widget diff --git a/embedded/man/files/modules/controlwidget/controlwidget.n b/embedded/man/files/modules/controlwidget/controlwidget.n index b03967aa..330c9a79 100644 --- a/embedded/man/files/modules/controlwidget/controlwidget.n +++ b/embedded/man/files/modules/controlwidget/controlwidget.n @@ -637,6 +637,9 @@ Color for the needle and the pin \fB::controlwidget::rdial\fR \fIw\fR \fIargs\fR Create a rotating dial\&. You can drag the dial to change the value\&. With the shift button depressed the value changes slowly, with the control button depressed it changes fast\&. +Similarly, you can control the dial via the mouse wheel, with the shift and control button +working in the same way as with the mouse pointer\&. +\fINote:\fR The shift and control buttons currently have no effect on Windows\&. .RS .TP widget \fIw\fR (in) @@ -658,6 +661,9 @@ Whether a horizontal disk/dial is required ("horizontal") or a vertical one ("ve \fBstep\fR value Initial step for incrementing or decrementing the value .TP +\fBbindwheel\fR value +Step size for controlling the dial's value via the mouse wheel +.TP \fBslow\fR value Factor on the step size for incrementing or decrementing the value slowly .TP @@ -812,4 +818,4 @@ Copyright (c) 2010 Gerhard Reithofer <\&.\&.\&.@\&.\&.\&.> Copyright (c) 2010 Marco Maggi <\&.\&.\&.@\&.\&.\&.> Copyright (c) 2010 Arjen Markus -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/crosshair/crosshair.n b/embedded/man/files/modules/crosshair/crosshair.n index e40e3938..2a9b7d68 100644 --- a/embedded/man/files/modules/crosshair/crosshair.n +++ b/embedded/man/files/modules/crosshair/crosshair.n @@ -410,4 +410,4 @@ Copyright (c) 2003 Kevin Kenny Copyright (c) 2008 (docs) Andreas Kupries Copyright (c) 2013 Frank Gover, Andreas Kupries -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/ctext/ctext.n b/embedded/man/files/modules/ctext/ctext.n index 0491b2f6..25e180d0 100644 --- a/embedded/man/files/modules/ctext/ctext.n +++ b/embedded/man/files/modules/ctext/ctext.n @@ -583,4 +583,4 @@ syntax highlighting, text, widget .nf Copyright (c) George Peter Staplin -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/cursor/cursor.n b/embedded/man/files/modules/cursor/cursor.n index a8d8d214..a0aa3d0c 100644 --- a/embedded/man/files/modules/cursor/cursor.n +++ b/embedded/man/files/modules/cursor/cursor.n @@ -320,4 +320,4 @@ cursor .nf Copyright (c) Jeffrey Hobbs -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/datefield/datefield.n b/embedded/man/files/modules/datefield/datefield.n index 302aa0aa..bad94aff 100644 --- a/embedded/man/files/modules/datefield/datefield.n +++ b/embedded/man/files/modules/datefield/datefield.n @@ -336,4 +336,4 @@ Widget .nf Copyright (c) Keith Vetter -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/diagrams/diagram.n b/embedded/man/files/modules/diagrams/diagram.n index eeb5fd84..2c81f487 100644 --- a/embedded/man/files/modules/diagrams/diagram.n +++ b/embedded/man/files/modules/diagrams/diagram.n @@ -3246,4 +3246,4 @@ package and/or documentation\&. .SH KEYWORDS 2D geometry, arc, arrow, box, canvas, circle, diagram, diamond, drawing, drum, ellipse, image, interpolation, intersection, line, move, picture, plane geometry, plotting, point, raster image, spline, text, vector .SH CATEGORY -Documentation tools \ No newline at end of file +Documentation tools diff --git a/embedded/man/files/modules/getstring/tk_getString.n b/embedded/man/files/modules/getstring/tk_getString.n index 71ab84aa..cdf58093 100644 --- a/embedded/man/files/modules/getstring/tk_getString.n +++ b/embedded/man/files/modules/getstring/tk_getString.n @@ -320,4 +320,4 @@ Please report such in the category \fIgetstring\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -dialog, entry, string \ No newline at end of file +dialog, entry, string diff --git a/embedded/man/files/modules/history/tklib_history.n b/embedded/man/files/modules/history/tklib_history.n index 947609be..41f22237 100644 --- a/embedded/man/files/modules/history/tklib_history.n +++ b/embedded/man/files/modules/history/tklib_history.n @@ -354,4 +354,4 @@ Please report such in the category \fIentry::history\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -entry, history \ No newline at end of file +entry, history diff --git a/embedded/man/files/modules/ico/ico.n b/embedded/man/files/modules/ico/ico.n index 111f1cea..2db94cb1 100644 --- a/embedded/man/files/modules/ico/ico.n +++ b/embedded/man/files/modules/ico/ico.n @@ -495,4 +495,4 @@ Please report such in the category \fIico\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -dll, entry, exe, ico, icon \ No newline at end of file +dll, entry, exe, ico, icon diff --git a/embedded/man/files/modules/ipentry/ipentry.n b/embedded/man/files/modules/ipentry/ipentry.n index 88be882c..1ecbbe87 100644 --- a/embedded/man/files/modules/ipentry/ipentry.n +++ b/embedded/man/files/modules/ipentry/ipentry.n @@ -503,4 +503,4 @@ package and/or documentation\&. .SH KEYWORDS entry, ip address, network .SH CATEGORY -Widget \ No newline at end of file +Widget diff --git a/embedded/man/files/modules/khim/khim.n b/embedded/man/files/modules/khim/khim.n index 41fcdc93..eaa9914d 100644 --- a/embedded/man/files/modules/khim/khim.n +++ b/embedded/man/files/modules/khim/khim.n @@ -444,4 +444,4 @@ Please report such in the category \fIkhim\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -character, i18n, input, international, method \ No newline at end of file +character, i18n, input, international, method diff --git a/embedded/man/files/modules/menubar/menubar.n b/embedded/man/files/modules/menubar/menubar.n index c506c50f..6c92e575 100644 --- a/embedded/man/files/modules/menubar/menubar.n +++ b/embedded/man/files/modules/menubar/menubar.n @@ -942,4 +942,4 @@ package and/or documentation\&. .nf Copyright (c) 2009 Tom Krehbiel All rights reserved\&. -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/notifywindow/notifywindow.n b/embedded/man/files/modules/notifywindow/notifywindow.n index c06bb733..9c0aa03c 100644 --- a/embedded/man/files/modules/notifywindow/notifywindow.n +++ b/embedded/man/files/modules/notifywindow/notifywindow.n @@ -307,4 +307,4 @@ alert, notification, tk .nf Copyright (c) 2015 Kevin Walzer/WordTech Communications LLC -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/ntext/ntext.n b/embedded/man/files/modules/ntext/ntext.n index 8d2bd83a..ccbcbfd4 100644 --- a/embedded/man/files/modules/ntext/ntext.n +++ b/embedded/man/files/modules/ntext/ntext.n @@ -285,13 +285,15 @@ package require \fBntext ?1\&.0?\fR .sp \fB::ntext::new_textPaste\fR \fIpathName\fR .sp +\fB::ntext::syncIndentColor\fR \fIpathName\fR +.sp .BE .SH DESCRIPTION The purpose of the \fBntext\fR package is to make the text widget behave more like other text-editing applications\&. It makes the text widget more useful for implementing a text editor, and makes it behave in a way that will be more familiar to most users\&. .PP The package provides a binding tag named \fINtext\fR for use by text widgets in place of the default \fIText\fR binding tag\&. .PP -Package \fBntext\fR 's functions and variables are contained entirely in the \fB::ntext\fR namespace; its other code is contained in the binding tag \fINtext\fR\&. \fBntext\fR has no exports to the global or other namespaces, and no new widget commands\&. It uses modified copies of the Tk code, leaving the original code, and the \fIText\fR binding tag, unchanged\&. +Package \fBntext\fR 's functions and variables are contained entirely in the \fB::ntext\fR namespace; its other code is contained in the binding tag \fINtext\fR\&. \fBntext\fR has no exports to the global or other namespaces, and no new widget commands\&. It uses modified copies of the \fBTk\fR code, leaving the original code, and the \fIText\fR binding tag, unchanged\&. .PP The differences between the \fINtext\fR binding tag and the default \fIText\fR binding tag are in three categories: .IP \(bu @@ -299,7 +301,7 @@ Some \fIText\fR bindings behave differently from most text-editing applications\ .IP \(bu When a logical line with leading whitespace is word-wrapped onto more than one display line, the wrapped display lines begin further to the left than the first display line, which can make the text layout untidy and difficult to read\&. \fINtext\fR can indent the wrapped lines to match the leading whitespace of the first display line (this facility is switched off by default)\&. For details see \fIntextIndent\fR\&. .IP \(bu -When the user navigates or selects text, Tcl/Tk sometimes needs to detect word boundaries\&. \fINtext\fR provides improved rules for word boundary detection\&. For details see \fIntextWordBreak\fR\&. +When the user navigates or selects text, \fBTcl/Tk\fR sometimes needs to detect word boundaries\&. \fINtext\fR provides improved rules for word boundary detection\&. For details see \fIntextWordBreak\fR\&. .PP The remainder of this page describes the basic use and configuration of all three aspects of \fINtext\fR\&. For more detailed information on the different facilities of \fINtext\fR, see the pages \fIntextBindings\fR, \fIntextIndent\fR, and \fIntextWordBreak\fR\&. .PP @@ -314,6 +316,9 @@ Replacement for ::tk_textCut that also maintains \fINtext\fR indentation (see \f .TP \fB::ntext::new_textPaste\fR \fIpathName\fR Replacement for ::tk_textPaste that also maintains \fINtext\fR indentation (see \fIntextIndent\fR)\&. +.TP +\fB::ntext::syncIndentColor\fR \fIpathName\fR +Command to apply the current value of the variable \fB::ntext::indentColor\fR to existing lines in a text widget\&. This command is useful if a text widget has been created, text has been inserted in the widget, \fIand then\fR the value of \fB::ntext::indentColor\fR is changed (see \fIntextIndent\fR)\&. .PP .SH "CONFIGURATION OPTIONS" \fINtext\fR provides alternatives to a number of behaviours of the classic \fIText\fR binding tag\&. Where there is an option, the \fINtext\fR behaviour (except for display-line indentation) is switched on by default\&. @@ -347,6 +352,15 @@ For more information see \fIntextBindings\fR For more information see \fIntextBindings\fR .PP .PP +\fB::ntext::classicParagraphs\fR +.IP \(bu +\fB0\fR - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit\&. The bindings involve vertical scrolling of the screen and are \&. +.IP \(bu +\fB1\fR - on macOS Aqua, certain keyboard bindings are made to behave in the same way as classic \fIText\fR, ignoring the conventions of Aqua\&. The bindings involve vertical scrolling of the screen and are \&. +.IP \(bu +For more information see \fIntextBindings\fR +.PP +.PP \fB::ntext::classicSelection\fR .IP \(bu \fB0\fR - (default value on macOS Aqua) selects Mac-like behaviour, i\&.e\&. when a navigation keystroke cancels a selection, the insert mark first moves to the end of the selection determined by the navigation direction of the keystroke, and then the keystroke is applied\&. @@ -374,6 +388,19 @@ After changing this value, the matching patterns should be recalculated\&. See For more information see \fIntextIndent\fR .PP .PP +\fB::ntext::indentColor\fR +.IP \(bu +\fB{}\fR - if the value is the empty string, then the indent of wrapped display lines has the same color as the widget background\&. +.IP \(bu +\fIcolor\fR - a valid \fBTk\fR color to use for the indent of wrapped display lines (default value \fI#d9d9d9\fR)\&. +.sp +Coloring is implemented with the text widget tag option \fI-lmargincolor\fR, which is available from \fBTk\fR 8\&.6\&.6 onwards\&. \fINtext\fR indent coloring has no effect in earlier versions of \fBTk\fR\&. +.sp +The value of \fB::ntext::indentColor\fR will often be set at startup\&. If the value is changed when text widgets already exist and contain text, those widgets can be updated by calling command \fB::ntext::syncIndentColor\fR\&. +.IP \(bu +For more information see \fIntextIndent\fR +.PP +.PP \fB::ntext::overwrite\fR .IP \(bu \fB0\fR - (initial value) text typed at the keyboard is inserted into the widget @@ -385,11 +412,13 @@ The value is toggled by the \fIInsert\fR key (except on macOS Aqua where there i For more information see \fIntextBindings\fR .PP .PP -\fB::ntext::classicParagraphs\fR +\fB::ntext::useBlockCursor\fR .IP \(bu -\fB0\fR - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit\&. The bindings involve vertical scrolling of the screen and are \&. +\fB0\fR - the block cursor will not be used\&. When the widget is in \fIoverwrite\fR mode (see \fB::ntext::overwrite\fR), the ordinary cursor will change color instead\&. .IP \(bu -\fB1\fR - on macOS Aqua, certain keyboard bindings are made to behave in the same way as classic \fIText\fR, ignoring the conventions of Aqua\&. The bindings involve vertical scrolling of the screen and are \&. +\fB1\fR - the block cursor will be used when the widget is in \fIoverwrite\fR mode (see \fB::ntext::overwrite\fR)\&. +.IP \(bu +The default value depends on the version of \fBTk\fR\&. In versions of \fBTk\fR earlier than \fB8\&.5\&.12\fR, the sizing of the block cursor had a bug, and \fB::ntext::useBlockCursor\fR defaults to \fB0\fR\&. From \fB8\&.5\&.12\fR onwards the bug is fixed, and \fB::ntext::useBlockCursor\fR defaults to \fB1\fR\&. .IP \(bu For more information see \fIntextBindings\fR .PP @@ -409,4 +438,4 @@ See bindtags for more information\&. .SH "SEE ALSO" bindtags, ntextBindings, ntextIndent, ntextWordBreak, re_syntax, regexp, text .SH KEYWORDS -bindtags, re_syntax, regexp, text \ No newline at end of file +bindtags, re_syntax, regexp, text diff --git a/embedded/man/files/modules/ntext/ntextBindings.n b/embedded/man/files/modules/ntext/ntextBindings.n index ef08fdd7..79817bc6 100644 --- a/embedded/man/files/modules/ntext/ntextBindings.n +++ b/embedded/man/files/modules/ntext/ntextBindings.n @@ -343,6 +343,13 @@ The behaviour of \fINtext\fR may be configured application-wide by setting the v \fB1\fR - selects classic \fIText\fR behaviour .PP .PP +\fB::ntext::classicParagraphs\fR +.IP \(bu +\fB0\fR - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit\&. The bindings involve vertical scrolling of the screen and are \&. +.IP \(bu +\fB1\fR - on macOS Aqua, certain keyboard bindings are made to behave in the same way as for the Windows and X11 windowing systems and the classic \fIText\fR, ignoring the conventions of Aqua\&. The bindings involve vertical scrolling of the screen and are \&. +.PP +.PP \fB::ntext::classicSelection\fR .IP \(bu \fB0\fR - (default value on macOS Aqua) selects Mac-like behaviour, i\&.e\&. when a navigation keystroke cancels a selection, the insert mark first moves to the end of the selection determined by the navigation direction of the keystroke, and then the keystroke is applied\&. @@ -359,11 +366,13 @@ The behaviour of \fINtext\fR may be configured application-wide by setting the v The value is toggled by the \fIInsert\fR key\&. .PP .PP -\fB::ntext::classicParagraphs\fR +\fB::ntext::useBlockCursor\fR .IP \(bu -\fB0\fR - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit\&. The bindings involve vertical scrolling of the screen and are \&. +\fB0\fR - the block cursor will not be used\&. When the widget is in \fIoverwrite\fR mode (see \fB::ntext::overwrite\fR), the ordinary cursor will change color instead\&. .IP \(bu -\fB1\fR - on macOS Aqua, certain keyboard bindings are made to behave in the same way as for the Windows and X11 windowing systems and the classic \fIText\fR, ignoring the conventions of Aqua\&. The bindings involve vertical scrolling of the screen and are \&. +\fB1\fR - the block cursor will be used when the widget is in \fIoverwrite\fR mode (see \fB::ntext::overwrite\fR)\&. +.IP \(bu +The default value depends on the version of \fBTk\fR\&. In versions of \fBTk\fR earlier than \fB8\&.5\&.12\fR, the sizing of the block cursor had a bug, and \fB::ntext::useBlockCursor\fR defaults to \fB0\fR\&. From \fB8\&.5\&.12\fR onwards the bug is fixed, and \fB::ntext::useBlockCursor\fR defaults to \fB1\fR\&. .PP .SH INTERNALS In order to remain independent of the version of \fBTk\fR (8\&.5 or 8\&.6), \fBntext\fR defines its own virtual events\&. These new virtual events are used only in the \fINtext\fR binding tag, and therefore do not interfere with the real or virtual events used in other code\&. @@ -387,4 +396,4 @@ bindtags \&.t {\&.t Ntext \&. all} .SH "SEE ALSO" bindtags, ntext, ntextIndent, text .SH KEYWORDS -bindtags, text \ No newline at end of file +bindtags, text diff --git a/embedded/man/files/modules/ntext/ntextIndent.n b/embedded/man/files/modules/ntext/ntextIndent.n index 0ba7302f..5ed3855b 100644 --- a/embedded/man/files/modules/ntext/ntextIndent.n +++ b/embedded/man/files/modules/ntext/ntextIndent.n @@ -285,6 +285,8 @@ package require \fBntext ?1\&.0?\fR .sp \fB::ntext::new_textPaste\fR \fIpathName\fR .sp +\fB::ntext::syncIndentColor\fR \fIpathName\fR +.sp .BE .SH DESCRIPTION The \fBntext\fR package provides a binding tag named \fINtext\fR for use by text widgets in place of the default \fIText\fR binding tag\&. @@ -300,21 +302,34 @@ This indentation is available to text widgets only in \fI-wrap\fR \fIword\fR mod Replacement for ::tk_textCopy\&. .TP \fB::ntext::new_textCut\fR \fIpathName\fR -Replacement for ::tk_textCut that also maintains \fINtext\fR indentation (see \fIntextIndent\fR)\&. +Replacement for ::tk_textCut that also maintains \fINtext\fR indentation\&. .TP \fB::ntext::new_textPaste\fR \fIpathName\fR -Replacement for ::tk_textPaste that also maintains \fINtext\fR indentation (see \fIntextIndent\fR)\&. +Replacement for ::tk_textPaste that also maintains \fINtext\fR indentation\&. +.TP +\fB::ntext::syncIndentColor\fR \fIpathName\fR +Command to apply the current value of the variable \fB::ntext::indentColor\fR to existing lines in a text widget\&. This command is useful if a text widget has been created, text has been inserted in the widget, \fIand then\fR the value of \fB::ntext::indentColor\fR is changed\&. .PP .SH "CONFIGURATION OPTIONS" The behavior of \fINtext\fR may be configured application-wide by setting the values of a number of namespace variables: .PP \fB::ntext::classicWrap\fR .IP \(bu -0 - selects \fINtext\fR behaviour, i\&.e\&. display lines are indented to match the initial whitespace of the first display line of a logical line\&. +\fB0\fR - selects \fINtext\fR behaviour, i\&.e\&. display lines are indented to match the initial whitespace of the first display line of a logical line\&. .sp No other action is required if this option, and the text widget's \fI-wrap\fR option, are set before any text is entered in the widget, and if text is entered and edited only by the mouse and keyboard\&. If, instead, text is manipulated by the script, or if the text widget's \fI-wrap\fR option or the value of \fB::ntext::classicWrap\fR are changed while the widget holds text, then calls to \fIntext\fR functions are needed to alter the indentation\&. See the section \fBINDENTING DISPLAY LINES\fR for detailed instructions\&. .IP \(bu -1 - (default value) selects classic \fIText\fR behaviour, i\&.e\&. no indentation\&. +\fB1\fR - (default value) selects classic \fIText\fR behaviour, i\&.e\&. no indentation\&. +.PP +\fB::ntext::indentColor\fR +.IP \(bu +\fB{}\fR - if the value is the empty string, then the indent of wrapped display lines has the same color as the widget background\&. +.IP \(bu +\fIcolor\fR - a valid Tk color to use for the indent of wrapped display lines (default value \fI#d9d9d9\fR)\&. +.sp +Coloring is implemented with the text widget tag option \fI-lmargincolor\fR, which is available from \fBTk\fR 8\&.6\&.6 onwards\&. \fINtext\fR indent coloring has no effect in earlier versions of \fBTk\fR\&. +.sp +The value of \fB::ntext::indentColor\fR will often be set at startup\&. If the value is changed when text widgets already exist and contain text, those widgets can be updated by calling command \fB::ntext::syncIndentColor\fR\&. .PP \fIAdvanced Use\fR .PP @@ -367,12 +382,34 @@ In other cases, i\&.e\&. if the widget is in \fI-word\fR \fIchar\fR or \fI-word\ .SH BUGS This version of \fBntext\fR is intended to be compatible with all releases of \fBTk\fR 8\&.5 and 8\&.6, and with the branches \fIcore-8-5-branch\fR, \fIcore-8-6-branch\fR, and \fItrunk\fR in the source code repository for \fBTk\fR\&. Any incompatibility with any of these versions, for any \fBTk\fR windowing system, should be reported as a bug\&. Please report such in the category \fIntext\fR of the \fITklib Trackers\fR [http://core\&.tcl\&.tk/tklib/reportlist]\&. .SH EXAMPLES -To switch on \fINtext\fR 's indentation and use it in widget \&.t: +To switch on \fINtext\fR 's indentation and use it in widget \&.t, using the default indent color \fI#d9d9d9\fR: +.CS + + +package require ntext +set ::ntext::classicWrap 0 +text \&.t -wrap word +bindtags \&.t {\&.t Ntext \&. all} + +.CE +To switch on \fINtext\fR 's indentation and use it in widget \&.t, without colored indents: .CS package require ntext set ::ntext::classicWrap 0 +set ::ntext::indentColor {} +text \&.t -wrap word +bindtags \&.t {\&.t Ntext \&. all} + +.CE +To switch on \fINtext\fR 's indentation and use it in widget \&.t, coloring the indents black: +.CS + + +package require ntext +set ::ntext::classicWrap 0 +set ::ntext::indentColor black text \&.t -wrap word bindtags \&.t {\&.t Ntext \&. all} @@ -401,6 +438,14 @@ set foo [\&.t index end] \&.t insert end {This line was added by the script, not the keyboard!} ::ntext::wrapIndent \&.t $foo end +.CE +To change the indentation color when a widget \&.t already holds text: +.CS + + +set ::ntext::indentColor black +::ntext::syncIndentColor \&.t + .CE To switch to \fI-wrap\fR \fIchar\fR mode: .CS @@ -413,4 +458,4 @@ To switch to \fI-wrap\fR \fIchar\fR mode: .SH "SEE ALSO" bindtags, ntext, re_syntax, regexp, text .SH KEYWORDS -bindtags, re_syntax, regexp, text \ No newline at end of file +bindtags, re_syntax, regexp, text diff --git a/embedded/man/files/modules/ntext/ntextWordBreak.n b/embedded/man/files/modules/ntext/ntextWordBreak.n index 1a23c0ba..2446b08b 100644 --- a/embedded/man/files/modules/ntext/ntextWordBreak.n +++ b/embedded/man/files/modules/ntext/ntextWordBreak.n @@ -387,4 +387,4 @@ See regexp, re_syntax for more information\&. .SH "SEE ALSO" bindtags, ntext, re_syntax, regexp, text .SH KEYWORDS -bindtags, re_syntax, regexp, text \ No newline at end of file +bindtags, re_syntax, regexp, text diff --git a/embedded/man/files/modules/persistentSelection/persistentSelection.n b/embedded/man/files/modules/persistentSelection/persistentSelection.n new file mode 100644 index 00000000..35fd42ce --- /dev/null +++ b/embedded/man/files/modules/persistentSelection/persistentSelection.n @@ -0,0 +1,456 @@ +'\" +'\" Generated from file 'persistentSelection\&.man' by tcllib/doctools with format 'nroff' +'\" +.TH "persistentSelection" n 1\&.0 tklib "Enhanced PRIMARY selection" +.\" The -*- nroff -*- definitions below are for supplemental macros used +.\" in Tcl/Tk manual entries. +.\" +.\" .AP type name in/out ?indent? +.\" Start paragraph describing an argument to a library procedure. +.\" type is type of argument (int, etc.), in/out is either "in", "out", +.\" or "in/out" to describe whether procedure reads or modifies arg, +.\" and indent is equivalent to second arg of .IP (shouldn't ever be +.\" needed; use .AS below instead) +.\" +.\" .AS ?type? ?name? +.\" Give maximum sizes of arguments for setting tab stops. Type and +.\" name are examples of largest possible arguments that will be passed +.\" to .AP later. If args are omitted, default tab stops are used. +.\" +.\" .BS +.\" Start box enclosure. From here until next .BE, everything will be +.\" enclosed in one large box. +.\" +.\" .BE +.\" End of box enclosure. +.\" +.\" .CS +.\" Begin code excerpt. +.\" +.\" .CE +.\" End code excerpt. +.\" +.\" .VS ?version? ?br? +.\" Begin vertical sidebar, for use in marking newly-changed parts +.\" of man pages. The first argument is ignored and used for recording +.\" the version when the .VS was added, so that the sidebars can be +.\" found and removed when they reach a certain age. If another argument +.\" is present, then a line break is forced before starting the sidebar. +.\" +.\" .VE +.\" End of vertical sidebar. +.\" +.\" .DS +.\" Begin an indented unfilled display. +.\" +.\" .DE +.\" End of indented unfilled display. +.\" +.\" .SO ?manpage? +.\" Start of list of standard options for a Tk widget. The manpage +.\" argument defines where to look up the standard options; if +.\" omitted, defaults to "options". The options follow on successive +.\" lines, in three columns separated by tabs. +.\" +.\" .SE +.\" End of list of standard options for a Tk widget. +.\" +.\" .OP cmdName dbName dbClass +.\" Start of description of a specific option. cmdName gives the +.\" option's name as specified in the class command, dbName gives +.\" the option's name in the option database, and dbClass gives +.\" the option's class in the option database. +.\" +.\" .UL arg1 arg2 +.\" Print arg1 underlined, then print arg2 normally. +.\" +.\" .QW arg1 ?arg2? +.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). +.\" +.\" .PQ arg1 ?arg2? +.\" Print an open parenthesis, arg1 in quotes, then arg2 normally +.\" (for trailing punctuation) and then a closing parenthesis. +.\" +.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. +.if t .wh -1.3i ^B +.nr ^l \n(.l +.ad b +.\" # Start an argument description +.de AP +.ie !"\\$4"" .TP \\$4 +.el \{\ +. ie !"\\$2"" .TP \\n()Cu +. el .TP 15 +.\} +.ta \\n()Au \\n()Bu +.ie !"\\$3"" \{\ +\&\\$1 \\fI\\$2\\fP (\\$3) +.\".b +.\} +.el \{\ +.br +.ie !"\\$2"" \{\ +\&\\$1 \\fI\\$2\\fP +.\} +.el \{\ +\&\\fI\\$1\\fP +.\} +.\} +.. +.\" # define tabbing values for .AP +.de AS +.nr )A 10n +.if !"\\$1"" .nr )A \\w'\\$1'u+3n +.nr )B \\n()Au+15n +.\" +.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n +.nr )C \\n()Bu+\\w'(in/out)'u+2n +.. +.AS Tcl_Interp Tcl_CreateInterp in/out +.\" # BS - start boxed text +.\" # ^y = starting y location +.\" # ^b = 1 +.de BS +.br +.mk ^y +.nr ^b 1u +.if n .nf +.if n .ti 0 +.if n \l'\\n(.lu\(ul' +.if n .fi +.. +.\" # BE - end boxed text (draw box now) +.de BE +.nf +.ti 0 +.mk ^t +.ie n \l'\\n(^lu\(ul' +.el \{\ +.\" Draw four-sided box normally, but don't draw top of +.\" box if the box started on an earlier page. +.ie !\\n(^b-1 \{\ +\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.el \}\ +\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.\} +.fi +.br +.nr ^b 0 +.. +.\" # VS - start vertical sidebar +.\" # ^Y = starting y location +.\" # ^v = 1 (for troff; for nroff this doesn't matter) +.de VS +.if !"\\$2"" .br +.mk ^Y +.ie n 'mc \s12\(br\s0 +.el .nr ^v 1u +.. +.\" # VE - end of vertical sidebar +.de VE +.ie n 'mc +.el \{\ +.ev 2 +.nf +.ti 0 +.mk ^t +\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' +.sp -1 +.fi +.ev +.\} +.nr ^v 0 +.. +.\" # Special macro to handle page bottom: finish off current +.\" # box/sidebar if in box/sidebar mode, then invoked standard +.\" # page bottom macro. +.de ^B +.ev 2 +'ti 0 +'nf +.mk ^t +.if \\n(^b \{\ +.\" Draw three-sided box if this is the box's first page, +.\" draw two sides but no top otherwise. +.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.\} +.if \\n(^v \{\ +.nr ^x \\n(^tu+1v-\\n(^Yu +\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c +.\} +.bp +'fi +.ev +.if \\n(^b \{\ +.mk ^y +.nr ^b 2 +.\} +.if \\n(^v \{\ +.mk ^Y +.\} +.. +.\" # DS - begin display +.de DS +.RS +.nf +.sp +.. +.\" # DE - end display +.de DE +.fi +.RE +.sp +.. +.\" # SO - start of list of standard options +.de SO +'ie '\\$1'' .ds So \\fBoptions\\fR +'el .ds So \\fB\\$1\\fR +.SH "STANDARD OPTIONS" +.LP +.nf +.ta 5.5c 11c +.ft B +.. +.\" # SE - end of list of standard options +.de SE +.fi +.ft R +.LP +See the \\*(So manual entry for details on the standard options. +.. +.\" # OP - start of full description for a single option +.de OP +.LP +.nf +.ta 4c +Command-Line Name: \\fB\\$1\\fR +Database Name: \\fB\\$2\\fR +Database Class: \\fB\\$3\\fR +.fi +.IP +.. +.\" # CS - begin code excerpt +.de CS +.RS +.nf +.ta .25i .5i .75i 1i +.. +.\" # CE - end code excerpt +.de CE +.fi +.RE +.. +.\" # UL - underline word +.de UL +\\$1\l'|0\(ul'\\$2 +.. +.\" # QW - apply quotation marks to word +.de QW +.ie '\\*(lq'"' ``\\$1''\\$2 +.\"" fix emacs highlighting +.el \\*(lq\\$1\\*(rq\\$2 +.. +.\" # PQ - apply parens and quotation marks to word +.de PQ +.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 +.\"" fix emacs highlighting +.el (\\*(lq\\$1\\*(rq\\$2)\\$3 +.. +.\" # QR - quoted range +.de QR +.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 +.\"" fix emacs highlighting +.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 +.. +.\" # MT - "empty" string +.de MT +.QW "" +.. +.BS +.SH NAME +persistentSelection \- Enhanced PRIMARY selection +.SH SYNOPSIS +package require \fBTcl 8\&.5\fR +.sp +package require \fBTk 8\&.5\fR +.sp +package require \fBpersistentSelection ?1\&.0?\fR +.sp +\fBpersistentSelection::fixText\fR +.sp +\fBpersistentSelection::getClassicPrimarySel\fR ?\fIdisplayOf\fR? ?\fIwithOthers\fR? +.sp +\fBpersistentSelection::getPrimarySel\fR ?\fIdisplayOf\fR? +.sp +\fBpersistentSelection::report\fR \fItype\fR \fIpathName\fR +.sp +.BE +.SH DESCRIPTION +Consider a \fBTk\fR widget that sets its \fB-exportselection\fR option to boolean \fBtrue\fR, thereby exporting its selection\&. When the selection in the widget is canceled, by default \fBTk\fR also cancels the \fBPRIMARY\fR selection\&. In this situation, an attempt to read the \fBPRIMARY\fR selection, e\&.g\&. by a \fB<>\fR event, will fail\&. +.PP +The \fBpersistentSelection\fR package offers more convenient behavior\&. It will sustain as the \fBPRIMARY\fR selection the last non-empty value set by any \fBTk\fR widget that it monitors, as long as the \fBPRIMARY\fR selection is not claimed by another process, or by a widget that it does not monitor\&. +.PP +The \fBpersistentSelection\fR package works by binding to the \fB<>\fR event on the widgets of interest, and using this binding to monitor any change of the selection in the widget\&. Its commands are confined to the namespace \fB::persistentSelection\fR\&. +.SH COMMANDS +.TP +\fBpersistentSelection::fixText\fR +Call this command once to resolve problems with \fB\fBtext\fR\fR widgets that use the default \fBText\fR bindtag (rather than \fBNtext\fR)\&. See \fBText widgets\fR for an explanation\&. +.sp +The command adjusts some \fBText\fR bindings to generate \fB<>\fR events; and it re-orders calls to the \fB\fBtext\fR\fR widget \fBtag\fR command in the private command \fB::tk::TextSelectTo\fR, so that this command cooperates better with \fBpersistentSelection\fR\&. +.sp +These adjustments are needed only to older versions of \fBTk\fR\&. The command \fBpersistentSelection::fixText\fR has no effect on sufficiently recent releases\&. It can safely be called for any version of \fBTk\fR\&. +.TP +\fBpersistentSelection::getClassicPrimarySel\fR ?\fIdisplayOf\fR? ?\fIwithOthers\fR? +.RS +.IP \(bu +\fIdisplayOf\fR - a \fBTk\fR window path on the display to be interrogated (optional, default {\fB\&.\fR}) +.IP \(bu +\fIwithOthers\fR - whether to return the \fBPRIMARY\fR selection if it is owned by another process or interpreter (optional, boolean, default \fBfalse\fR) +.RE +.IP +A command to return the classic (non-persistent) form of the \fBPRIMARY\fR selection\&. If the selection does not exist, or is sustained only by \fBpersistentSelection\fR, the command returns the empty string\&. +.TP +\fBpersistentSelection::getPrimarySel\fR ?\fIdisplayOf\fR? +.RS +.IP \(bu +\fIdisplayOf\fR - a \fBTk\fR window on the display to be interrogated (optional, default {\fB\&.\fR}) +.RE +.IP +A command to return the value of the \fBPRIMARY\fR selection\&. If the selection does not exist, the command returns the empty string\&. The usual \fBTk\fR commands are perfectly valid, but they raise an error if the selection does not exist\&. +.TP +\fBpersistentSelection::report\fR \fItype\fR \fIpathName\fR +.RS +.IP \(bu +\fItype\fR - (value \fBtext\fR or \fBentry\fR) classification of the widget whose selection has changed +.IP \(bu +\fIpathName\fR - the \fBTk\fR window path of the widget whose selection has changed +.RE +.IP +To make package \fBpersistentSelection\fR monitor a widget, this command must be bound to the \fB<>\fR event on that widget\&. The command records changes in the widget's selection, and uses the information to sustain a non-empty \fBPRIMARY\fR selection on each display\&. +.PP +.SH USAGE +.SS "SCRIPT REQUIREMENTS" +For each widget that will be monitored by \fBpersistentSelection\fR, the command \fBpersistentSelection::report\fR must be bound to event \fB<>\fR in one of the widget's binding tags\&. +.PP +For example, the developer may wish to use \fBpersistentSelection\fR with every \fB\fBtext\fR\fR and \fB\fBentryPlus\fR\fR widget in an application: this can be achieved by adding the \fB<>\fR binding to the \fBText\fR and \fBEntryPlus\fR bindtags\&. See \fBEXAMPLES\fR\&. +.PP +If \fBpersistentSelection\fR is not required for all widgets of a particular class, the binding can be added to per-widget bindtags\&. See \fBEXAMPLES\fR\&. +.SS "WIDGET REQUIREMENTS" +To be capable of being monitored by \fBpersistentSelection\fR, a widget must satisfy three conditions: +.IP \(bu +It must have an \fB-exportselection\fR option that allows it to export its selection to the \fBPRIMARY\fR selection\&. +.IP \(bu +It must generate a \fB<>\fR event whenever its selection changes\&. +.IP \(bu +its bindings to other events should be suitable - specifically, in versions of \fBTk\fR older than \fB8\&.6\&.6\fR, a GUI event that extends or reduces the selection from one non-empty value to another should not use an intermediate state that has an empty selection, because this confuses \fBpersistentStore\fR\&. +.PP +.PP +The \fBTk\fR and \fBTtk\fR widgets that can export their selection are \fB\fBtext\fR\fR, \fB\fBentry\fR\fR, \fB\fBlistbox\fR\fR, \fB\fBspinbox\fR\fR, \fB\fBttk::entry\fR\fR, \fB\fBttk::spinbox\fR\fR, and \fB\fBttk::combobox\fR\fR\&. +.SS "TEXT WIDGETS" +In versions of \fBTk\fR older than \fB8\&.6\&.9\fR, the \fB\fBtext\fR\fR widget does not generate \fB<>\fR events in a few "corner cases" in which its selection changes\&. These omissions can be corrected by changes to the \fBText\fR bindings, in order to satisfy the second condition of \fBWidget requirements\fR\&. +.PP +In addition, versions of \fBTk\fR older than \fB8\&.6\&.6\fR process selection events slightly differently from newer versions, and in combination with the \fBText\fR bindings this confuses \fBpersistentStore\fR\&. If an upgrade to the current version of \fBTcl/Tk\fR is not feasible, this problem can be resolved by making a slight modification to the widget bindings, in order to satisfy the third condition of \fBWidget requirements\fR\&. +.PP +Either the script should call the command \fBpersistentSelection::fixText\fR to adjust the \fBText\fR bindings and the commands that they call; or the widget can use the \fBNtext\fR binding tag (for \fBntext\fR version 1\&.0 or above) instead of the default \fBText\fR bindtag\&. +.PP +In either case, the argument \fItype\fR supplied to command \fBpersistentSelection::report\fR should have the value \fBtext\fR\&. +.SS "ENTRY, SPINBOX, TTK::ENTRY, TTK::SPINBOX, AND TTK::COMBOBOX WIDGETS" +The \fB\fBentry\fR\fR, \fB\fBspinbox\fR\fR, \fB\fBttk::entry\fR\fR, \fB\fBttk::spinbox\fR\fR, and \fB\fBttk::combobox\fR\fR widgets do not generate a \fB<>\fR event when their selection changes, and therefore require modification\&. +.PP +The package \fBwidgetPlus\fR provides \fBsnit\fR wrappers \fB\fBwidgetPlus::entryPlus\fR\fR, \fB\fBwidgetPlus::spinboxPlus\fR\fR, \fB\fBwidgetPlus::ttkEntryPlus\fR\fR, \fB\fBwidgetPlus::ttkSpinboxPlus\fR\fR, and \fB\fBwidgetPlus::ttkComboboxPlus\fR\fR respectively\&. Each \fBwidgetPlus\fR widget generates the required \fB<>\fR events\&. +.PP +In all these cases, the argument \fItype\fR supplied to command \fBpersistentSelection::report\fR should have the value \fBentry\fR\&. This argument determines how \fBpersistentSelection\fR will inspect the widget's selection, and the commands that do so are the same for all these widgets\&. +.SS "LISTBOX WIDGETS" +A similar wrapper has not been created for the \fB\fBlistbox\fR\fR widget, which has the complication of permitting multiple selections\&. +.SH "TO DO" +.IP \(bu +Test on a system with multiple displays\&. +.PP +.SH BUGS +This version of \fBpersistentSelection\fR is intended to be compatible with all releases of \fBTk\fR 8\&.5 and 8\&.6, and with the branches \fIcore-8-5-branch\fR, \fIcore-8-6-branch\fR, \fIrevised_text\fR, and \fItrunk\fR in the source code repository for \fBTk\fR\&. Any incompatibility with any of these versions, for any \fBTk\fR windowing system, should be reported as a bug\&. Please report such in the category \fIpersistentSelection\fR of the \fITklib Trackers\fR [http://core\&.tcl\&.tk/tklib/reportlist]\&. +.SH EXAMPLES +Each example uses \fBpersistentSelection\fR to retain the last non-empty value of the selection in certain widgets\&. Each example also includes the creation of sample widgets\&. +.PP +Monitor all \fB\fBentryPlus\fR\fR widgets\&. +.CS + + +package require widgetPlus +widgetPlus::entryPlus \&.ep +pack \&.ep + +package require persistentSelection +bind EntryPlus <> {::persistentSelection::report entry %W} + +.CE +Monitor all \fB\fBtext\fR\fR widgets that use the default \fBText\fR bindings\&. +.CS + + +text \&.t +pack \&.t + +package require persistentSelection +::persistentSelection::fixText +bind Text <> {::persistentSelection::report text %W} + +.CE +Monitor all \fB\fBtext\fR\fR widgets that use the default \fBText\fR bindings, and all \fB\fBentryPlus\fR\fR widgets\&. +.CS + + +text \&.t +pack \&.t + +package require widgetPlus +widgetPlus::entryPlus \&.ep +pack \&.ep + +package require persistentSelection +::persistentSelection::fixText +bind Text <> {::persistentSelection::report text %W} +bind EntryPlus <> {::persistentSelection::report entry %W} + +.CE +Monitor all \fB\fBtext\fR\fR widgets that use \fBNtext\fR bindings\&. +.CS + + +text \&.t +pack \&.t + +package require ntext +bindtags \&.t {\&.t Ntext \&. all} + +package require persistentSelection +bind Ntext <> {::persistentSelection::report text %W} + +.CE +Monitor a single \fB\fBentryPlus\fR\fR widget \fB\&.ep\fR +.CS + + +package require widgetPlus +widgetPlus::entryPlus \&.ep +pack \&.ep + +package require persistentSelection +bind \&.ep <> {::persistentSelection::report entry %W} + +.CE +Monitor a single \fB\fBtext\fR\fR widget \fB\&.t\fR +.CS + + +text \&.t +pack \&.t + +package require persistentSelection +bind \&.t <> {::persistentSelection::report text %W} + +.CE +.SH "SEE ALSO" +bindtags, ntext, text, widgetPlus diff --git a/embedded/man/files/modules/plotchart/plotchart.n b/embedded/man/files/modules/plotchart/plotchart.n index 0a613bbd..0237d533 100644 --- a/embedded/man/files/modules/plotchart/plotchart.n +++ b/embedded/man/files/modules/plotchart/plotchart.n @@ -330,6 +330,8 @@ package require \fBPlotchart ?2\&.4\&.0?\fR .sp \fB::Plotchart::createTernaryDiagram\fR \fIw\fR \fIargs\fR .sp +\fB::Plotchart::createNormalPlot\fR \fIw\fR \fIxscale\fR \fIargs\fR +.sp \fB::Plotchart::createStatusTimeline\fR \fIw\fR \fIxaxis\fR \fIylabel\fR \fIargs\fR .sp \fB$anyplot\fR title \fItext\fR \fIposition\fR @@ -382,6 +384,10 @@ package require \fBPlotchart ?2\&.4\&.0?\fR .sp \fB$xyplot\fR plot \fIseries\fR \fIxcrd\fR \fIycrd\fR .sp +\fB$normalplot\fR plot \fIseries\fR \fImean\fR \fIstdev\fR \fIdata\fR +.sp +\fB$normalplot\fR diagonal +.sp \fB$xyplot\fR plotlist \fIseries\fR \fIxlist\fR \fIylist\fR \fIevery\fR .sp \fB$xyplot\fR region \fIseries\fR \fIxlist\fR \fIylist\fR @@ -1257,6 +1263,33 @@ to influence the number of labels along the three sides\&. .RE .sp .TP +\fB::Plotchart::createNormalPlot\fR \fIw\fR \fIxscale\fR \fIargs\fR +Create a command to draw a normal plot - useful to investigate whether a data set is normally +distributed or not\&. In that case the data will fall on or near the diagonal\&. As such, it is a +specialised plotting procedure\&. +.sp +The details of the plotting procedure have been adopted from the \fIqqnorm\fR in the "R" \fIstats\fR +package and described on Wikipedia\&. +.sp +As the implementation of this plot type relies on the \fImath::statistics\fR package, it is only +available if that package can be loaded\&. +.RS +.TP +widget \fIw\fR (in) +Name of the canvas widget to hold the normal plot\&. +.TP +list \fIxscale\fR (in) +A 3-element list containing minimum, maximum and stepsize for the x-axis +in this order\&. The scaling of the y-axis is determined from that\&. \fIImportant:\fR the scale +is to be given in terms of the normalised data, that is: 0 represents the mean of the data, +1 one standard deviation away from the mean etc\&. +.TP +list \fIargs\fR (in) +Zero or more option-value pairs to influence the position and the appearance of the +plot - see the XY-plot for more details\&. +.RE +.sp +.TP \fB::Plotchart::createStatusTimeline\fR \fIw\fR \fIxaxis\fR \fIylabel\fR \fIargs\fR Create a command to draw a so-called status timeline\&. Its layout is similar to a horizontal barchart, but the bars are drawn in different colours, each representing the status of @@ -1718,6 +1751,32 @@ Y-coordinate of the new point\&. .RE .PP .PP +For \fInormal plots\fR: +.TP +\fB$normalplot\fR plot \fIseries\fR \fImean\fR \fIstdev\fR \fIdata\fR +Plot the data set using the given mean and stanard deviation\&. +.sp +As you give the mean and standard deviation separately, the plot can be used for several data series +or for adding to an existing data series\&. +.RS +.TP +string \fIseries\fR (in) +Name of the data series - used to determine the appearance +.TP +float \fImean\fR (in) +Assumed mean of the data set\&. +.TP +float \fIstdev\fR (in) +Assumed standard deviation of the data set\&. +.TP +list \fIdata\fR (in) +List of the data comprising the data set +.RE +.TP +\fB$normalplot\fR diagonal +Draw a diagonal line, indicating the ideal normally distributed data set\&. +.PP +.PP For \fIxy, x-log y, log-x-y, log-x-log-y plots\fR there is the additional command \fIplotlist\fR, which is useful for plotting a large amount of data: .TP @@ -4434,4 +4493,4 @@ package and/or documentation\&. .nf Copyright (c) 2013 Arjen Markus -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/swaplist/swaplist.n b/embedded/man/files/modules/swaplist/swaplist.n index 62d88d5e..fe9522e4 100644 --- a/embedded/man/files/modules/swaplist/swaplist.n +++ b/embedded/man/files/modules/swaplist/swaplist.n @@ -351,4 +351,4 @@ package and/or documentation\&. .SH KEYWORDS dialog, disjointlistbox, listbox .SH CATEGORY -Widget \ No newline at end of file +Widget diff --git a/embedded/man/files/modules/tkpiechart/canvaslabel.n b/embedded/man/files/modules/tkpiechart/canvaslabel.n index 70fe7e11..4c6d0f0b 100644 --- a/embedded/man/files/modules/tkpiechart/canvaslabel.n +++ b/embedded/man/files/modules/tkpiechart/canvaslabel.n @@ -381,4 +381,4 @@ canvas, labeler, pie, slice .nf Copyright (c) 1995-2004 Jean-Luc Fontaine -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/tkpiechart/pie.n b/embedded/man/files/modules/tkpiechart/pie.n index c0db526b..8b09531d 100644 --- a/embedded/man/files/modules/tkpiechart/pie.n +++ b/embedded/man/files/modules/tkpiechart/pie.n @@ -403,4 +403,4 @@ canvas, labeler, pie, slice .nf Copyright (c) 1995-2004 Jean-Luc Fontaine -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/tkpiechart/pieboxlabeler.n b/embedded/man/files/modules/tkpiechart/pieboxlabeler.n index 406a4f82..30e5931c 100644 --- a/embedded/man/files/modules/tkpiechart/pieboxlabeler.n +++ b/embedded/man/files/modules/tkpiechart/pieboxlabeler.n @@ -328,4 +328,4 @@ canvas, labeler, pie, slice .nf Copyright (c) 1995-2004 Jean-Luc Fontaine -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/tkpiechart/pieperipherallabeler.n b/embedded/man/files/modules/tkpiechart/pieperipherallabeler.n index c904ef44..69d9e245 100644 --- a/embedded/man/files/modules/tkpiechart/pieperipherallabeler.n +++ b/embedded/man/files/modules/tkpiechart/pieperipherallabeler.n @@ -334,4 +334,4 @@ canvas, labeler, pie, slice .nf Copyright (c) 1995-2004 Jean-Luc Fontaine -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/tooltip/tooltip.n b/embedded/man/files/modules/tooltip/tooltip.n index 3fce8b6f..1c711071 100644 --- a/embedded/man/files/modules/tooltip/tooltip.n +++ b/embedded/man/files/modules/tooltip/tooltip.n @@ -422,4 +422,4 @@ balloon, help, hover, tooltip .nf Copyright (c) 1996-2008, Jeffrey Hobbs -.fi \ No newline at end of file +.fi diff --git a/embedded/man/files/modules/widget/widget.n b/embedded/man/files/modules/widget/widget.n index 77859a88..bc16dd57 100644 --- a/embedded/man/files/modules/widget/widget.n +++ b/embedded/man/files/modules/widget/widget.n @@ -367,4 +367,4 @@ package and/or documentation\&. .SH KEYWORDS bundle, calendar, dateentry, dialog, megawidget, menu, panelframe, ruler, screenruler, scrolledwindow, snit, statusbar, superframe, toolbar, widget .SH CATEGORY -Widget \ No newline at end of file +Widget diff --git a/embedded/man/files/modules/widget/widget_calendar.n b/embedded/man/files/modules/widget/widget_calendar.n index 63100d86..40b19154 100644 --- a/embedded/man/files/modules/widget/widget_calendar.n +++ b/embedded/man/files/modules/widget/widget_calendar.n @@ -377,4 +377,4 @@ package and/or documentation\&. .SH KEYWORDS calendar, date, megawidget, snit, widget .SH CATEGORY -Widget \ No newline at end of file +Widget diff --git a/embedded/man/files/modules/widget/widget_dateentry.n b/embedded/man/files/modules/widget/widget_dateentry.n index 9921e3a3..6cdfa8b2 100644 --- a/embedded/man/files/modules/widget/widget_dateentry.n +++ b/embedded/man/files/modules/widget/widget_dateentry.n @@ -358,4 +358,4 @@ package and/or documentation\&. .SH KEYWORDS date, dateentry, megawidget, snit, widget .SH CATEGORY -Widget \ No newline at end of file +Widget diff --git a/embedded/man/files/modules/widget/widget_toolbar.n b/embedded/man/files/modules/widget/widget_toolbar.n index db2e45dc..19e57c44 100644 --- a/embedded/man/files/modules/widget/widget_toolbar.n +++ b/embedded/man/files/modules/widget/widget_toolbar.n @@ -359,4 +359,4 @@ package and/or documentation\&. .SH KEYWORDS megawidget, snit, toolbar, widget .SH CATEGORY -Widget \ No newline at end of file +Widget diff --git a/embedded/man/files/modules/widgetPlus/widgetPlus.n b/embedded/man/files/modules/widgetPlus/widgetPlus.n new file mode 100644 index 00000000..b9f0e6a3 --- /dev/null +++ b/embedded/man/files/modules/widgetPlus/widgetPlus.n @@ -0,0 +1,617 @@ +'\" +'\" Generated from file 'widgetPlus\&.man' by tcllib/doctools with format 'nroff' +'\" +.TH "widgetPlus" n 1\&.0 tklib "Enhanced Entry, Spinbox, and Combobox Widgets with Undo/Redo and other useful features" +.\" The -*- nroff -*- definitions below are for supplemental macros used +.\" in Tcl/Tk manual entries. +.\" +.\" .AP type name in/out ?indent? +.\" Start paragraph describing an argument to a library procedure. +.\" type is type of argument (int, etc.), in/out is either "in", "out", +.\" or "in/out" to describe whether procedure reads or modifies arg, +.\" and indent is equivalent to second arg of .IP (shouldn't ever be +.\" needed; use .AS below instead) +.\" +.\" .AS ?type? ?name? +.\" Give maximum sizes of arguments for setting tab stops. Type and +.\" name are examples of largest possible arguments that will be passed +.\" to .AP later. If args are omitted, default tab stops are used. +.\" +.\" .BS +.\" Start box enclosure. From here until next .BE, everything will be +.\" enclosed in one large box. +.\" +.\" .BE +.\" End of box enclosure. +.\" +.\" .CS +.\" Begin code excerpt. +.\" +.\" .CE +.\" End code excerpt. +.\" +.\" .VS ?version? ?br? +.\" Begin vertical sidebar, for use in marking newly-changed parts +.\" of man pages. The first argument is ignored and used for recording +.\" the version when the .VS was added, so that the sidebars can be +.\" found and removed when they reach a certain age. If another argument +.\" is present, then a line break is forced before starting the sidebar. +.\" +.\" .VE +.\" End of vertical sidebar. +.\" +.\" .DS +.\" Begin an indented unfilled display. +.\" +.\" .DE +.\" End of indented unfilled display. +.\" +.\" .SO ?manpage? +.\" Start of list of standard options for a Tk widget. The manpage +.\" argument defines where to look up the standard options; if +.\" omitted, defaults to "options". The options follow on successive +.\" lines, in three columns separated by tabs. +.\" +.\" .SE +.\" End of list of standard options for a Tk widget. +.\" +.\" .OP cmdName dbName dbClass +.\" Start of description of a specific option. cmdName gives the +.\" option's name as specified in the class command, dbName gives +.\" the option's name in the option database, and dbClass gives +.\" the option's class in the option database. +.\" +.\" .UL arg1 arg2 +.\" Print arg1 underlined, then print arg2 normally. +.\" +.\" .QW arg1 ?arg2? +.\" Print arg1 in quotes, then arg2 normally (for trailing punctuation). +.\" +.\" .PQ arg1 ?arg2? +.\" Print an open parenthesis, arg1 in quotes, then arg2 normally +.\" (for trailing punctuation) and then a closing parenthesis. +.\" +.\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages. +.if t .wh -1.3i ^B +.nr ^l \n(.l +.ad b +.\" # Start an argument description +.de AP +.ie !"\\$4"" .TP \\$4 +.el \{\ +. ie !"\\$2"" .TP \\n()Cu +. el .TP 15 +.\} +.ta \\n()Au \\n()Bu +.ie !"\\$3"" \{\ +\&\\$1 \\fI\\$2\\fP (\\$3) +.\".b +.\} +.el \{\ +.br +.ie !"\\$2"" \{\ +\&\\$1 \\fI\\$2\\fP +.\} +.el \{\ +\&\\fI\\$1\\fP +.\} +.\} +.. +.\" # define tabbing values for .AP +.de AS +.nr )A 10n +.if !"\\$1"" .nr )A \\w'\\$1'u+3n +.nr )B \\n()Au+15n +.\" +.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n +.nr )C \\n()Bu+\\w'(in/out)'u+2n +.. +.AS Tcl_Interp Tcl_CreateInterp in/out +.\" # BS - start boxed text +.\" # ^y = starting y location +.\" # ^b = 1 +.de BS +.br +.mk ^y +.nr ^b 1u +.if n .nf +.if n .ti 0 +.if n \l'\\n(.lu\(ul' +.if n .fi +.. +.\" # BE - end boxed text (draw box now) +.de BE +.nf +.ti 0 +.mk ^t +.ie n \l'\\n(^lu\(ul' +.el \{\ +.\" Draw four-sided box normally, but don't draw top of +.\" box if the box started on an earlier page. +.ie !\\n(^b-1 \{\ +\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.el \}\ +\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul' +.\} +.\} +.fi +.br +.nr ^b 0 +.. +.\" # VS - start vertical sidebar +.\" # ^Y = starting y location +.\" # ^v = 1 (for troff; for nroff this doesn't matter) +.de VS +.if !"\\$2"" .br +.mk ^Y +.ie n 'mc \s12\(br\s0 +.el .nr ^v 1u +.. +.\" # VE - end of vertical sidebar +.de VE +.ie n 'mc +.el \{\ +.ev 2 +.nf +.ti 0 +.mk ^t +\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n' +.sp -1 +.fi +.ev +.\} +.nr ^v 0 +.. +.\" # Special macro to handle page bottom: finish off current +.\" # box/sidebar if in box/sidebar mode, then invoked standard +.\" # page bottom macro. +.de ^B +.ev 2 +'ti 0 +'nf +.mk ^t +.if \\n(^b \{\ +.\" Draw three-sided box if this is the box's first page, +.\" draw two sides but no top otherwise. +.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c +.\} +.if \\n(^v \{\ +.nr ^x \\n(^tu+1v-\\n(^Yu +\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c +.\} +.bp +'fi +.ev +.if \\n(^b \{\ +.mk ^y +.nr ^b 2 +.\} +.if \\n(^v \{\ +.mk ^Y +.\} +.. +.\" # DS - begin display +.de DS +.RS +.nf +.sp +.. +.\" # DE - end display +.de DE +.fi +.RE +.sp +.. +.\" # SO - start of list of standard options +.de SO +'ie '\\$1'' .ds So \\fBoptions\\fR +'el .ds So \\fB\\$1\\fR +.SH "STANDARD OPTIONS" +.LP +.nf +.ta 5.5c 11c +.ft B +.. +.\" # SE - end of list of standard options +.de SE +.fi +.ft R +.LP +See the \\*(So manual entry for details on the standard options. +.. +.\" # OP - start of full description for a single option +.de OP +.LP +.nf +.ta 4c +Command-Line Name: \\fB\\$1\\fR +Database Name: \\fB\\$2\\fR +Database Class: \\fB\\$3\\fR +.fi +.IP +.. +.\" # CS - begin code excerpt +.de CS +.RS +.nf +.ta .25i .5i .75i 1i +.. +.\" # CE - end code excerpt +.de CE +.fi +.RE +.. +.\" # UL - underline word +.de UL +\\$1\l'|0\(ul'\\$2 +.. +.\" # QW - apply quotation marks to word +.de QW +.ie '\\*(lq'"' ``\\$1''\\$2 +.\"" fix emacs highlighting +.el \\*(lq\\$1\\*(rq\\$2 +.. +.\" # PQ - apply parens and quotation marks to word +.de PQ +.ie '\\*(lq'"' (``\\$1''\\$2)\\$3 +.\"" fix emacs highlighting +.el (\\*(lq\\$1\\*(rq\\$2)\\$3 +.. +.\" # QR - quoted range +.de QR +.ie '\\*(lq'"' ``\\$1''\\-``\\$2''\\$3 +.\"" fix emacs highlighting +.el \\*(lq\\$1\\*(rq\\-\\*(lq\\$2\\*(rq\\$3 +.. +.\" # MT - "empty" string +.de MT +.QW "" +.. +.BS +.SH NAME +widgetPlus \- Enhanced Entry, Spinbox, and Combobox Widgets with Undo/Redo and other useful features +.SH SYNOPSIS +package require \fBTcl 8\&.5\fR +.sp +package require \fBTk 8\&.5\fR +.sp +package require \fBsnit \fR +.sp +package require \fBwidgetPlus ?1\&.0?\fR +.sp +\fBwidgetPlus::entryPlus\fR ?\fIcreate\fR? \fIpathName\fR +.sp +\fBwidgetPlus::spinboxPlus\fR ?\fIcreate\fR? \fIpathName\fR +.sp +\fBwidgetPlus::ttkEntryPlus\fR ?\fIcreate\fR? \fIpathName\fR +.sp +\fBwidgetPlus::ttkSpinboxPlus\fR ?\fIcreate\fR? \fIpathName\fR +.sp +\fBwidgetPlus::ttkComboboxPlus\fR ?\fIcreate\fR? \fIpathName\fR +.sp +\fBwidgetPlus::EnableBWidget\fR +.sp +\fIpathName\fR \fBedit\fR ?\fIarg arg \&.\&.\&.\fR? +.sp +\fIpathName\fR \fBedit canredo\fR +.sp +\fIpathName\fR \fBedit canundo\fR +.sp +\fIpathName\fR \fBedit modified\fR ?\fIboolean\fR? +.sp +\fIpathName\fR \fBedit redo\fR +.sp +\fIpathName\fR \fBedit reset\fR +.sp +\fIpathName\fR \fBedit separator\fR +.sp +\fIpathName\fR \fBedit undo\fR +.sp +.BE +.SH DESCRIPTION +The \fBwidgetPlus\fR package adds new features to the widgets \fB\fBentry\fR\fR, \fB\fBspinbox\fR\fR, \fB\fBttk::entry\fR\fR, \fB\fBttk::spinbox\fR\fR, and \fB\fBttk::combobox\fR\fR\&. +.PP +The new features are Undo and Redo operations, a \fB<>\fR event, and for the \fBTk\fR (unthemed) widgets an \fB-inactiveselectbackground\fR option, and some minor fixes to bindings\&. The new facilities closely follow those of the \fB\fBtext\fR\fR widget\&. +.PP +The revised \fB\fBentry\fR\fR, \fB\fBspinbox\fR\fR, \fB\fBttk::entry\fR\fR, \fB\fBttk::spinbox\fR\fR, and \fB\fBttk::combobox\fR\fR widgets are created by the commands \fBwidgetPlus::entryPlus\fR, \fBwidgetPlus::spinboxPlus\fR, \fBwidgetPlus::ttkEntryPlus\fR, \fBwidgetPlus::ttkSpinboxPlus\fR, and \fBwidgetPlus::ttkComboboxPlus\fR respectively\&. +.PP +For example, the \fBwidgetPlus::entryPlus\fR widget is implemented as a \fISnit\fR \fBsnit::widgetadaptor\fR that wraps a \fBTk\fR \fB\fBentry\fR\fR widget\&. Its \fBwinfo class\fR is \fBEntry\fR, and it uses a binding tag \fBEntryPlus\fR that replaces the \fBEntry\fR binding tag\&. The other widgets are implemented in a similar way\&. +.PP +The package uses the namespace \fB::widgetPlus\fR, which exports (only) the five commands defined below that begin with a lower-case letter (\fBEnableBWidget\fR is not exported)\&. These commands can be imported into the global namespace, and for simplicity, descriptive text in this manual will henceforth omit the namespace qualifier\&. +.CS + + +namespace import ::widgetPlus::* + +.CE +.SH "WIDGET OPTIONS" +In addition to the usual options of the \fB\fBentry\fR\fR, \fB\fBspinbox\fR\fR, \fB\fBttk::entry\fR\fR, \fB\fBttk::spinbox\fR\fR, and \fB\fBttk::combobox\fR\fR widgets, the wrappers \fB\fBentryPlus\fR\fR, \fB\fBspinboxPlus\fR\fR, \fB\fBttkEntryPlus\fR\fR, \fB\fBttkSpinboxPlus\fR\fR, and \fB\fBttkComboboxPlus\fR\fR provide the options below\&. +.LP +.nf +.ta 6c +Command-Line Switch: \fB\fB-inactiveselectbackground\fR\fR +Database Name: \fBinactiveSelectBackground\fR +Database Class: \fBForeground\fR + +.fi +.IP +Specifies the color to use for the selection when the window does not have the input \fBfocus\fR\&. If empty, \fB{}\fR, then no selection is shown when the window does not have the \fBfocus\fR\&. The \fB-inactiveselectbackground\fR option has no effect on the \fBTtk\fR (themed) widgets \fB\fBttkEntryPlus\fR\fR, \fB\fBttkSpinboxPlus\fR\fR, and \fB\fBttkComboboxPlus\fR\fR\&. +.LP +.nf +.ta 6c +Command-Line Switch: \fB\fB-maxundo\fR\fR +Database Name: \fBmaxUndo\fR +Database Class: \fBMaxUndo\fR + +.fi +.IP +Specifies the maximum number of compound undo actions on the \fIundo stack\fR\&. A zero or a negative value imply an unlimited \fIundo stack\fR\&. +.LP +.nf +.ta 6c +Command-Line Switch: \fB\fB-undo\fR\fR +Database Name: \fBundo\fR +Database Class: \fBUndo\fR + +.fi +.IP +Specifies a \fIboolean\fR that says whether the undo mechanism is active or not\&. +.PP +.SH COMMANDS +.TP +\fBwidgetPlus::entryPlus\fR ?\fIcreate\fR? \fIpathName\fR +Create an \fB\fBentryPlus\fR\fR widget; or convert an existing \fBentry\fR widget into an \fB\fBentryPlus\fR\fR\&. +.TP +\fBwidgetPlus::spinboxPlus\fR ?\fIcreate\fR? \fIpathName\fR +Create a \fB\fBspinboxPlus\fR\fR widget; or convert an existing \fBspinbox\fR widget into a \fB\fBspinboxPlus\fR\fR\&. +.TP +\fBwidgetPlus::ttkEntryPlus\fR ?\fIcreate\fR? \fIpathName\fR +Create a \fB\fBttkEntryPlus\fR\fR widget; or convert an existing \fBttk::entry\fR widget into a \fB\fBttkEntryPlus\fR\fR\&. +.TP +\fBwidgetPlus::ttkSpinboxPlus\fR ?\fIcreate\fR? \fIpathName\fR +Create a \fB\fBttkSpinboxPlus\fR\fR widget; or convert an existing \fBttk::spinbox\fR widget into a \fB\fBttkSpinboxPlus\fR\fR\&. +.TP +\fBwidgetPlus::ttkComboboxPlus\fR ?\fIcreate\fR? \fIpathName\fR +Create a \fB\fBttkComboboxPlus\fR\fR widget; or convert an existing \fBttk::combobox\fR widget into a \fB\fBttkComboboxPlus\fR\fR\&. +.TP +\fBwidgetPlus::EnableBWidget\fR +Enable \fBwidgetPlus\fR to modify \fBBWidget\fR \fB\fBEntry\fR\fR widgets and their compounds (such as the \fBBWidget\fR \fB\fBComboBox\fR\fR)\&. The command creates a bindtag \fBBwEntryPlus\fR to replace the default bindtag \fBBwEntry\fR\&. This operation is not performed when the package is loaded because it requires \fBBWidget\fR to be loaded first\&. This command is not exported from namespace \fB::widgetPlus\fR\&. +.PP +.SH "WIDGET COMMANDS" +In addition to the usual commands of the \fB\fBentry\fR\fR, \fB\fBspinbox\fR\fR, \fB\fBttk::entry\fR\fR, \fB\fBttk::spinbox\fR\fR, and \fB\fBttk::combobox\fR\fR widgets, the wrappers \fB\fBentryPlus\fR\fR, \fB\fBttkEntryPlus\fR\fR, \fB\fBspinboxPlus\fR\fR, \fB\fBttkSpinboxPlus\fR\fR, and \fB\fBttkComboboxPlus\fR\fR provide: +.TP +\fIpathName\fR \fBedit\fR ?\fIarg arg \&.\&.\&.\fR? +This command controls the undo mechanism and the \fImodified flag\fR\&. The exact behavior of the command depends on the option argument that follows the edit argument\&. The following forms of the command are currently supported: +.TP +\fIpathName\fR \fBedit canredo\fR +Returns a \fIboolean\fR \fBtrue\fR if redo is possible, i\&.e\&. when the \fIredo stack\fR is not empty\&. Otherwise returns \fBfalse\fR\&. +.TP +\fIpathName\fR \fBedit canundo\fR +Returns a \fIboolean\fR \fBtrue\fR if undo is possible, i\&.e\&. when the \fIundo stack\fR is not empty\&. Otherwise returns \fBfalse\fR\&. +.TP +\fIpathName\fR \fBedit modified\fR ?\fIboolean\fR? +If \fIboolean\fR is not specified, returns the \fImodified flag\fR of the widget\&. The \fBinsert\fR, \fBdelete\fR, \fBedit undo\fR and \fBedit redo\fR commands, or (by using this command) the user, can set or clear the \fImodified flag\fR\&. If \fIboolean\fR is specified, sets the \fImodified flag\fR of the widget to \fIboolean\fR\&. +.TP +\fIpathName\fR \fBedit redo\fR +When the \fB-undo\fR option is \fBtrue\fR, reapplies the last undone edits provided no other edits were done since then\&. Generates an error when the \fIredo stack\fR is empty\&. Does nothing when the \fB-undo\fR option is \fBfalse\fR\&. +.TP +\fIpathName\fR \fBedit reset\fR +Clears the \fIundo stack\fR and \fIredo stack\fR\&. +.TP +\fIpathName\fR \fBedit separator\fR +Included for completeness, but has no effect\&. +.sp +(N\&.B\&. An implicit separator is added to the \fIundo stack\fR for each call to a widget command (e\&.g\&. \fBinsert\fR or \fBdelete\fR) that changes the widget contents\&. These therefore separate the addition or removal of individual characters by typing, except that \fIcut\fR or \fIpaste\fR operations are discrete\&.) +.TP +\fIpathName\fR \fBedit undo\fR +Undoes the last edit action when the \fB-undo\fR option is \fBtrue\fR\&. An edit action is defined as a single \fBinsert\fR or \fBdelete\fR command that is recorded on the \fIundo stack\fR\&. Generates an error when the \fIundo stack\fR is empty\&. Does nothing when the \fB-undo\fR option is \fBfalse\fR\&. +.PP +.SH BINDINGS +.SS "CLASS BINDINGS" +The class binding tag for different widgets has these default values: +.IP \(bu +\fB\fBentry\fR\fR uses \fBEntry\fR +.IP \(bu +\fB\fBspinbox\fR\fR uses \fBSpinbox\fR +.IP \(bu +\fB\fBttk::entry\fR\fR uses \fBTEntry\fR +.IP \(bu +\fB\fBttk::spinbox\fR\fR uses \fBTSpinbox\fR +.IP \(bu +\fB\fBttk::combobox\fR\fR uses \fBTCombobox\fR +.IP \(bu +\fB\fBentryPlus\fR\fR uses \fBEntryPlus\fR +.IP \(bu +\fB\fBspinboxPlus\fR\fR uses \fBSpinboxPlus\fR +.IP \(bu +\fB\fBttkEntryPlus\fR\fR uses \fBTEntryPlus\fR +.IP \(bu +\fB\fBttkSpinboxPlus\fR\fR uses \fBTSpinboxPlus\fR +.IP \(bu +\fB\fBttkComboboxPlus\fR\fR uses \fBTComboboxPlus\fR +.PP +.SS "UNDO AND REDO" +The \fB<>\fR and \fB<>\fR virtual events are mapped to these keyboard events: +.IP \(bu +On X11 systems (Linux®, BSD®, Solaris®, etc): +.RS +.IP \(bu +\fB<>\fR is mapped to \fB\fR +.RE +.RS +.IP \(bu +\fB<>\fR is mapped to \fB\fR +.RE +.IP \(bu +On Windows® systems: +.RS +.IP \(bu +\fB<>\fR is mapped to \fB\fR +.RE +.RS +.IP \(bu +\fB<>\fR is mapped to \fB\fR +.RE +.IP \(bu +On Aqua® systems (i\&.e\&. Apple® macOS® or OS X®): +.RS +.IP \(bu +\fB<>\fR is mapped to \fB\fR +.RE +.RS +.IP \(bu +\fB<>\fR is mapped to \fB\fR +.RE +.PP +.SS ENTRYPLUS +The \fBEntryPlus\fR bindings are based on those of the \fBEntry\fR bindtag, with these changes: +.IP \(bu +New bindings to \fB<>\fR and \fB<>\fR\&. +.IP \(bu +An adjustment to the \fB<>\fR binding, so that it behaves the same way on X11 as on other windowing systems (i\&.e\&. it deletes the existing selection, if any exists)\&. +.IP \(bu +The removal of the antiquated \fB\fR binding\&. +.IP \(bu +New bindings to \fB\fR and \fB\fR, to facilitate the implementation of the \fB-inactiveselectbackground\fR option\&. +.PP +.SS SPINBOXPLUS +The \fBSpinboxPlus\fR bindings are based on those of the \fBSpinbox\fR bindtag, with the same changes as are made when converting \fBEntry\fR to \fBEntryPlus\fR\&. +.SS TENTRYPLUS +The \fBTEntryPlus\fR bindings are based on those of the \fBTEntry\fR bindtag, with these changes: +.IP \(bu +New bindings to \fB<>\fR and \fB<>\fR\&. +.PP +.SS TSPINBOXPLUS +The \fBTSpinboxPlus\fR bindings are based on those of the \fBTSpinbox\fR bindtag, with these changes: +.IP \(bu +New bindings to \fB<>\fR and \fB<>\fR\&. +.PP +.SS TCOMBOBOXPLUS +The \fBTComboboxPlus\fR bindings are based on those of the \fBTCombobox\fR bindtag, with these changes: +.IP \(bu +New bindings to \fB<>\fR and \fB<>\fR\&. +.PP +.SH "VIRTUAL EVENT <>" +Each \fBwidgetPlus\fR widget generates a virtual event \fB<>\fR whenever the value of its selection changes\&. This allows other \fBTcl\fR code, for example the package \fBpersistentSelection\fR, to monitor the selection in these widgets\&. +.SH "USE WITH MEGAWIDGETS" +When an \fB\fBentry\fR\fR, \fB\fBspinbox\fR\fR, \fB\fBttk::entry\fR\fR, \fB\fBttk::spinbox\fR\fR, or \fB\fBttk::combobox\fR\fR is a component of a megawidget, it is often possible to apply \fBwidgetPlus\fR to that component without modifying the megawidget code\&. +.SS "COMBOBOX (BY BRYAN OAKLEY)" +A \fB\fBcombobox\fR\fR with path \fB$w\fR includes an \fB\fBentry\fR\fR widget \fB$w\&.entry\fR, which uses the \fBEntry\fR binding tag\&. Thus \fBwidgetPlus\fR can be applied to the \fB\fBcombobox\fR\fR after creation, using the command (see \fBEXAMPLES\fR) +.CS + + +entryPlus $w\&.entry -undo 1 -maxundo 0 + +.CE +.SS "COMBOBOX (BWIDGET)" +A \fBBWidget\fR \fBComboBox\fR with path \fB$w\fR includes an \fB\fBentry\fR\fR widget \fB$w\&.e\fR, which uses the \fBBwEntry\fR binding tag in place of the default tag \fBEntry\fR\&. +.PP +Package \fBwidgetPlus\fR provides a replacement bindtag \fBBwEntryPlus\fR, but this is not computed when the package is loaded because it requires \fBBWidget\fR to be loaded first\&. The command \fB::widgetPlus::EnableBWidget\fR must be called to provide \fBBwEntryPlus\fR, and then the \fBBWidget\fR \fBComboBox\fR can be modified (see \fBEXAMPLES\fR) +.CS + + +::widgetPlus::EnableBWidget +entryPlus $w\&.e -undo 1 -maxundo 0 + +.CE +.SH "TO DO" +.IP \(bu +Undo and Redo do not sync the value of the \fImodified flag\fR - they always set the value to \fIboolean\fR \fBtrue\fR\&. +.IP \(bu +Undo and Redo do not sync the position of the insertion cursor\&. +.IP \(bu +The \fB<>\fR event is not generated\&. +.IP \(bu +Undo/Redo separators, and the \fB-autoseparators\fR option, as found in the \fB\fBtext\fR\fR widget, are not implemented\&. An implicit separator is added for each call to a widget command (e\&.g\&. \fBinsert\fR or \fBdelete\fR) that changes the widget contents\&. The \fBedit separator\fR command has no effect\&. Separator functionality would be less useful for widgets such as \fB\fBentryPlus\fR\fR than it is for a \fB\fBtext\fR\fR widget\&. +.IP \(bu +Add an \fIoverwrite\fR mode, toggled by \fB\fR on non-macOS® systems\&. +.PP +.SH BUGS +This version of \fBwidgetPlus\fR is intended to be compatible with all releases of \fBTk\fR 8\&.5 and 8\&.6, and with the branches \fIcore-8-5-branch\fR, \fIcore-8-6-branch\fR, and \fItrunk\fR in the source code repository for \fBTk\fR\&. Any incompatibility with any of these versions, for any \fBTk\fR windowing system, should be reported as a bug\&. Please report such in the category \fIwidgetPlus\fR of the \fITklib Trackers\fR [http://core\&.tcl\&.tk/tklib/reportlist]\&. +.SH EXAMPLES +To create and map an \fB\fBentryPlus\fR\fR widget \&.ep with an unlimited Undo/Redo stack: +.CS + + +package require widgetPlus +widgetPlus::entryPlus \&.ep -undo 1 -maxundo 0 +pack \&.ep + +.CE +The same but using \fBnamespace import\fR: +.CS + + +package require widgetPlus +namespace import widgetPlus::* +entryPlus \&.ep -undo 1 -maxundo 0 +pack \&.ep + +.CE +To convert an existing \fB\fBentry\fR\fR widget \&.ee into an \fB\fBentryPlus\fR\fR with an unlimited Undo/Redo stack: +.CS + + +entry \&.ee + + \&. + \&. + \&. + +package require widgetPlus +widgetPlus::entryPlus \&.ee -undo 1 -maxundo 0 + +.CE +The same but using \fBnamespace import\fR: +.CS + + +entry \&.ee + + \&. + \&. + \&. + +package require widgetPlus +namespace import widgetPlus::* +entryPlus \&.ee -undo 1 -maxundo 0 + +.CE +Apply \fBwidgetPlus\fR to a Bryan Oakley \fB\fBcombobox\fR\fR: +.CS + + +package require combobox +combobox::combobox \&.cb + + \&. + \&. + \&. + +package require widgetPlus +namespace import widgetPlus::* +entryPlus \&.cb\&.entry -undo 1 -maxundo 0 + +.CE +Apply \fBwidgetPlus\fR to a \fBBWidget\fR \fB\fBComboBox\fR\fR\&. The command \fB::widgetPlus::EnableBWidget\fR must be called first\&. +.CS + + +package require BWidget +ComboBox \&.cb + + \&. + \&. + \&. + +package require widgetPlus +::widgetPlus::EnableBWidget +namespace import widgetPlus::* + +entryPlus \&.cb\&.e -undo 1 -maxundo 0 + +.CE +.SH "SEE ALSO" +BWidget, ComboBox, Entry, entry, persistentSelection, spinbox, text, ttk::combobox, ttk::entry, ttk::spinbox diff --git a/embedded/man/files/modules/widgetl/widget_listentry.n b/embedded/man/files/modules/widgetl/widget_listentry.n index b886bb68..5cccc666 100644 --- a/embedded/man/files/modules/widgetl/widget_listentry.n +++ b/embedded/man/files/modules/widgetl/widget_listentry.n @@ -1,7 +1,7 @@ '\" '\" Generated from file 'widget_listentry\&.man' by tcllib/doctools with format 'nroff' '\" -.TH "widget_listentry" n 0\&.1 tklib "widget::listentry widget" +.TH "widget_listentry" n 0\&.1\&.2 tklib "widget::listentry widget" .\" The -*- nroff -*- definitions below are for supplemental macros used .\" in Tcl/Tk manual entries. .\" @@ -277,7 +277,7 @@ package require \fBTcl 8\&.5\fR .sp package require \fBTk 8\&.5\fR .sp -package require \fBwidget::listentry ?0\&.1?\fR +package require \fBwidget::listentry ?0\&.1\&.2?\fR .sp package require \fBwidget::validator ?0\&.1?\fR .sp @@ -586,4 +586,4 @@ Please report such in the category \fIwidget::listentry\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -data entry lists, data entry ordered list, data entry set of strings, data entry unordered list, list entry panel, set entry panel, widget \ No newline at end of file +data entry lists, data entry ordered list, data entry set of strings, data entry unordered list, list entry panel, set entry panel, widget diff --git a/embedded/man/files/modules/widgetl/widget_listsimple.n b/embedded/man/files/modules/widgetl/widget_listsimple.n index 3cd5c3c4..e3ad3004 100644 --- a/embedded/man/files/modules/widgetl/widget_listsimple.n +++ b/embedded/man/files/modules/widgetl/widget_listsimple.n @@ -1,7 +1,7 @@ '\" '\" Generated from file 'widget_listsimple\&.man' by tcllib/doctools with format 'nroff' '\" -.TH "widget_listsimple" n 0\&.1 tklib "widget::listsimple widget" +.TH "widget_listsimple" n 0\&.1\&.2 tklib "widget::listsimple widget" .\" The -*- nroff -*- definitions below are for supplemental macros used .\" in Tcl/Tk manual entries. .\" @@ -277,7 +277,7 @@ package require \fBTcl 8\&.5\fR .sp package require \fBTk 8\&.5\fR .sp -package require \fBwidget::listsimple ?0\&.1?\fR +package require \fBwidget::listsimple ?0\&.1\&.2?\fR .sp package require \fBwidget::validator ?0\&.1?\fR .sp @@ -491,4 +491,4 @@ Please report such in the category \fIwidget::listsimple\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -data entry lists, data entry set of strings, data entry unordered list, list entry panel, set entry panel, widget \ No newline at end of file +data entry lists, data entry set of strings, data entry unordered list, list entry panel, set entry panel, widget diff --git a/embedded/man/files/modules/widgetv/widget_validator.n b/embedded/man/files/modules/widgetv/widget_validator.n index 71ec0b25..a2632af0 100644 --- a/embedded/man/files/modules/widgetv/widget_validator.n +++ b/embedded/man/files/modules/widgetv/widget_validator.n @@ -401,4 +401,4 @@ Please report such in the category \fIwidget::validator\fR of the Please also report any ideas for enhancements you may have for either package and/or documentation\&. .SH KEYWORDS -invalid, state management, ttk::combobox, ttk::entry, validation, widget validation \ No newline at end of file +invalid, state management, ttk::combobox, ttk::entry, validation, widget validation diff --git a/embedded/man/index.n b/embedded/man/index.n index 1639313f..e8d0ce6e 100644 --- a/embedded/man/index.n +++ b/embedded/man/index.n @@ -1354,4 +1354,5 @@ zoom .TP \fBfiles/modules/canvas/canvas_zoom\&.n\fR canvas::zoom -.RE \ No newline at end of file +.RE +.RE diff --git a/embedded/man/toc.n b/embedded/man/toc.n index 29b9d1ad..afa45288 100644 --- a/embedded/man/toc.n +++ b/embedded/man/toc.n @@ -375,6 +375,9 @@ tklib \fBntextWordBreak\fR \fIfiles/modules/ntext/ntextWordBreak\&.n\fR: ntext Word Boundary Detection for the Text Widget .TP +\fBpersistentSelection\fR +\fIfiles/modules/persistentSelection/persistentSelection\&.n\fR: Enhanced PRIMARY selection +.TP \fBpie\fR \fIfiles/modules/tkpiechart/pie\&.n\fR: 2D or 3D pie chart object in a canvas .TP @@ -412,4 +415,7 @@ tklib \fIfiles/modules/widget/widget_toolbar\&.n\fR: Toolbar Megawidget .TP \fBwidget_validator\fR -\fIfiles/modules/widgetv/widget_validator\&.n\fR: widget::validator behaviour \ No newline at end of file +\fIfiles/modules/widgetv/widget_validator\&.n\fR: widget::validator behaviour +.TP +\fBwidgetPlus\fR +\fIfiles/modules/widgetPlus/widgetPlus\&.n\fR: Enhanced Entry, Spinbox, and Combobox Widgets with Undo/Redo and other useful features diff --git a/embedded/www/index.html b/embedded/www/index.html index 08ae419a..c4101007 100644 --- a/embedded/www/index.html +++ b/embedded/www/index.html @@ -1,7 +1,8 @@ + - - Keyword Index @@ -15,776 +16,776 @@ | Applications ]

Keyword Index

-
- 2 · A · B · C · D · E · G · H · I · L · M · N · P · Q · R · S · T · V · W · X · Z +
+ 2 · A · B · C · D · E · G · H · I · L · M · N · P · Q · R · S · T · V · W · X · Z
-
-
-Keywords: 2 +
+ - - - + + - - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - + + - - - - + + - - - + + - - - + + - - - - + + - - - - + +
+Keywords: 2
2D geometry +
2D geometry diagram
-Keywords: A +
+Keywords: A
alert +
alert notifywindow
append tag +
append tag canvas::tag
arc +
arc diagram
arrow +
arrow diagram
-Keywords: B +
+Keywords: B
background +
background canvas::gradient
balloon +
balloon tooltip
bindtags +
bindtags ntext · ntextBindings · ntextIndent · ntextWordBreak
bitmap +
bitmap bitmap-editor
box +
box diagram
bundle +
bundle widget
-Keywords: C +
+Keywords: C
calendar +
calendar widget · widget_calendar
canvas +
canvas canvas::drag · canvas::edit::points · canvas::edit::polyline · canvas::edit::quadrilateral · canvas::gradient · canvas::highlight · canvas::mvg · canvas::snap · canvas::sqmap · canvas::tag · canvas::track::lines · canvasLabel · crosshair · diagram · diagram-viewer · pie · pieBoxLabeler · piePeripheralLabeler
cell +
cell canvas::sqmap
character +
character khim
chat +
chat chatwidget
chatwidget +
chatwidget chatwidget
circle +
circle diagram
clock +
clock datefield
color gradient +
color gradient canvas::gradient
composite widget +
composite widget chatwidget
concave +
concave canvas::edit::quadrilateral
controlling +
controlling controlwidget
conversion +
conversion diagram-viewer
convex +
convex canvas::edit::quadrilateral
cross-hairs +
cross-hairs crosshair
crosshair +
crosshair canvas::track::lines
cursor +
cursor cursor
-Keywords: D +
+Keywords: D
data entry lists +
data entry lists widget_listentry · widget_listsimple
data entry ordered list +
data entry ordered list widget_listentry
data entry set of strings +
data entry set of strings widget_listentry · widget_listsimple
data entry unordered list +
data entry unordered list widget_listentry · widget_listsimple
date +
date datefield · widget_calendar · widget_dateentry
dateentry +
dateentry datefield · widget · widget_dateentry
diagram +
diagram diagram · diagram-viewer
dialog +
dialog getstring · swaplist · widget
diamond +
diamond diagram
disjointlistbox +
disjointlistbox swaplist
displaying +
displaying controlwidget
dll +
dll ico
dragging +
dragging canvas::drag
drawing +
drawing diagram
drum +
drum diagram
-Keywords: E +
+Keywords: E
editing +
editing canvas::edit::points · canvas::edit::polyline · canvas::edit::quadrilateral
editor +
editor bitmap-editor
ellipse +
ellipse diagram
enter callback +
enter callback canvas::highlight
entry +
entry datefield · getstring · history · ico · ipentry
exe +
exe ico
-Keywords: G +
+Keywords: G
gradients +
gradients canvas::gradient
graphics +
graphics canvas::mvg
grid +
grid canvas::sqmap
-Keywords: H +
+Keywords: H
help +
help tooltip
highlighting +
highlighting canvas::highlight
history +
history history
hover +
hover tooltip
-Keywords: I +
+Keywords: I
i18n +
i18n khim
ico +
ico ico
icon +
icon ico
image +
image bitmap-editor · canvas::gradient · canvas::snap · canvas::sqmap · diagram
imagemagick +
imagemagick canvas::mvg
input +
input khim
insert tag +
insert tag canvas::tag
international +
international khim
interpolation +
interpolation diagram
intersection +
intersection diagram
invalid +
invalid widget_validator
ip address +
ip address ipentry
irc +
irc chatwidget
-Keywords: L +
+Keywords: L
labeler +
labeler canvasLabel · pie · pieBoxLabeler · piePeripheralLabeler
leave callback +
leave callback canvas::highlight
line +
line diagram
list entry panel +
list entry panel widget_listentry · widget_listsimple
listbox +
listbox swaplist
location +
location crosshair
-Keywords: M +
+Keywords: M
magick vector graphics +
magick vector graphics canvas::mvg
map +
map canvas::sqmap
mega-widget +
mega-widget chatwidget
megawidget +
megawidget widget · widget_calendar · widget_dateentry · widget_toolbar
menu +
menu widget
method +
method khim
move +
move diagram
mvg +
mvg canvas::mvg
-Keywords: N +
+Keywords: N
network +
network ipentry
non-convex +
non-convex canvas::edit::quadrilateral
notification +
notification notifywindow
numerical values +
numerical values controlwidget
-Keywords: P +
+Keywords: P
panelframe +
panelframe widget
photo +
photo canvas::snap
picture +
picture diagram
pie +
pie canvasLabel · pie · pieBoxLabeler · piePeripheralLabeler
pixel +
pixel bitmap-editor
plane geometry +
plane geometry diagram
plotting +
plotting diagram
point +
point diagram
point cloud +
point cloud canvas::edit::points
points +
points canvas::edit::points
polyline +
polyline canvas::edit::polyline
print screen +
print screen canvas::mvg · canvas::snap
-Keywords: Q +
+Keywords: Q
quadrilateral +
quadrilateral canvas::edit::quadrilateral
-Keywords: R +
+Keywords: R
raster image +
raster image diagram
re_syntax +
re_syntax ntext · ntextIndent · ntextWordBreak
regexp +
regexp ntext · ntextIndent · ntextWordBreak
remove tag +
remove tag canvas::tag
rubberband +
rubberband canvas::track::lines
ruler +
ruler widget
-Keywords: S +
+Keywords: S
scale widget +
scale widget controlwidget
screenruler +
screenruler widget
scroll +
scroll autoscroll
scrollbar +
scrollbar autoscroll
scrolledwindow +
scrolledwindow widget
serialization +
serialization canvas::mvg
set entry panel +
set entry panel widget_listentry · widget_listsimple
slice +
slice canvasLabel · pie · pieBoxLabeler · piePeripheralLabeler
snapshot +
snapshot canvas::snap
snit +
snit widget · widget_calendar · widget_dateentry · widget_toolbar
spline +
spline diagram
square map +
square map canvas::sqmap
state management +
state management widget_validator
statusbar +
statusbar widget
string +
string getstring
superframe +
superframe widget
syntax highlighting +
syntax highlighting ctext
-Keywords: T +
+Keywords: T
tags +
tags canvas::tag
text +
text ctext · diagram · ntext · ntextBindings · ntextIndent · ntextWordBreak
tile +
tile canvas::sqmap
tk +
tk notifywindow
toolbar +
toolbar widget · widget_toolbar
tooltip +
tooltip tooltip
tracking +
tracking canvas::track::lines · crosshair
ttk::combobox +
ttk::combobox widget_validator
ttk::entry +
ttk::entry widget_validator
-Keywords: V +
+Keywords: V
validation +
validation widget_validator
vector +
vector diagram · diagram-viewer
vector graphics +
vector graphics canvas::mvg
viewport +
viewport crosshair
-Keywords: W +
+Keywords: W
widget +
widget chatwidget · ctext · datefield · widget · widget_calendar · widget_dateentry · widget_listentry · widget_listsimple · widget_toolbar
widget background +
widget background canvas::gradient
widget validation +
widget validation widget_validator
-Keywords: X +
+Keywords: X
xbm +
xbm bitmap-editor
-Keywords: Z +
+Keywords: Z
zoom +
zoom canvas::zoom
diff --git a/embedded/www/tklib/files/apps/bitmap-editor.html b/embedded/www/tklib/files/apps/bitmap-editor.html index 0593af40..a75249cc 100644 --- a/embedded/www/tklib/files/apps/bitmap-editor.html +++ b/embedded/www/tklib/files/apps/bitmap-editor.html @@ -1,5 +1,4 @@ - - + bitmap-editor - Bitmap handling - - - -
-
[ +
[ Tklib Home | Main Table Of Contents | Table Of Contents @@ -108,46 +106,47 @@ | Modules | Applications ]
-

bitmap-editor(n) 1.0 tklib "Bitmap handling"

-

Name

+
+

bitmap-editor(n) 1.0 tklib "Bitmap handling"

+

Name

bitmap-editor - Editor for XBM images

-

Table Of Contents

-
    -
  • Table Of Contents
  • -
  • Synopsis
  • -
  • Description + -

    Synopsis

    -
    -
      + -

      Description

      +

      Description

      The application described by this document, bitmap-editor, is a simple editor for XBM based bitmap images. Written by Keith Vetter the original code can be found at http://wiki.tcl.tk/6298.

      -

      COMMAND LINE

      -
      +

      COMMAND LINE

      +
      bitmap-editor ?xbmfile?

      Invoked without argument the editor GUI will be opened and show a standard bitmap to edit. Invoked with an argument it is expected to be the path to a bitmap file in XBM format, and the contained bitmap is shown.

      -
      +
      path xbmfile (in/out)

      This argument specifies the path to a bitmap file in XBM format, whose contents is to shown and edited by the application.

      @@ -155,7 +154,7 @@

      bitmap-editor(n) 1.0 tklib "Bitmap handling"

      -

      BUGS, IDEAS, FEEDBACK

      +

      BUGS, IDEAS, FEEDBACK

      This document, and the application it describes, will undoubtedly contain bugs and other problems. Please report such in the category bitmap of the @@ -163,7 +162,7 @@

      bitmap-editor(n) 1.0 tklib "Bitmap handling"

      Please also report any ideas for enhancements you may have for either application and/or documentation.

      -

      Bugs, Ideas, Feedback

      +

      Bugs, Ideas, Feedback

      This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category bitmap-editor of the @@ -171,13 +170,13 @@

      bitmap-editor(n) 1.0 tklib "Bitmap handling"

      Please also report any ideas for enhancements you may have for either package and/or documentation.

      -

      Keywords

      -

      bitmap, editor, image, pixel, xbm

      + -

      Category

      +

      Category

      Image processing

      - diff --git a/embedded/www/tklib/files/apps/diagram-viewer.html b/embedded/www/tklib/files/apps/diagram-viewer.html index 46c2df1a..b971f599 100644 --- a/embedded/www/tklib/files/apps/diagram-viewer.html +++ b/embedded/www/tklib/files/apps/diagram-viewer.html @@ -1,5 +1,4 @@ - - + diagram-viewer - Documentation toolbox - - - -
      -
      [ +
      [ Tklib Home | Main Table Of Contents | Table Of Contents @@ -108,50 +106,51 @@ | Modules | Applications ]
      -

      diagram-viewer(n) 1.0 tklib "Documentation toolbox"

      -

      Name

      +
      +

      diagram-viewer(n) 1.0 tklib "Documentation toolbox"

      +

      Name

      diagram-viewer - Lightweight Diagram Processor

      -

      Table Of Contents

      -
        -
      • Table Of Contents
      • -
      • Synopsis
      • -
      • Description + -

        Synopsis

        -
        -
          + -

          Description

          +

          Description

          The application described by this document, diagram-viewer, is a lightweight processor for tklib diagram files

          diagram-viewer is based upon the package diagram. See it for examples and language reference.

          -

          USE CASES

          +

          USE CASES

          diagram-viewer was written with the following two use cases in mind.

          -
            +
            1. Processing and display of one or more diagram files.

            2. Batch conversion of one or more diagram files into raster image files.

          -

          COMMAND LINE

          -
          +

          COMMAND LINE

          +
          diagram-viewer show inputfile...

          This is the form for use case [1]. The application opens a gui showing the list of input files to the left, allowing the user to @@ -159,7 +158,7 @@

          diagram-viewer(n) 1.0 tklib "Documentation toolbox"<
          diagram-viewer convert -o output format inputfile...

          This is the form for use case [2]. The application converts the input files into raster image of the specified format.

          -
          +
          path output (in)

          This argument specifies where to write the generated image. It can be the path to a file or directory.

          @@ -177,12 +176,12 @@

          diagram-viewer(n) 1.0 tklib "Documentation toolbox"< package img::format

          path inputfile (in)

          This argument specifies the path to the diagram file to process. It -has to exist, must be readable, and written in diagram format.

          +has to exist, must be readable, and written in diagram format.

          -

          BUGS, IDEAS, FEEDBACK

          +

          BUGS, IDEAS, FEEDBACK

          This document, and the application it describes, will undoubtedly contain bugs and other problems. Please report such in the category diagram of the @@ -190,7 +189,7 @@

          diagram-viewer(n) 1.0 tklib "Documentation toolbox"< Please also report any ideas for enhancements you may have for either application and/or documentation.

          -

          Bugs, Ideas, Feedback

          +

          Bugs, Ideas, Feedback

          This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category diagram of the @@ -198,13 +197,13 @@

          diagram-viewer(n) 1.0 tklib "Documentation toolbox"< Please also report any ideas for enhancements you may have for either package and/or documentation.

          -

          Keywords

          -

          canvas, conversion, diagram, vector

          + -

          Category

          +

          Category

          Documentation tools

          - diff --git a/embedded/www/tklib/files/modules/autoscroll/autoscroll.html b/embedded/www/tklib/files/modules/autoscroll/autoscroll.html index b1d3f958..26b5dc04 100644 --- a/embedded/www/tklib/files/modules/autoscroll/autoscroll.html +++ b/embedded/www/tklib/files/modules/autoscroll/autoscroll.html @@ -1,5 +1,4 @@ - - + autoscroll - Automatic mapping of scrollbars - - -
          -
          [ +
          [ Tklib Home | Main Table Of Contents | Table Of Contents @@ -106,26 +104,27 @@ | Modules | Applications ]
          -

          autoscroll(n) 1.1 tklib "Automatic mapping of scrollbars"

          -

          Name

          +
          +

          autoscroll(n) 1.1 tklib "Automatic mapping of scrollbars"

          +

          Name

          autoscroll - Provides for a scrollbar to automatically mapped and unmapped as needed

          -

          Table Of Contents

          -
            -
          • Table Of Contents
          • -
          • Synopsis
          • -
          • Description
          • -
          • Bugs, Ideas, Feedback
          • -
          • Keywords
          • + -

            Synopsis

            -
            -
              +

              Synopsis

              +
              +
              • package require Tcl
              • package require autoscroll ?1.1?
              -
              -

              Description

              +

              Description

              This package allows scrollbars to be mapped and unmapped as needed depending on the size and content of the scrollbars scrolled widget. The @@ -150,7 +149,7 @@

              autoscroll(n) 1.1 tklib "Automatic mapping of scrollbars& as long as it supports the set subcommand in the same style as scrollbar. If the set subcommand is not used then this package will have no effect.

              -
              +
              ::autoscroll::autoscroll scrollbar

              Arranges for the already existing scrollbar scrollbar to be mapped and unmapped as needed.

              @@ -163,7 +162,7 @@

              autoscroll(n) 1.1 tklib "Automatic mapping of scrollbars&

              Turns off the automatic autoscrolling of all new scrollbars. Does not effect existing scrollbars

              -
              +
               text .t -yscrollcommand ".scrolly set"
               scrollbar .scrolly -orient v -command ".t yview"
               pack .scrolly -side right -fill y
              @@ -171,7 +170,7 @@ 

              autoscroll(n) 1.1 tklib "Automatic mapping of scrollbars& ::autoscroll::autoscroll .scrolly

              -

              Bugs, Ideas, Feedback

              +

              Bugs, Ideas, Feedback

              This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category autoscroll of the @@ -179,7 +178,7 @@

              autoscroll(n) 1.1 tklib "Automatic mapping of scrollbars& Please also report any ideas for enhancements you may have for either package and/or documentation.

              - diff --git a/embedded/www/tklib/files/modules/canvas/canvas_drag.html b/embedded/www/tklib/files/modules/canvas/canvas_drag.html index defef828..d2bad4aa 100644 --- a/embedded/www/tklib/files/modules/canvas/canvas_drag.html +++ b/embedded/www/tklib/files/modules/canvas/canvas_drag.html @@ -1,5 +1,4 @@ - - + canvas::drag - Variations on a canvas - - -
              -
              [ +
              [ Tklib Home | Main Table Of Contents | Table Of Contents @@ -106,33 +104,34 @@ | Modules | Applications ]
              -

              canvas::drag(n) 0.1 tklib "Variations on a canvas"

              -

              Name

              +
              +

              canvas::drag(n) 0.1 tklib "Variations on a canvas"

              +

              Name

              canvas::drag - Manage the dragging of canvas items or item groups

              -

              Table Of Contents

              -
                -
              • Table Of Contents
              • -
              • Synopsis
              • -
              • Description
              • -
              • API + -

                Synopsis

                -
                -
                  +

                  Synopsis

                  +
                  +
                  • package require Tcl 8.5
                  • package require Tk 8.5
                  • package require canvas::drag ?0.1?
                  -
                  -

                  Description

                  +

                  Description

                  This package provides utility commands to setup and rmeove dragging of items or item groups on a canvas, hiding all complexity regarding bindings from the user.

                  -

                  API

                  -
                  +

                  API

                  +
                  ::canvas::drag on canvas tagOrId cmd option...

                  This command initializes item dragging on the canvas widget, with the items used as drag handles identified by tagOrId. @@ -176,7 +175,7 @@

                  canvas::drag(n) 0.1 tklib "Variations on a canvas"It uses an internal standard callback for this. The callback cmd specified has the same signature as the Drag callback, except that

                  -
                    +
                    1. The move method is not invoked.

                    2. The result of the start method has to be a canvas tag refering to the whole group of items to move. In other words, @@ -184,10 +183,10 @@

                      canvas::drag(n) 0.1 tklib "Variations on a canvas"

                      The result of the command is the empty string.

                  -

                  Drag callback

                  +

                  Drag callback

                  The drag callback is a command prefix invoked in the following two ways:

                  -
                  +
                  {*}cmd start canvas item

                  This form is invoked when has initiated dragging using drag handle identified by the canvas item id. @@ -213,27 +212,27 @@

                  canvas::drag(n) 0.1 tklib "Variations on a canvas"The result of the command is ignored.

                  -

                  Options

                  +

                  Options

                  The commands to create drag operations (on, item, and group) all accept the following options to configure the new drag.

                  -
                  +
                  -event spec

                  The value of this option specifies the mouse button used to initiate the drag operation, and the keyboard modifier, if any. Examples of specifications:

                  To initiate a drag operation by pressing mouse button 3 on a drag handle, use:

                  -
                   -event 3 
                  +
                   -event 3 

                  This is the default as well, if the option is not specified.

                  To initiate a drag operation by pressing mouse button 2 on a drag handle while holding down the Control key, use:

                  -
                   -event Control-2 
                  +
                   -event Control-2 
                  -

                  Bugs, Ideas, Feedback

                  +

                  Bugs, Ideas, Feedback

                  This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the @@ -241,7 +240,7 @@

                  canvas::drag(n) 0.1 tklib "Variations on a canvas"

                  - diff --git a/embedded/www/tklib/files/modules/canvas/canvas_epoints.html b/embedded/www/tklib/files/modules/canvas/canvas_epoints.html index 3eda130e..7465f805 100644 --- a/embedded/www/tklib/files/modules/canvas/canvas_epoints.html +++ b/embedded/www/tklib/files/modules/canvas/canvas_epoints.html @@ -1,5 +1,4 @@ - - + canvas::edit::points - Variations on a canvas - - -
                  -
                  [ +
                  [ Tklib Home | Main Table Of Contents | Table Of Contents @@ -106,30 +104,31 @@ | Modules | Applications ]
                  -

                  canvas::edit::points(n) 0.1 tklib "Variations on a canvas"

                  -

                  Name

                  +
                  +

                  canvas::edit::points(n) 0.1 tklib "Variations on a canvas"

                  +

                  Name

                  canvas::edit::points - Editing a cloud of points on a canvas

                  -

                  Table Of Contents

                  -
                    -
                  • Table Of Contents
                  • -
                  • Synopsis
                  • -
                  • Description
                  • -
                  • Class API
                  • -
                  • Instance API
                  • -
                  • Options
                  • -
                  • Bugs, Ideas, Feedback
                  • -
                  • Keywords
                  • + -

                    Synopsis

                    -
                    -
                      +

                      Synopsis

                      +
                      +
                      • package require Tcl 8.5
                      • package require Tk 8.5
                      • package require canvas::edit::points ?0.1?
                      -
                      -

                      Description

                      +

                      Description

                      This package provides a class whose instances handle editing a cloud of point markers on a canvas. Instances can be configured with regard to the visual appearance of markers (regular, and highlighted). Note that instances do not store the edited points themselves, but delegate this to a configurable object.

                      -

                      Class API

                      -
                      +

                      Class API

                      +
                      ::canvas::edit points objectName canvas options...

                      This, the class command, creates and configures a new instance of a point cloud editor, named objectName. The instance will be @@ -167,9 +166,9 @@

                      canvas::edit::points(n) 0.1 tklib "Variations on a canvas the section Options.

                      -

                      Instance API

                      +

                      Instance API

                      Instances of the point cloud editors provide the following API:

                      -
                      +
                      objectName destroy

                      This method destroys the point cloud editor and releases all its internal resources.

                      @@ -211,9 +210,9 @@

                      canvas::edit::points(n) 0.1 tklib "Variations on a canvas when the user interactively removes a point, i.e. -data-cmd.

                      -

                      Options

                      +

                      Options

                      The class command accepts the following options

                      -
                      +
                      -tag string

                      The value of this option is the name of the canvas tag with which to identify all items of all points managed by the editor.

                      @@ -227,7 +226,7 @@

                      canvas::edit::points(n) 0.1 tklib "Variations on a canvas black-bordered blue circle of radius 3 centered on the location of the new point.

                      The signature of this command prefix is

                      -
                      +
                      createCmd canvas x y

                      The result of the command prefix must be a list of the canvas items it created to represent the marker. Note here that the visual @@ -244,7 +243,7 @@

                      canvas::edit::points(n) 0.1 tklib "Variations on a canvas the item to highlight in red (and restores the color for unhighlighting).

                      The two signatures of this command prefix are

                      -
                      +
                      highlightCmd on canvas item

                      This method of the command prefix has to perform whatever is needed to highlight the point the item is a part of (remember @@ -268,7 +267,7 @@

                      canvas::edit::points(n) 0.1 tklib "Variations on a canvas

                      If not specified it defaults to an empty string and is ignored by the editor, i.e. not invoked.

                      The signatures of this command prefix are

                      -
                      +
                      dataCmd add editorObj id x y

                      This callback is invoked when a new point was added to the instance, either interactively, or programmatically. @@ -312,7 +311,7 @@

                      canvas::edit::points(n) 0.1 tklib "Variations on a canvas

                      -

                      Bugs, Ideas, Feedback

                      +

                      Bugs, Ideas, Feedback

                      This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the @@ -320,7 +319,7 @@

                      canvas::edit::points(n) 0.1 tklib "Variations on a canvas Please also report any ideas for enhancements you may have for either package and/or documentation.

                      - diff --git a/embedded/www/tklib/files/modules/canvas/canvas_epolyline.html b/embedded/www/tklib/files/modules/canvas/canvas_epolyline.html index 2c1bb0ff..b609f56a 100644 --- a/embedded/www/tklib/files/modules/canvas/canvas_epolyline.html +++ b/embedded/www/tklib/files/modules/canvas/canvas_epolyline.html @@ -1,5 +1,4 @@ - - + canvas::edit::polyline - Variations on a canvas - - -
                      -
                      [ +
                      [ Tklib Home | Main Table Of Contents | Table Of Contents @@ -106,31 +104,32 @@ | Modules | Applications ]
                      -

                      canvas::edit::polyline(n) 0.1 tklib "Variations on a canvas"

                      -

                      Name

                      +
                      +

                      canvas::edit::polyline(n) 0.1 tklib "Variations on a canvas"

                      +

                      Name

                      canvas::edit::polyline - Editing a polyline on a canvas

                      -

                      Table Of Contents

                      -
                        -
                      • Table Of Contents
                      • -
                      • Synopsis
                      • -
                      • Description
                      • -
                      • Class API
                      • -
                      • Instance API
                      • -
                      • Options
                      • -
                      • Bugs, Ideas, Feedback
                      • -
                      • Keywords
                      • + -

                        Synopsis

                        -
                        -
                          +

                          Synopsis

                          +
                          +
                          • package require Tcl 8.5
                          • package require Tk 8.5
                          • package require canvas::edit::points ?0.1?
                          • package require canvas::edit::polyline ?0.1?
                          -
                          -

                          Description

                          +

                          Description

                          This package provides a class whose instances handle editing a single poly-line on a canvas. Instances can be configured with regard to the visual appearance (regular, and highlighted) of the markers denoting the line's vertices. Note that instances do not store the edited polyline themselves, but delegate this to a configurable object.

                          -

                          Class API

                          -
                          +

                          Class API

                          +
                          ::canvas::edit polyline objectName canvas options...

                          This, the class command, creates and configures a new instance of a polyline editor, named objectName. The instance will be @@ -164,9 +163,9 @@

                          canvas::edit::polyline(n) 0.1 tklib "Variations on a canv the section Options.

                          -

                          Instance API

                          +

                          Instance API

                          Instances of the polyline editors provide the following API:

                          -
                          +
                          objectName destroy

                          This method destroys the polyline editor and releases all its internal resources.

                          @@ -211,9 +210,9 @@

                          canvas::edit::polyline(n) 0.1 tklib "Variations on a canv when the user interactively removes a vertex, i.e. -data-cmd.

                          -

                          Options

                          +

                          Options

                          The class command accepts the following options

                          -
                          +
                          -tag string

                          The value of this option is the name of the canvas tag with which to identify all items of all vertices managed by the editor.

                          @@ -227,7 +226,7 @@

                          canvas::edit::polyline(n) 0.1 tklib "Variations on a canv black-bordered blue circle of radius 3 centered on the location of the new point.

                          The signature of this command prefix is

                          -
                          +
                          createCmd canvas x y

                          The result of the command prefix must be a list of the canvas items it created to represent the marker. Note here that the visual @@ -244,7 +243,7 @@

                          canvas::edit::polyline(n) 0.1 tklib "Variations on a canv the item to highlight in red (and restores the color for unhighlighting).

                          The two signatures of this command prefix are

                          -
                          +
                          highlightCmd on canvas item

                          This method of the command prefix has to perform whatever is needed to highlight the vertex the item is a part of (remember @@ -269,7 +268,7 @@

                          canvas::edit::polyline(n) 0.1 tklib "Variations on a canv

                          If not specified it defaults to an empty string and is ignored by the editor, i.e. not invoked.

                          The signature of this command prefix is

                          -
                          +
                          dataCmd editorObj coordinates

                          This callback is invoked when the line was changed either interactively, or programmatically. @@ -281,7 +280,7 @@

                          canvas::edit::polyline(n) 0.1 tklib "Variations on a canv

                          -

                          Bugs, Ideas, Feedback

                          +

                          Bugs, Ideas, Feedback

                          This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the @@ -289,7 +288,7 @@

                          canvas::edit::polyline(n) 0.1 tklib "Variations on a canv Please also report any ideas for enhancements you may have for either package and/or documentation.

                          - diff --git a/embedded/www/tklib/files/modules/canvas/canvas_equad.html b/embedded/www/tklib/files/modules/canvas/canvas_equad.html index 8c45138f..13c35fdd 100644 --- a/embedded/www/tklib/files/modules/canvas/canvas_equad.html +++ b/embedded/www/tklib/files/modules/canvas/canvas_equad.html @@ -1,5 +1,4 @@ - - + canvas::edit::quadrilateral - Variations on a canvas - - -
                          -
                          [ +
                          [ Tklib Home | Main Table Of Contents | Table Of Contents @@ -106,31 +104,32 @@ | Modules | Applications ]
                          -

                          canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a canvas"

                          -

                          Name

                          +
                          +

                          canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a canvas"

                          +

                          Name

                          canvas::edit::quadrilateral - Editing a quadrilateral on a canvas

                          -

                          Table Of Contents

                          -
                            -
                          • Table Of Contents
                          • -
                          • Synopsis
                          • -
                          • Description
                          • -
                          • Class API
                          • -
                          • Instance API
                          • -
                          • Options
                          • -
                          • Bugs, Ideas, Feedback
                          • -
                          • Keywords
                          • + -

                            Synopsis

                            -
                            -
                              +

                              Synopsis

                              +
                              +
                              • package require Tcl 8.5
                              • package require Tk 8.5
                              • package require canvas::edit::points ?0.1?
                              • package require canvas::edit::quadrilateral ?0.1?
                              -
                              -

                              Description

                              +

                              Description

                              This package provides a class whose instances handle the editing of a quadrilateral on a canvas. Instances can be configured with regard to the visual appearance (regular, and highlighted) of vertex markers. Note that instances do not store the edited quadrilateral themselves, but delegate this to a configurable object.

                              -

                              Class API

                              -
                              +

                              Class API

                              +
                              ::canvas::edit quadrilateral objectName canvas options...

                              This, the class command, creates and configures a new instance of a quadrilateral editor, named objectName. The instance will be @@ -164,9 +163,9 @@

                              canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a the section Options.

                              -

                              Instance API

                              +

                              Instance API

                              Instances of the quadrilateral editors provide the following API:

                              -
                              +
                              objectName destroy

                              This method destroys the quadrilateral editor and releases all its internal resources.

                              @@ -210,9 +209,9 @@

                              canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a when the user interactively removes a vertex, i.e. -data-cmd.

                              -

                              Options

                              +

                              Options

                              The class command accepts the following options

                              -
                              +
                              -convex boolean

                              The value of this option is a boolean flag. When the flag is set the editor will accept only convex quadrilaterals and reject all @@ -233,7 +232,7 @@

                              canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a black-bordered blue circle of radius 3 centered on the location of the new point.

                              The signature of this command prefix is

                              -
                              +
                              createCmd canvas x y

                              The result of the command prefix must be a list of the canvas items it created to represent the marker. Note here that the visual @@ -248,7 +247,7 @@

                              canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a the item to highlight in red (and restores the color for unhighlighting).

                              The two signatures of this command prefix are

                              -
                              +
                              highlightCmd on canvas item

                              This method of the command prefix has to perform whatever is needed to highlight the vertex the item is a part of (remember @@ -273,7 +272,7 @@

                              canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a

                              If not specified it defaults to an empty string and is ignored by the editor, i.e. not invoked.

                              The signatures of this command prefix are

                              -
                              +
                              dataCmd editorObj coordinates

                              This callback is invoked when the quarilateral was changed either interactively, or programmatically. @@ -285,7 +284,7 @@

                              canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a

                              -

                              Bugs, Ideas, Feedback

                              +

                              Bugs, Ideas, Feedback

                              This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the @@ -293,7 +292,7 @@

                              canvas::edit::quadrilateral(n) 0.1 tklib "Variations on a Please also report any ideas for enhancements you may have for either package and/or documentation.

                              - diff --git a/embedded/www/tklib/files/modules/canvas/canvas_gradient.html b/embedded/www/tklib/files/modules/canvas/canvas_gradient.html index 9250cfa1..db6a1707 100644 --- a/embedded/www/tklib/files/modules/canvas/canvas_gradient.html +++ b/embedded/www/tklib/files/modules/canvas/canvas_gradient.html @@ -1,5 +1,4 @@ - - + canvas::gradient - Variations on a canvas - - - -
                              -
                              [ +
                              [ Tklib Home | Main Table Of Contents | Table Of Contents @@ -108,58 +106,59 @@ | Modules | Applications ]
                              -

                              canvas::gradient(n) 0.2 tklib "Variations on a canvas"

                              -

                              Name

                              +
                              +

                              canvas::gradient(n) 0.2 tklib "Variations on a canvas"

                              +

                              Name

                              canvas::gradient - Canvas with a gradient background

                              -

                              Table Of Contents

                              -
                                -
                              • Table Of Contents
                              • -
                              • Synopsis
                              • -
                              • Description
                              • -
                              • API + -

                                Synopsis

                                -
                                -
                                  +

                                  Synopsis

                                  +
                                  +
                                  • package require Tcl 8.5
                                  • package require Tk 8.5
                                  • package require canvas::gradient ?0.2?
                                  -
                                  -

                                  Description

                                  +

                                  Description

                                  This package provides a command to set background gradients on canvases.

                                  NOTE! This package reserves the canvas tag canvas::gradient for its use.

                                  -

                                  API

                                  -
                                  +

                                  API

                                  +
                                  ::canvas::gradient pathName ?options?...

                                  Creates a background gradient on the canvas pathName. An existing gradient is replaced by the new definition.

                                  The set of available options is decribed below, in section Options.

                                  -

                                  Options

                                  -
                                  +

                                  Options

                                  +
                                  -direction direction

                                  The value for this option specifies the direction of the gradient. If not specified the system defaults to x, a horizontal gradient. The package supports five directions:

                                  -
                                  +
                                  x

                                  for a horizontal gradient (default). Color changes along the x-axis, @@ -191,22 +190,22 @@

                                  canvas::gradient(n) 0.2 tklib "Variations on a canvas&quo

                                  The value for this option specifies how the gradient is calculated. The package currently supports on ly one method, which is the default, naturally:

                                  -
                                  +
                                  linear

                                  for linear interpolation between the start and end colors (default).

                                  -

                                  Example

                                  -
                                  +

                                  Example

                                  +
                                   	package require canvas::gradient
                                   	canvas .c
                                   	canvas::gradient .c -direction x -color1 yellow -color2 blue
                                   	pack .c -fill both -expand 1
                                   
                                  -

                                  Bugs, Ideas, Feedback

                                  +

                                  Bugs, Ideas, Feedback

                                  This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the @@ -214,10 +213,10 @@

                                  canvas::gradient(n) 0.2 tklib "Variations on a canvas&quo Please also report any ideas for enhancements you may have for either package and/or documentation.

                                  -

                                  Keywords

                                  -

                                  background, canvas, color gradient, gradients, image, widget background

                                  + -
-
By Type
-
Applications
- - - - - - - - + +
By Type
+
Applications
+
bitmap-editorEditor for XBM images
diagram-viewerLightweight Diagram Processor
+ + + + + + +
bitmap-editorEditor for XBM images
diagram-viewerLightweight Diagram Processor
-
Modules
-
autoscroll
- - - - +
Modules
+
autoscroll
+
autoscrollProvides for a scrollbar to automatically mapped and unmapped as needed
+ + +
autoscrollProvides for a scrollbar to automatically mapped and unmapped as needed
-
canvas
- - - - +
canvas
+
canvas::dragManage the dragging of canvas items or item groups
+ + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
canvas::dragManage the dragging of canvas items or item groups
canvas::edit::pointsEditing a cloud of points on a canvas
canvas::edit::pointsEditing a cloud of points on a canvas
canvas::edit::polylineEditing a polyline on a canvas
canvas::edit::polylineEditing a polyline on a canvas
canvas::edit::quadrilateralEditing a quadrilateral on a canvas
canvas::edit::quadrilateralEditing a quadrilateral on a canvas
canvas::gradientCanvas with a gradient background
canvas::gradientCanvas with a gradient background
canvas::highlightManage the highlighting of canvas items or item groups
canvas::highlightManage the highlighting of canvas items or item groups
canvas::mvgCanvas to ImageMagick MVG vector format
canvas::mvgCanvas to ImageMagick MVG vector format
canvas::snapCanvas snapshot to Tk photo image
canvas::snapCanvas snapshot to Tk photo image
canvas::sqmapCanvas with map background based on square tiles
canvas::sqmapCanvas with map background based on square tiles
canvas::tagEasier management of the tags on canvas items or item groups
canvas::tagEasier management of the tags on canvas items or item groups
canvas::track::linesManage a group of rubber band lines
canvas::track::linesManage a group of rubber band lines
canvas::zoomZoom control for canvas::sqmap
canvas::zoomZoom control for canvas::sqmap
-
chatwidget
- - - - +
chatwidget
+
chatwidgetProvides a multi-paned view suitable for display of chat room or irc channel information
+ + +
chatwidgetProvides a multi-paned view suitable for display of chat room or irc channel information
-
controlwidget
- - - - +
controlwidget
+
controlwidgetCollection of widgets for displaying and controlling numerical values
+ + +
controlwidgetCollection of widgets for displaying and controlling numerical values
-
crosshair
- - - - +
crosshair
+
crosshairCrosshairs for Tk canvas
+ + +
crosshairCrosshairs for Tk canvas
-
ctext
- - - - +
ctext
+
ctextCtext a text widget with highlighting support
+ + +
ctextCtext a text widget with highlighting support
-
cursor
- - - - +
cursor
+
cursorProcedures to handle CURSOR data
+ + +
cursorProcedures to handle CURSOR data
-
datefield
- - - - +
datefield
+
datefieldTk datefield widget
+ + +
datefieldTk datefield widget
-
diagrams
- - - - +
diagrams
+
diagramDiagram drawing
+ + +
diagramDiagram drawing
-
getstring
- - - - +
getstring
+
getstringA string dialog
+ + +
getstringA string dialog
-
history
- - - - +
history
+
historyProvides a history for Entry widgets
+ + +
historyProvides a history for Entry widgets
-
ico
- - - - +
ico
+
icoReading and writing windows icons
+ + +
icoReading and writing windows icons
-
ipentry
- - - - +
ipentry
+
ipentryAn IP address entry widget
+ + +
ipentryAn IP address entry widget
-
khim
- - - - +
khim
+
khimProvides key bindings for entering international characters on a keyboard that does not support them
+ + +
khimProvides key bindings for entering international characters on a keyboard that does not support them
-
menubar
- - - - +
menubar
+
menubarCreates an instance of the Class.
+ + +
menubarCreates an instance of the Class.
-
notifywindow
- - - - +
notifywindow
+
notifywindowProvides unobtrusive window for alerts/notifications from Tk applications
+ + +
notifywindowProvides unobtrusive window for alerts/notifications from Tk applications
-
ntext
- - - - +
ntext
+
ntextAlternative Bindings for the Text Widget
+ + + - - - + + + - - - + + + - - - + + + + +
ntextAlternative Bindings for the Text Widget
ntextBindingsAlternative Bindings for the Text Widget
ntextBindingsAlternative Bindings for the Text Widget
ntextIndentntext Indentation for the Text Widget
ntextIndentntext Indentation for the Text Widget
ntextWordBreakntext Word Boundary Detection for the Text Widget
ntextWordBreakntext Word Boundary Detection for the Text Widget
+
persistentSelection
+ + + +
persistentSelectionEnhanced PRIMARY selection
-
plotchart
- - - - +
plotchart
+
PlotchartSimple plotting and charting package
+ + +
PlotchartSimple plotting and charting package
-
swaplist
- - - - +
swaplist
+
swaplistA dialog which allows a user to move options between two lists
+ + +
swaplistA dialog which allows a user to move options between two lists
-
tkpiechart
- - - - +
tkpiechart
+
canvasLabeltkpiechart canvas label class
+ + + - - - + + + - - - + + + - - - + + +
canvasLabeltkpiechart canvas label class
pie2D or 3D pie chart object in a canvas
pie2D or 3D pie chart object in a canvas
pieBoxLabelertkpiechart pie box style labeler class
pieBoxLabelertkpiechart pie box style labeler class
piePeripheralLabelertkpiechart pie peripheral style labeler class
piePeripheralLabelertkpiechart pie peripheral style labeler class
-
tooltip
- - - - +
tooltip
+
tooltipTooltip management
+ + +
tooltipTooltip management
-
widget
- - - - +
widget
+
widgetMegawidget bundle
+ + + - - - + + + - - - + + + - - - + + +
widgetMegawidget bundle
widget_calendarCalendar Megawidget
widget_calendarCalendar Megawidget
widget_dateentryDate Entry Megawidget
widget_dateentryDate Entry Megawidget
widget_toolbarToolbar Megawidget
widget_toolbarToolbar Megawidget
-
widgetl
- - - - +
widgetl
+
widget_listentrywidget::listentry widget
+ + + - - - + + + + +
widget_listentrywidget::listentry widget
widget_listsimplewidget::listsimple widget
widget_listsimplewidget::listsimple widget
+
widgetPlus
+ + + + + +
widgetPlusEnhanced Entry, Spinbox, and Combobox Widgets with Undo/Redo and other useful features
+
widgetv
+ + + +
widget_validatorwidget::validator behaviour
-
widgetv
- - - - - -
widget_validatorwidget::validator behaviour
-
+ +
diff --git a/embedded/www/toc0.html b/embedded/www/toc0.html index 23ee0f0c..fd8c4e7a 100644 --- a/embedded/www/toc0.html +++ b/embedded/www/toc0.html @@ -1,9 +1,9 @@ - + Table Of Contents - -
[ @@ -13,207 +13,216 @@ |
Modules | Applications ]
-

Table Of Contents

-

-
By Categories
-
Documentation tools
- - - - - - - - +

Table Of Contents

+

+
By Categories
+
Documentation tools
+
diagramDiagram drawing
diagram-viewerLightweight Diagram Processor
+ + + + + + +
diagramDiagram drawing
diagram-viewerLightweight Diagram Processor
-
Image processing
- - - - +
Image processing
+
bitmap-editorEditor for XBM images
+ + +
bitmap-editorEditor for XBM images
-
Unfiled
- - - - +
Unfiled
+
autoscrollProvides for a scrollbar to automatically mapped and unmapped as needed
+ + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + + + + + + + + + + +
autoscrollProvides for a scrollbar to automatically mapped and unmapped as needed
canvas::dragManage the dragging of canvas items or item groups
canvas::dragManage the dragging of canvas items or item groups
canvas::edit::pointsEditing a cloud of points on a canvas
canvas::edit::pointsEditing a cloud of points on a canvas
canvas::edit::polylineEditing a polyline on a canvas
canvas::edit::polylineEditing a polyline on a canvas
canvas::edit::quadrilateralEditing a quadrilateral on a canvas
canvas::edit::quadrilateralEditing a quadrilateral on a canvas
canvas::gradientCanvas with a gradient background
canvas::gradientCanvas with a gradient background
canvas::highlightManage the highlighting of canvas items or item groups
canvas::highlightManage the highlighting of canvas items or item groups
canvas::mvgCanvas to ImageMagick MVG vector format
canvas::mvgCanvas to ImageMagick MVG vector format
canvas::snapCanvas snapshot to Tk photo image
canvas::snapCanvas snapshot to Tk photo image
canvas::sqmapCanvas with map background based on square tiles
canvas::sqmapCanvas with map background based on square tiles
canvas::tagEasier management of the tags on canvas items or item groups
canvas::tagEasier management of the tags on canvas items or item groups
canvas::track::linesManage a group of rubber band lines
canvas::track::linesManage a group of rubber band lines
canvas::zoomZoom control for canvas::sqmap
canvas::zoomZoom control for canvas::sqmap
canvasLabeltkpiechart canvas label class
canvasLabeltkpiechart canvas label class
chatwidgetProvides a multi-paned view suitable for display of chat room or irc channel information
chatwidgetProvides a multi-paned view suitable for display of chat room or irc channel information
controlwidgetCollection of widgets for displaying and controlling numerical values
controlwidgetCollection of widgets for displaying and controlling numerical values
crosshairCrosshairs for Tk canvas
crosshairCrosshairs for Tk canvas
ctextCtext a text widget with highlighting support
ctextCtext a text widget with highlighting support
cursorProcedures to handle CURSOR data
cursorProcedures to handle CURSOR data
getstringA string dialog
getstringA string dialog
historyProvides a history for Entry widgets
historyProvides a history for Entry widgets
icoReading and writing windows icons
icoReading and writing windows icons
khimProvides key bindings for entering international characters on a keyboard that does not support them
khimProvides key bindings for entering international characters on a keyboard that does not support them
menubarCreates an instance of the Class.
menubarCreates an instance of the Class.
notifywindowProvides unobtrusive window for alerts/notifications from Tk applications
notifywindowProvides unobtrusive window for alerts/notifications from Tk applications
ntextAlternative Bindings for the Text Widget
ntextAlternative Bindings for the Text Widget
ntextBindingsAlternative Bindings for the Text Widget
ntextBindingsAlternative Bindings for the Text Widget
ntextIndentntext Indentation for the Text Widget
ntextIndentntext Indentation for the Text Widget
ntextWordBreakntext Word Boundary Detection for the Text Widget
ntextWordBreakntext Word Boundary Detection for the Text Widget
pie2D or 3D pie chart object in a canvas
persistentSelectionEnhanced PRIMARY selection
pieBoxLabelertkpiechart pie box style labeler class
pie2D or 3D pie chart object in a canvas
piePeripheralLabelertkpiechart pie peripheral style labeler class
pieBoxLabelertkpiechart pie box style labeler class
PlotchartSimple plotting and charting package
piePeripheralLabelertkpiechart pie peripheral style labeler class
tooltipTooltip management
PlotchartSimple plotting and charting package
widget_listentrywidget::listentry widget
tooltipTooltip management
widget_listsimplewidget::listsimple widget
widget_listentrywidget::listentry widget
widget_validatorwidget::validator behaviour
widget_listsimplewidget::listsimple widget
widget_validatorwidget::validator behaviour
widgetPlusEnhanced Entry, Spinbox, and Combobox Widgets with Undo/Redo and other useful features
+
Widget
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
datefieldTk datefield widget
ipentryAn IP address entry widget
swaplistA dialog which allows a user to move options between two lists
widgetMegawidget bundle
widget_calendarCalendar Megawidget
widget_dateentryDate Entry Megawidget
widget_toolbarToolbar Megawidget
-
Widget
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
datefieldTk datefield widget
ipentryAn IP address entry widget
swaplistA dialog which allows a user to move options between two lists
widgetMegawidget bundle
widget_calendarCalendar Megawidget
widget_dateentryDate Entry Megawidget
widget_toolbarToolbar Megawidget
-

+ +
diff --git a/embedded/www/toc1.html b/embedded/www/toc1.html index 52a0b4fd..011a426d 100644 --- a/embedded/www/toc1.html +++ b/embedded/www/toc1.html @@ -1,9 +1,9 @@ - + Table Of Contents - -
[ @@ -13,259 +13,274 @@ |
Modules | Applications ]
-

Table Of Contents

-

-
Modules
-
autoscroll
- - - - +

Table Of Contents

+

+
Modules
+
autoscroll
+
autoscrollProvides for a scrollbar to automatically mapped and unmapped as needed
+ + +
autoscrollProvides for a scrollbar to automatically mapped and unmapped as needed
-
canvas
- - - - +
canvas
+
canvas::dragManage the dragging of canvas items or item groups
+ + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + +
canvas::dragManage the dragging of canvas items or item groups
canvas::edit::pointsEditing a cloud of points on a canvas
canvas::edit::pointsEditing a cloud of points on a canvas
canvas::edit::polylineEditing a polyline on a canvas
canvas::edit::polylineEditing a polyline on a canvas
canvas::edit::quadrilateralEditing a quadrilateral on a canvas
canvas::edit::quadrilateralEditing a quadrilateral on a canvas
canvas::gradientCanvas with a gradient background
canvas::gradientCanvas with a gradient background
canvas::highlightManage the highlighting of canvas items or item groups
canvas::highlightManage the highlighting of canvas items or item groups
canvas::mvgCanvas to ImageMagick MVG vector format
canvas::mvgCanvas to ImageMagick MVG vector format
canvas::snapCanvas snapshot to Tk photo image
canvas::snapCanvas snapshot to Tk photo image
canvas::sqmapCanvas with map background based on square tiles
canvas::sqmapCanvas with map background based on square tiles
canvas::tagEasier management of the tags on canvas items or item groups
canvas::tagEasier management of the tags on canvas items or item groups
canvas::track::linesManage a group of rubber band lines
canvas::track::linesManage a group of rubber band lines
canvas::zoomZoom control for canvas::sqmap
canvas::zoomZoom control for canvas::sqmap
-
chatwidget
- - - - +
chatwidget
+
chatwidgetProvides a multi-paned view suitable for display of chat room or irc channel information
+ + +
chatwidgetProvides a multi-paned view suitable for display of chat room or irc channel information
-
controlwidget
- - - - +
controlwidget
+
controlwidgetCollection of widgets for displaying and controlling numerical values
+ + +
controlwidgetCollection of widgets for displaying and controlling numerical values
-
crosshair
- - - - +
crosshair
+
crosshairCrosshairs for Tk canvas
+ + +
crosshairCrosshairs for Tk canvas
-
ctext
- - - - +
ctext
+
ctextCtext a text widget with highlighting support
+ + +
ctextCtext a text widget with highlighting support
-
cursor
- - - - +
cursor
+
cursorProcedures to handle CURSOR data
+ + +
cursorProcedures to handle CURSOR data
-
datefield
- - - - +
datefield
+
datefieldTk datefield widget
+ + +
datefieldTk datefield widget
-
diagrams
- - - - +
diagrams
+
diagramDiagram drawing
+ + +
diagramDiagram drawing
-
getstring
- - - - +
getstring
+
getstringA string dialog
+ + +
getstringA string dialog
-
history
- - - - +
history
+
historyProvides a history for Entry widgets
+ + +
historyProvides a history for Entry widgets
-
ico
- - - - +
ico
+
icoReading and writing windows icons
+ + +
icoReading and writing windows icons
-
ipentry
- - - - +
ipentry
+
ipentryAn IP address entry widget
+ + +
ipentryAn IP address entry widget
-
khim
- - - - +
khim
+
khimProvides key bindings for entering international characters on a keyboard that does not support them
+ + +
khimProvides key bindings for entering international characters on a keyboard that does not support them
-
menubar
- - - - +
menubar
+
menubarCreates an instance of the Class.
+ + +
menubarCreates an instance of the Class.
-
notifywindow
- - - - +
notifywindow
+
notifywindowProvides unobtrusive window for alerts/notifications from Tk applications
+ + +
notifywindowProvides unobtrusive window for alerts/notifications from Tk applications
-
ntext
- - - - +
ntext
+
ntextAlternative Bindings for the Text Widget
+ + + - - - + + + - - - + + + - - - + + +
ntextAlternative Bindings for the Text Widget
ntextBindingsAlternative Bindings for the Text Widget
ntextBindingsAlternative Bindings for the Text Widget
ntextIndentntext Indentation for the Text Widget
ntextIndentntext Indentation for the Text Widget
ntextWordBreakntext Word Boundary Detection for the Text Widget
ntextWordBreakntext Word Boundary Detection for the Text Widget
-
plotchart
- - - - +
persistentSelection
+
PlotchartSimple plotting and charting package
+ + +
persistentSelectionEnhanced PRIMARY selection
-
swaplist
- - - - +
plotchart
+
swaplistA dialog which allows a user to move options between two lists
+ + +
PlotchartSimple plotting and charting package
-
tkpiechart
- - - - +
swaplist
+
canvasLabeltkpiechart canvas label class
+ + + - - - +
swaplistA dialog which allows a user to move options between two lists
pie2D or 3D pie chart object in a canvas
+
tkpiechart
+ + + + + + + + - - - + + + - - - + + +
canvasLabeltkpiechart canvas label class
pie2D or 3D pie chart object in a canvas
pieBoxLabelertkpiechart pie box style labeler class
pieBoxLabelertkpiechart pie box style labeler class
piePeripheralLabelertkpiechart pie peripheral style labeler class
piePeripheralLabelertkpiechart pie peripheral style labeler class
-
tooltip
- - - - +
tooltip
+
tooltipTooltip management
+ + +
tooltipTooltip management
-
widget
- - - - +
widget
+
widgetMegawidget bundle
+ + + + + + + - - - + + + - - - + + + - - - +
widgetMegawidget bundle
widget_calendarCalendar Megawidget
widget_calendarCalendar Megawidget
widget_dateentryDate Entry Megawidget
widget_dateentryDate Entry Megawidget
widget_toolbarToolbar Megawidget
widget_toolbarToolbar Megawidget
+
widgetl
+ + + + + + + +
widget_listentrywidget::listentry widget
widget_listsimplewidget::listsimple widget
-
widgetl
- - - - +
widgetPlus
+
widget_listentrywidget::listentry widget
+ + + - - - +
widgetPlusEnhanced Entry, Spinbox, and Combobox Widgets with Undo/Redo and other useful features
widget_listsimplewidget::listsimple widget
+
widgetv
+ + + +
widget_validatorwidget::validator behaviour
-
widgetv
- - - - - -
widget_validatorwidget::validator behaviour
-

+ +
diff --git a/embedded/www/toc2.html b/embedded/www/toc2.html index c16f6860..8458e12b 100644 --- a/embedded/www/toc2.html +++ b/embedded/www/toc2.html @@ -1,9 +1,9 @@ - + Table Of Contents - -
[ @@ -13,17 +13,17 @@ |
Modules | Applications ]
-

Table Of Contents

-

-
Applications
- - - - +

Table Of Contents

+

+
Applications
+
bitmap-editorEditor for XBM images
+ + + - - - + + +
bitmap-editorEditor for XBM images
diagram-viewerLightweight Diagram Processor
diagram-viewerLightweight Diagram Processor
-

+
diff --git a/examples/controlwidget/demo-rdial.tcl b/examples/controlwidget/demo-rdial.tcl index e8cc3df7..844241f1 100755 --- a/examples/controlwidget/demo-rdial.tcl +++ b/examples/controlwidget/demo-rdial.tcl @@ -37,7 +37,7 @@ proc show_value {which v} { } } } -label .lb -text "Use mouse button with Shift &\nControl for dragging the dials" +label .lb -text "Use mouse button with Shift &\nControl for dragging the dials\nwith Mousewheel support" label .lv -textvariable disp_value(rv) controlwidget::rdial .rv -callback {show_value rv} -value $disp_value(rv)\ -width 200 -step 5 -bg blue -fg white \ diff --git a/examples/mentry/datetime1.tcl b/examples/mentry/datetime1.tcl index ed02252b..17f1220f 100755 --- a/examples/mentry/datetime1.tcl +++ b/examples/mentry/datetime1.tcl @@ -1,10 +1,10 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: mentry::dateMentry, mentry::timeMentry, mentry::putClockVal, # mentry::getClockVal. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry @@ -90,7 +90,7 @@ button .get -text "Get from mentries" -command { # # Label .dateTime displaying the result of mentry::getClockVal # -label .dateTime -textvariable dateTime +label .dateTime -textvariable dateTime -background white # # Frame .sep and button .close diff --git a/examples/mentry/datetime1_tile.tcl b/examples/mentry/datetime1_tile.tcl index 2bc1a9df..ee33abc9 100755 --- a/examples/mentry/datetime1_tile.tcl +++ b/examples/mentry/datetime1_tile.tcl @@ -1,10 +1,10 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: mentry::dateMentry, mentry::timeMentry, mentry::putClockVal, # mentry::getClockVal. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry_tile @@ -97,7 +97,7 @@ ttk::button .base.get -text "Get from mentries" -command { # # Label .base.dateTime displaying the result of mentry::getClockVal # -ttk::label .base.dateTime -textvariable dateTime +ttk::label .base.dateTime -textvariable dateTime -background white # # Separator .base.sep and button .base.close diff --git a/examples/mentry/datetime2.tcl b/examples/mentry/datetime2.tcl index f4b16da9..d73b432d 100755 --- a/examples/mentry/datetime2.tcl +++ b/examples/mentry/datetime2.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: mentry::dateTimeMentry, mentry::putClockVal, mentry::getClockVal. # -# Copyright (c) 2008-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2008-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry @@ -85,7 +85,7 @@ button .get -text "Get from mentry" -command { # # Label .dateTime displaying the result of mentry::getClockVal # -label .dateTime -textvariable dateTime +label .dateTime -textvariable dateTime -background white # # Frame .sep and button .close diff --git a/examples/mentry/datetime2_tile.tcl b/examples/mentry/datetime2_tile.tcl index ceaf1b9a..1e1b80b1 100755 --- a/examples/mentry/datetime2_tile.tcl +++ b/examples/mentry/datetime2_tile.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: mentry::dateMentry, mentry::putClockVal, mentry::getClockVal. # -# Copyright (c) 2008-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2008-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry_tile @@ -56,10 +56,10 @@ wm deiconify . # Frame .base.f with a mentry displaying the date & time # ttk::frame .base.f -ttk::label .base.f.l -text "A mentry widget for date & time:" +ttk::label .base.f.l -text "Date & time: " mentry::dateTimeMentry .base.f.me $dateFmts($dateIdx)$timeFmts($timeIdx) \ $dateSeps($dateIdx) $timeSeps($timeIdx) -justify center -pack .base.f.l .base.f.me +pack .base.f.l .base.f.me -side left # # Message strings corresponding to the values @@ -75,7 +75,7 @@ array set msgs { # # Button .base.get invoking the procedure mentry::getClockVal # -ttk::button .base.get -text "Get from mentries" -command { +ttk::button .base.get -text "Get from mentry" -command { if {[catch { set dateTime "" set clockVal [mentry::getClockVal .base.f.me] @@ -90,7 +90,7 @@ ttk::button .base.get -text "Get from mentries" -command { # # Label .base.dateTime displaying the result of mentry::getClockVal # -ttk::label .base.dateTime -textvariable dateTime +ttk::label .base.dateTime -textvariable dateTime -background white # # Separator .base.sep and button .base.close diff --git a/examples/mentry/ethernetaddr.tcl b/examples/mentry/ethernetaddr.tcl index fe68f852..e9a7392f 100755 --- a/examples/mentry/ethernetaddr.tcl +++ b/examples/mentry/ethernetaddr.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demonstrates how to implement a multi-entry widget for Ethernet addresses. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry @@ -162,7 +162,7 @@ button .get -text "Get from mentry" -command { # # Label .addr displaying the result of getEthernetAddr # -label .addr -textvariable addr +label .addr -textvariable addr -background white # # Frame .sep and button .close diff --git a/examples/mentry/ethernetaddr_tile.tcl b/examples/mentry/ethernetaddr_tile.tcl index 406c65e5..3bb0fb5a 100755 --- a/examples/mentry/ethernetaddr_tile.tcl +++ b/examples/mentry/ethernetaddr_tile.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demonstrates how to implement a multi-entry widget for Ethernet addresses. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry_tile @@ -168,7 +168,7 @@ ttk::button .base.get -text "Get from mentry" -command { # # Label .base.addr displaying the result of getEthernetAddr # -ttk::label .base.addr -textvariable addr +ttk::label .base.addr -textvariable addr -background white # # Separator .sep and button .close diff --git a/examples/mentry/option.tcl b/examples/mentry/option.tcl index f72ea991..bc940b12 100644 --- a/examples/mentry/option.tcl +++ b/examples/mentry/option.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains some Tk option database settings. # -# Copyright (c) 2004-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -25,6 +25,6 @@ if {[string compare $winSys "x11"] == 0} { catch {font create TkDefaultFont -family Helvetica -size -12} option add *Font TkDefaultFont - option add *selectBackground #678db2 + option add *selectBackground #5294e2 option add *selectForeground white } diff --git a/examples/mentry/option_tile.tcl b/examples/mentry/option_tile.tcl index 32014d54..aaf1c126 100644 --- a/examples/mentry/option_tile.tcl +++ b/examples/mentry/option_tile.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains some Tk option database settings. # -# Copyright (c) 2004-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # diff --git a/examples/mentry/phonenumber.tcl b/examples/mentry/phonenumber.tcl index 37534101..899914aa 100755 --- a/examples/mentry/phonenumber.tcl +++ b/examples/mentry/phonenumber.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demonstrates how to implement a multi-entry widget for 10-digit phone numbers. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry @@ -155,7 +155,7 @@ button .get -text "Get from mentry" -command { # # Label .num displaying the result of getPhoneNumber # -label .num -textvariable num +label .num -textvariable num -background white # # Frame .sep and button .close diff --git a/examples/mentry/phonenumber_tile.tcl b/examples/mentry/phonenumber_tile.tcl index e1d7bebb..ecb89870 100755 --- a/examples/mentry/phonenumber_tile.tcl +++ b/examples/mentry/phonenumber_tile.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demonstrates how to implement a multi-entry widget for 10-digit phone numbers. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require mentry_tile @@ -161,7 +161,7 @@ ttk::button .base.get -text "Get from mentry" -command { # # Label .base.num displaying the result of getPhoneNumber # -ttk::label .base.num -textvariable num +ttk::label .base.num -textvariable num -background white # # Separator .base.sep and button .base.close diff --git a/examples/ntext/ntextDemoBindings.tcl b/examples/ntext/ntextDemoBindings.tcl index b748df08..0ed827d9 100755 --- a/examples/ntext/ntextDemoBindings.tcl +++ b/examples/ntext/ntextDemoBindings.tcl @@ -4,7 +4,7 @@ exec tclsh "$0" "$@" package require Tk -# Copyright (c) 2005-2017 Keith Nash. +# Copyright (c) 2005-2018 Keith Nash. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -14,6 +14,7 @@ package require Tk ### For a short example, see ntextExample.tcl ### To explore ntext indentation, try ntextDemoIndent.tcl ### To explore vertical scrolling on the Mac, try ntextDemoMacScrolling.tcl +### For corner cases in scrolling, try ntextDemoScroll.tcl # This string defines the text that will be displayed in each widget: set message {QOTW: "C/C++, which is used by 16% of users, is the most popular programming language, but Tcl, used by 0%, seems to be the language of choice for the highest scoring users." diff --git a/examples/ntext/ntextDemoIndent.tcl b/examples/ntext/ntextDemoIndent.tcl index 9aa631a7..057d38a9 100755 --- a/examples/ntext/ntextDemoIndent.tcl +++ b/examples/ntext/ntextDemoIndent.tcl @@ -4,7 +4,7 @@ exec tclsh "$0" "$@" package require Tk -# Copyright (c) 2005-2017 Keith Nash. +# Copyright (c) 2005-2018 Keith Nash. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -14,20 +14,25 @@ package require Tk ### For a short example, see ntextExample.tcl ### To explore the ntext options, try ntextDemoBindings.tcl ### To explore vertical scrolling on the Mac, try ntextDemoMacScrolling.tcl +### For corner cases in scrolling, try ntextDemoScroll.tcl ### - Points to note when using ntext's indent facilities are commented and -### numbered (1) to (6). +### numbered (1) to (8). ### - If the text in your widget is manipulated only by the keyboard and mouse, ### then (1), (2) and (3) are all you need to do. ### - If the text or its layout are manipulated by the script, then you also -### need to call the function ::ntext::wrapIndent - see comments (4) to (6), +### need to call the function ::ntext::wrapIndent - see comments (4) to (8), ### and the man page for ntextIndent. # This string defines the text that will be displayed in each widget: -set message { This demo shows ntext's indentation facilities. These are switched off by default, but in this demo they have been switched on. +set message { This demo shows ntext's indentation facilities. These are switched off by default, but in this demo they have been switched on. To try the demo - place the cursor at the start of a paragraph and change the amount of initial space. The paragraph is a logical line of text; its first display line may have leading whitespace, and ntext indents any subsequent (wrapped) display lines to match the first. + This paragraph is indented by a tab. Again, the display lines are all indented to match the first. + + Colored indents are possible in Tk 8.6.6 and above. To remove coloring, set the color to the empty string. + Try any text-widget operation, and test whether ntext's handling of display line indentation is satisfactory. Ntext is part of Tklib - please report any bugs to: http://core.tcl.tk/tklib/reportlist @@ -53,7 +58,7 @@ bindtags .rhf.new {.rhf.new Ntext . all} ### (3) Set the widget to '-wrap word' mode: .rhf.new configure -wrap word -undo 1 -.rhf.new configure -width 42 -height 26 -font {{Courier} -15} -bg white +.rhf.new configure -width 42 -height 32 -font {{Courier} -15} -bg white .rhf.new insert end " I use the Ntext bindings.\n\n$message" .rhf.new edit separator @@ -66,7 +71,7 @@ bindtags .rhf.new {.rhf.new Ntext . all} pack [frame .lhf -bg $col] -side left -anchor ne pack [text .lhf.classic ] -padx 2 -.lhf.classic configure -width 42 -height 26 -wrap word -undo 1 -font {{Courier} -15} -bg #FFFFCC +.lhf.classic configure -width 42 -height 32 -wrap word -undo 1 -font {{Courier} -15} -bg #FFFFCC .lhf.classic insert end " I use the (default) Text bindings.\n\n$message" .lhf.classic edit separator pack [label .lhf.m -bg $col -text "(The radiobuttons and tab settings do not\napply to the left-hand text widget)"] @@ -79,18 +84,49 @@ pack [radiobutton .rhf.h.on -bg $col -text "Indent On" -variable ::ntext::clas pack [label .rhf.h.l -bg $col -text "Switch indentation on/off: "] -side right pack [frame .rhf.g -bg $col] -anchor ne -pack [label .rhf.g.l -bg $col -text " "] -side right -pack [entry .rhf.g.e -width 3] -side right -padx 5 -pack [button .rhf.g.b -bg $col -highlightbackground $col -text "Click to set tab spacing to value in box" -command changeTabs] -side right + +label .rhf.g.l1 -bg $col -text " " +entry .rhf.g.e1 -width 8 -bg white +button .rhf.g.b1 -bg $col -highlightbackground $col -text "Click to set indent color to value in box" -command changeColor + +grid .rhf.g.b1 .rhf.g.e1 .rhf.g.l1 -padx 3 -sticky w + +label .rhf.g.l2 -bg $col -text " " +entry .rhf.g.e2 -width 3 -bg white +button .rhf.g.b2 -bg $col -highlightbackground $col -text "Click to set tab spacing to value in box" -command changeTabs + +grid .rhf.g.b2 .rhf.g.e2 .rhf.g.l2 -padx 3 -sticky w + +.rhf.g.e2 insert end 8 +.rhf.g.e1 insert end $::ntext::indentColor + +proc changeColor {} { + set col [string trim [.rhf.g.e1 get]] + if {($col eq {}) || (![catch {winfo rgb .rhf.new $col}])} { + ### (6) Ensure future tags will use the new color: + set ::ntext::indentColor $col + + ### (7) Update existing tags to use the new color: + ::ntext::syncIndentColor .rhf.new + } else { + .rhf.g.e1 delete 0 end + .rhf.g.e1 insert end $::ntext::indentColor + } + return +} proc changeTabs {} { - set nTabs [.rhf.g.e get] - if {[string is integer -strict $nTabs] && $nTabs > 0} { - set font [lindex [.rhf.new configure -font] 4] + set nTabs [string trim [.rhf.g.e2 get]] + if {[string is integer -strict $nTabs] && ($nTabs > 0)} { + set font [.rhf.new cget -font] .rhf.new configure -tabs "[expr {$nTabs * [font measure $font 0]}] left" - ### (6) Changing the tabs may change the indentation of the first + ### (8) Changing the tabs may change the indentation of the first ### display line of a logical line; if so, the indentation of the ### other display lines must be recalculated: ::ntext::wrapIndent .rhf.new + } else { + .rhf.g.e2 delete 0 end + .rhf.g.e2 insert end [.rhf.new cget -tabs] } + return } diff --git a/examples/ntext/ntextDemoMacScrolling.tcl b/examples/ntext/ntextDemoMacScrolling.tcl index 648976f0..e8bfdd48 100755 --- a/examples/ntext/ntextDemoMacScrolling.tcl +++ b/examples/ntext/ntextDemoMacScrolling.tcl @@ -4,7 +4,7 @@ exec tclsh "$0" "$@" package require Tk -# Copyright (c) 2005-2017 Keith Nash. +# Copyright (c) 2005-2018 Keith Nash. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -14,6 +14,8 @@ package require Tk ### For a short example, see ntextExample.tcl ### To explore ntext indentation, try ntextDemoIndent.tcl ### To explore the ntext options, try ntextDemoBindings.tcl +### For corner cases in scrolling, try ntextDemoScroll.tcl + # This string defines the text that will be displayed in each widget: set message {Ntext tries to offer a user experience that is as close as possible to the native "look and feel" of each platform. diff --git a/examples/ntext/ntextDemoScroll.tcl b/examples/ntext/ntextDemoScroll.tcl new file mode 100755 index 00000000..f4c46513 --- /dev/null +++ b/examples/ntext/ntextDemoScroll.tcl @@ -0,0 +1,109 @@ +#!/bin/sh +# the next line restarts using tclsh \ +exec tclsh "$0" "$@" + +package require Tk + +# Copyright (c) 2005-2018 Keith Nash. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +### This demo explores corner cases in scrolling (with thanks to Gregor Cramer +### and Francois Vogel for revised_text). + +### For a short example, see ntextExample.tcl +### To explore the ntext options, try ntextDemoBindings.tcl +### To explore ntext indentation, try ntextDemoIndent.tcl +### To explore vertical scrolling on the Mac, try ntextDemoMacScrolling.tcl + +image create photo example -data { +R0lGODlhEAAQALMAAAAAAISEAMbGxv//AP////////////////////////////////////////// +/////yH5BAEAAAIALAAAAAAQABAAAAQ4UMhJq6Ug3wpm7xsHZqBFCsBADGTLrbCqllIaxzSKt3wm +A4GgUPhZAYfDEQuZ9ByZAVqPF6paLxEAOw== +} + +# This string defines the text that will be displayed in each widget: +set message1 { This demo tests scrolling with the scrollbars, keyboard or mousewheel. + + To allow lines to be partially visible, this line will use a different font size. + + Now show an embedded image. + + 1. Now some extra words to lengthen the text. + + 2. Now some extra words to lengthen the text.} +# End of string for widget text. + +set message2 { This demo has some very tall lines, and tests scrolling with the scrollbars, keyboard or mousewheel. + + To test scrolling with very tall lines, this line will use a huge font size. + + 1. Now some extra words to lengthen the text. + + 2. Now some extra words to lengthen the text. + + 3. Now some extra words to lengthen the text. + + 4. Now some extra words to lengthen the text. + + 5. Now some extra words to lengthen the text. + + Try any text-widget operation, and test whether ntext is satisfactory. Ntext is part of Tklib - please report any bugs to: + + http://core.tcl.tk/tklib/reportlist} +# End of string for widget text. + +package require ntext 1.0 + +### Indentation is disabled by default. Set this variable to 0 to enable it: +set ::ntext::classicWrap 0 + +# Activate the traditional "extra" bindings so these can be tested too: +set ::ntext::classicExtras 1 + +set col #e0dfde +. configure -bg $col + +proc textAndScroll {w col ht ft message bt {img {}}} { + frame $w -bg $col + pack [scrollbar $w.scroll -command [list $w.txt yview]] -fill y -side right + pack [text $w.txt -yscrollcommand [list $w.scroll set]] -fill both -side right -expand 1 + + bindtags $w.txt [list $w.txt $bt . all] + + if {$bt eq {Ntext}} { + set bg white + } else { + set bt Text + set bg #FFFFCC + } + + $w.txt configure -wrap word -undo 1 + $w.txt configure -width 42 -height $ht -font {{Courier} -15} -bg $bg + $w.txt insert end " I use the $bt bindings.\n\n$message" + $w.txt edit separator + + $w.txt tag add tall 5.0 6.0 + $w.txt tag configure tall -font $ft + + if {$img ne {}} { + $w.txt image create $img -image example + } + + if {$bt eq {Ntext}} { + ::ntext::wrapIndent $w.txt + } + return $w +} + +textAndScroll .topright $col 16 {{Courier} -17} $message1 Ntext 7.21 +textAndScroll .topleft $col 16 {{Courier} -17} $message1 Text 7.21 +textAndScroll .botright $col 10 {{Courier} -170} $message2 Ntext +textAndScroll .botleft $col 10 {{Courier} -170} $message2 Text +grid .topleft .topright -sticky nsew +grid .botleft .botright -sticky nsew -pady {10 0} +grid columnconfigure . all -weight 1 +grid columnconfigure . all -weight 1 +grid rowconfigure . 0 -weight 1 + diff --git a/examples/ntext/ntextExample.tcl b/examples/ntext/ntextExample.tcl index abf3c74d..97734dea 100755 --- a/examples/ntext/ntextExample.tcl +++ b/examples/ntext/ntextExample.tcl @@ -4,7 +4,7 @@ exec tclsh "$0" "$@" package require Tk -# Copyright (c) 2005-2017 Keith Nash. +# Copyright (c) 2005-2018 Keith Nash. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -15,6 +15,7 @@ package require Tk ### To explore the ntext options, try ntextDemoBindings.tcl ### To explore ntext indentation, try ntextDemoIndent.tcl ### To explore vertical scrolling on the Mac, try ntextDemoMacScrolling.tcl +### For corner cases in scrolling, try ntextDemoScroll.tcl . configure -bg #d0cfce diff --git a/examples/persistentSelection/allWidgetsDebugDemo.tcl b/examples/persistentSelection/allWidgetsDebugDemo.tcl new file mode 100755 index 00000000..1af93ce0 --- /dev/null +++ b/examples/persistentSelection/allWidgetsDebugDemo.tcl @@ -0,0 +1,269 @@ +#!/bin/sh +# the next line restarts using tclsh \ +exec tclsh "$0" "$@" + +# Copyright (c) 2017-2018 Keith Nash. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# To use the <> event, the caller must bind a command to it. +# In this demo, the <> event is used by the persistent selection +# module persistentSelection. + +# ------------------------------------------------------------------------------ +# Demo of the persistent selection module persistentSelection. +# ------------------------------------------------------------------------------ +# This demo is for text, ntext and all widgetPlus widgets, and it also provides +# tools for monitoring and debugging. +# ------------------------------------------------------------------------------ + + +# ------------------------------------------------------------------------------ +# Load package(s) and create bindings. +# ------------------------------------------------------------------------------ + +package require Tk + +# persistentSelection +package require persistentSelection + +# text +persistentSelection::fixText +bind Text <> {persistentSelection::report text %W} + +# ntext +package require ntext +bind Ntext <> {persistentSelection::report text %W} +if 0 { +# widgetPlus +package require widgetPlus +namespace import widgetPlus::* +bind EntryPlus <> {persistentSelection::report entry %W} +bind TEntryPlus <> {persistentSelection::report entry %W} +bind SpinboxPlus <> {persistentSelection::report entry %W} +bind TSpinboxPlus <> {persistentSelection::report entry %W} +bind TComboboxPlus <> {persistentSelection::report entry %W} + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map entryPlus widget. +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# Command CreateWidget +# ------------------------------------------------------------------------------ +# Command to create a widgetPlus widget, initialize it, and map it. +# If there is an existing widget with the same name it is destroyed. +# +# When debugging, note that the Undo/Redo innards differ if $w has or does not +# have a -textvariable. +# +# The options added by widgetPlus are shown on the first line of each widgetPlus +# command. The options on continuation lines are those of the widget hull. +# ------------------------------------------------------------------------------ + +proc CreateWidget {w} { + destroy $w + switch -exact -- $::hullType { + entry {entryPlus $w -undo 1 -maxundo 0 \ + -bg white} + + spinbox {spinboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5} \ + -bg white} + + ttk::entry {ttkEntryPlus $w -undo 1 -maxundo 0} + + ttk::spinbox {ttkSpinboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5}} + + ttk::combobox {ttkComboboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5}} + + default {error {set ::hullType to entry, ttk::entry, spinbox,\ + ttk::spinbox, or ttk::combobox}} + } + + pack $w -side left + + $w delete 0 end + $w insert end {Initial Text} + $w edit reset + + return +} + + +# ------------------------------------------------------------------------------ +# Command CreateDemo +# ------------------------------------------------------------------------------ +# Command to create a megawidget with a descriptive label, a radiobutton widget +# selector, and a widgetPlus widget. +# ------------------------------------------------------------------------------ + +proc CreateDemo {w} { + frame $w + label $w.lab -text {Use radiobuttons to choose widget:} + pack $w.lab -pady 10 + + frame $w.f + radiobutton $w.f.rb0 -value entry -text entry + radiobutton $w.f.rb1 -value spinbox -text spinbox + radiobutton $w.f.rb2 -value ttk::entry -text ttk::entry + radiobutton $w.f.rb3 -value ttk::spinbox -text ttk::spinbox + radiobutton $w.f.rb4 -value ttk::combobox -text ttk::combobox + + foreach rb {.f.rb0 .f.rb1 .f.rb2 .f.rb3 .f.rb4} { + $w$rb configure -variable ::hullType -command [list CreateWidget $w.g.e] + } + pack $w.f.rb0 $w.f.rb1 $w.f.rb2 $w.f.rb3 $w.f.rb4 -side left -padx 5 + pack $w.f + set ::hullType entry + + frame $w.g + pack $w.g -padx 20 -pady {20 10} + + frame $w.g.filler -height 30 -width 1 + pack $w.g.filler -side left + + # Start with "entry", specified by ::hullType. + CreateWidget $w.g.e + return $w +} + +CreateDemo .wpdemo +pack .wpdemo +} + +# ------------------------------------------------------------------------------ +# Create, initialize, and map text widget. +# ------------------------------------------------------------------------------ + +text .top -bg white -height 10 -wrap word -undo 1 -maxundo 0 +pack .top + +.top insert end {Widget .top, bindtag Text. + +Try using the persistent PRIMARY selection with this widget, and with the entryPlus widget (above). + +When the selection is cleared in the widget that owns the PRIMARY selection, usually Tk also clears the PRIMARY selection. The persistentSelection package ensures that, instead, the PRIMARY selection retains the last non-empty selected string. +} +.top edit reset + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map ntext widget. +# ------------------------------------------------------------------------------ + +text .mid -bg white -height 5 -wrap word -undo 1 -maxundo 0 +bindtags .mid {.mid Ntext . all} +pack .mid -pady 5 + +.mid insert end {Widget .mid, bindtag Ntext. + +Try using the persistent PRIMARY selection with the entryPlus widget (top), the text widget (above), and the ntext widget (here). +} +.mid edit reset + + +# ------------------------------------------------------------------------------ +# Monitoring Tools. +# ------------------------------------------------------------------------------ +# - These are not necessary for the demo to work, but they show what is +# happening. +# - This code can be copied to other demos if required. +# ------------------------------------------------------------------------------ + +label .mon -text {Monitoring Tools} -font TkCaptionFont +pack .mon -pady 10 + +# 1. Counter for <> events. + +bind all <> {incr ::selCount} +set ::selCount 0 +frame .count +label .count.left -text {Number of <> events: } +label .count.right -textvariable ::selCount -bg #e0f0e0 -fg red -relief sunken +pack .count.left .count.right -side left +pack .count -pady 5 -padx 20 + +# 2. Show the PRIMARY selection. + +label .desc -text {Contents of the PRIMARY selection (refreshed every 0.5s):} +pack .desc + +text .test -bg #e0f0e0 -height 5 -width 80 -exportselection 0 +bindtags .test {.test Ntext . all} +pack .test + +proc showSelection {delay} { + set w .test + $w delete 1.0 end + set sel {} + catch {set sel [::tk::GetSelection $w PRIMARY]} + $w insert 1.0 $sel + set ::selEvent [after $delay showSelection $delay] + return +} + +showSelection 500 + +# 3. Show the contents of the Persistent Store(s). + +proc ::persistentSelection::Show {} { + ShowExample .lab + return +} + +label .lab -bg #e0f0e0 -bd 1 -relief sunken +pack .lab -fill x -pady {10 5} -padx 20 + +::persistentSelection::Show + +# 4. Log the processing of <> events. + +# ------------------------------------------------------------------------------ +# Command LogButtons +# ------------------------------------------------------------------------------ +# Command to create a megawidget with a descriptive label, a radiobutton widget +# selector, and a widgetPlus widget. +# ------------------------------------------------------------------------------ + +proc LogButtons {w} { + frame $w + label $w.lab -text {Logger} -font TkHeadingFont + pack $w.lab -pady {5 0} + + frame $w.f + label $w.f.rb0 -text {Choose Log Level:} + radiobutton $w.f.rb1 -value 0 -text Simple -variable ::logLevel + radiobutton $w.f.rb2 -value 1 -text Debug -variable ::logLevel + + pack $w.f.rb0 $w.f.rb1 $w.f.rb2 -side left -padx 5 + pack $w.f + set ::logLevel 0 + + return $w +} + +LogButtons .logbuttons +pack .logbuttons + +proc ::persistentSelection::Log {msg} { + LogExample .log $::logLevel $msg + return +} + +pack [text .log -bg #e0f0e0 -height 30 -width 80 -exportselection 0 -wrap word] -expand 1 -fill both + +bindtags .log {.log Ntext . all} + +set msg {This window logs <> events in windows .top and .mid (above), and their processing by package persistentSelection. + +The log window's contents can be edited. This is useful for marking the points before and after a GUI event in windows .top and .mid. +} + +.log insert end $msg +.log insert end \n +.log see end-1c diff --git a/examples/persistentSelection/allWidgetsDemo.tcl b/examples/persistentSelection/allWidgetsDemo.tcl new file mode 100755 index 00000000..64287c15 --- /dev/null +++ b/examples/persistentSelection/allWidgetsDemo.tcl @@ -0,0 +1,177 @@ +#!/bin/sh +# the next line restarts using tclsh \ +exec tclsh "$0" "$@" + +# Copyright (c) 2017-2018 Keith Nash. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# ------------------------------------------------------------------------------ +# Demo of the persistent selection module persistentSelection. +# ------------------------------------------------------------------------------ +# This demo is for text, ntext and all widgetPlus widgets. +# ------------------------------------------------------------------------------ + + +# ------------------------------------------------------------------------------ +# Load package(s) and create bindings. +# ------------------------------------------------------------------------------ + +package require Tk +package require persistentSelection +package require ntext +package require snit +package require widgetPlus +namespace import widgetPlus::* + +persistentSelection::fixText +bind Text <> {persistentSelection::report text %W} +bind Ntext <> {persistentSelection::report text %W} +bind EntryPlus <> {persistentSelection::report entry %W} +bind TEntryPlus <> {persistentSelection::report entry %W} +bind SpinboxPlus <> {persistentSelection::report entry %W} +bind TSpinboxPlus <> {persistentSelection::report entry %W} +bind TComboboxPlus <> {persistentSelection::report entry %W} + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map a widgetPlus widget. +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# Command CreateWidget +# ------------------------------------------------------------------------------ +# Command to create a widgetPlus widget, initialize it, and map it. +# If there is an existing widget with the same name it is destroyed. +# +# When debugging, note that the Undo/Redo innards differ if $w has or does not +# have a -textvariable. +# +# The options added by widgetPlus are shown on the first line of each widgetPlus +# command. The options on continuation lines are those of the widget hull. +# ------------------------------------------------------------------------------ + +proc CreateWidget {w} { + destroy $w + switch -exact -- $::hullType { + entry {entryPlus $w -undo 1 -maxundo 0 \ + -bg white} + + spinbox {spinboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5} \ + -bg white} + + ttk::entry {ttkEntryPlus $w -undo 1 -maxundo 0} + + ttk::spinbox {ttkSpinboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5}} + + ttk::combobox {ttkComboboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5}} + + default {error {set ::hullType to entry, ttk::entry, spinbox,\ + ttk::spinbox, or ttk::combobox}} + } + + pack $w -side left + + $w delete 0 end + $w insert end {Initial Text} + $w edit reset + + return +} + + +# ------------------------------------------------------------------------------ +# Command CreateDemo +# ------------------------------------------------------------------------------ +# Command to create a megawidget with a descriptive label, a radiobutton widget +# selector, and a widgetPlus widget. +# ------------------------------------------------------------------------------ + +proc CreateDemo {w} { + frame $w + label $w.lab -text {Use radiobuttons to choose widget:} + pack $w.lab -pady 10 + + frame $w.f + radiobutton $w.f.rb0 -value entry -text entry + radiobutton $w.f.rb1 -value spinbox -text spinbox + radiobutton $w.f.rb2 -value ttk::entry -text ttk::entry + radiobutton $w.f.rb3 -value ttk::spinbox -text ttk::spinbox + radiobutton $w.f.rb4 -value ttk::combobox -text ttk::combobox + + foreach rb {.f.rb0 .f.rb1 .f.rb2 .f.rb3 .f.rb4} { + $w$rb configure -variable ::hullType -command [list CreateWidget $w.g.e] + } + pack $w.f.rb0 $w.f.rb1 $w.f.rb2 $w.f.rb3 $w.f.rb4 -side left -padx 5 + pack $w.f + set ::hullType entry + + frame $w.g + pack $w.g -padx 20 -pady {20 10} + + frame $w.g.filler -height 30 -width 1 + pack $w.g.filler -side left + + # Start with "entry", specified by ::hullType. + CreateWidget $w.g.e + return $w +} + +CreateDemo .wpdemo +pack .wpdemo + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map text widget. +# ------------------------------------------------------------------------------ + +text .top -height 22 -bg white -wrap word -undo 1 -maxundo 0 +pack .top + +set RR \u00ae + +.top insert end {Try using the persistent PRIMARY selection on the widget modified with widgetPlus (above) and the text widget (here). + +When the selection is cleared in the widget that owns the PRIMARY selection, usually Tk also clears the PRIMARY selection. The persistentSelection package ensures that, instead, the PRIMARY selection retains the last non-empty selected string. + +Also try using Undo/Redo on these widgets.} + +.top insert end " + +On X11 systems (Linux$RR, BSD$RR, Solaris$RR ...) + <> is mapped to + <> is mapped to + +On Windows$RR systems + <> is mapped to + <> is mapped to + +On Aqua$RR systems (i.e. Apple$RR macOS$RR or OS X$RR) + <> is mapped to + <> is mapped to +" + +.top edit reset + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map ntext widget. +# ------------------------------------------------------------------------------ + +# Create and map a ntext widget. +text .mid -height 5 -bg white -wrap word -undo 1 -maxundo 0 +pack .mid -pady {10 0} +bindtags .mid {.mid Ntext . all} +.mid insert end "Also try the persistent PRIMARY selection, and Undo/Redo, on this ntext widget." +.mid edit reset + + +# ------------------------------------------------------------------------------ +# Code for monitoring tools can be copied here from allWidgetsDebugDemo.tcl. +# These tools are not necessary for the demo to work, but they show what is +# happening. +# ------------------------------------------------------------------------------ diff --git a/examples/persistentSelection/simpleDemoEntryPlus.tcl b/examples/persistentSelection/simpleDemoEntryPlus.tcl new file mode 100755 index 00000000..dd1cb6f9 --- /dev/null +++ b/examples/persistentSelection/simpleDemoEntryPlus.tcl @@ -0,0 +1,99 @@ +#!/bin/sh +# the next line restarts using tclsh \ +exec tclsh "$0" "$@" + +# Copyright (c) 2017-2018 Keith Nash. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# ------------------------------------------------------------------------------ +# Demo of the persistent selection module persistentSelection. +# ------------------------------------------------------------------------------ +# This demo is for entryPlus widgets only. +# ------------------------------------------------------------------------------ + + +# ------------------------------------------------------------------------------ +# Load package(s) and create bindings. +# ------------------------------------------------------------------------------ + +package require Tk +package require persistentSelection +package require snit +package require widgetPlus +namespace import widgetPlus::* + +# To use with widgetPlus::entryPlus widgets: +bind EntryPlus <> {persistentSelection::report entry %W} + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map entryPlus widget. +# ------------------------------------------------------------------------------ + +entryPlus .e -undo 1 -maxundo 0 -bg white + +.e delete 0 end +.e insert end {Initial Text} +.e edit reset +pack .e -padx 40 -pady 20 -fill x + + +# ------------------------------------------------------------------------------ +# Create and map a label widget with instructions. +# ------------------------------------------------------------------------------ + +label .lab1 -justify left -anchor center +pack .lab1 -padx 20 -pady {0 20} + +.lab1 configure -text {Try using the persistent PRIMARY selection on the\ + entryPlus widget. + +When the selection is cleared in the widget that owns the PRIMARY +selection, usually Tk also clears the PRIMARY selection. The +persistentSelection package ensures that, instead, the PRIMARY +selection retains the last non-empty selected string.} + + +# ------------------------------------------------------------------------------ +# To replace entryPlus with a different widgetPlus widget: +# ------------------------------------------------------------------------------ + +if 0 { +# This block of code is not executed! + +# To try a different type of widgetPlus widget, look for these two lines in +# the code above: + +# entry +bind EntryPlus <> {persistentSelection::report entry %W} +entryPlus .e -undo 1 -maxundo 0 -bg white + +# and replace them with one of the pairs of lines below. Alternatively use +# the demo #### which has a radiobutton widget selector. + +# spinbox +bind SpinboxPlus <> {persistentSelection::report entry %W} +spinboxPlus .e -undo 1 -maxundo 0 -values {1 2 3 4 5} -bg white + +# ttk::entry +bind TEntryPlus <> {persistentSelection::report entry %W} +ttkEntryPlus .e -undo 1 -maxundo 0 + +# ttk::spinbox +bind TSpinboxPlus <> {persistentSelection::report entry %W} +ttkSpinboxPlus .e -undo 1 -maxundo 0 -values {1 2 3 4 5} + +# ttk::combobox +ttk::combobox ttkComboboxPlus .e -undo 1 -maxundo 0 -values {1 2 3 4 5} +bind TComboboxPlus <> {persistentSelection::report entry %W} + +} + + +# ------------------------------------------------------------------------------ +# Code for monitoring tools can be copied here from allWidgetsDebugDemo.tcl. +# These tools are not necessary for the demo to work, but they show what is +# happening. +# ------------------------------------------------------------------------------ diff --git a/examples/persistentSelection/simpleDemoNtext.tcl b/examples/persistentSelection/simpleDemoNtext.tcl new file mode 100755 index 00000000..33e0ee2c --- /dev/null +++ b/examples/persistentSelection/simpleDemoNtext.tcl @@ -0,0 +1,50 @@ +#!/bin/sh +# the next line restarts using tclsh \ +exec tclsh "$0" "$@" + +# Copyright (c) 2017-2018 Keith Nash. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# ------------------------------------------------------------------------------ +# Demo of the persistent selection module persistentSelection. +# ------------------------------------------------------------------------------ +# This demo is for ntext text widgets only. +# ------------------------------------------------------------------------------ + + +# ------------------------------------------------------------------------------ +# Load package(s) and create bindings. +# ------------------------------------------------------------------------------ + +package require Tk +package require persistentSelection +package require ntext + +# To use with ntext widgets: +bind Ntext <> {persistentSelection::report text %W} + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map ntext widget. +# ------------------------------------------------------------------------------ + +text .mid -bg white -height 10 -wrap word -undo 1 -maxundo 0 +bindtags .mid {.mid Ntext . all} +pack .mid + +.mid insert end {Widget .mid, bindtag Ntext. + +Try using the persistent PRIMARY selection with this widget. + +When the selection is cleared in the widget that owns the PRIMARY selection, usually Tk also clears the PRIMARY selection. The persistentSelection package ensures that, instead, the PRIMARY selection retains the last non-empty selected string. +} +.mid edit reset + + +# ------------------------------------------------------------------------------ +# Code for monitoring tools can be copied here from allWidgetsDebugDemo.tcl. +# These tools are not necessary for the demo to work, but they show what is +# happening. +# ------------------------------------------------------------------------------ diff --git a/examples/persistentSelection/simpleDemoText.tcl b/examples/persistentSelection/simpleDemoText.tcl new file mode 100755 index 00000000..46fb847f --- /dev/null +++ b/examples/persistentSelection/simpleDemoText.tcl @@ -0,0 +1,50 @@ +#!/bin/sh +# the next line restarts using tclsh \ +exec tclsh "$0" "$@" + +# Copyright (c) 2017-2018 Keith Nash. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# ------------------------------------------------------------------------------ +# Demo of the persistent selection module persistentSelection. +# ------------------------------------------------------------------------------ +# This demo is for plain text widgets only. +# It requires no packages except Tk and persistentSelection itself. +# ------------------------------------------------------------------------------ + + +# ------------------------------------------------------------------------------ +# Load package(s) and create bindings. +# ------------------------------------------------------------------------------ + +package require Tk +package require persistentSelection + +# To use with text widgets: +persistentSelection::fixText +bind Text <> {persistentSelection::report text %W} + + +# ------------------------------------------------------------------------------ +# Create, initialize, and map text widget. +# ------------------------------------------------------------------------------ + +text .top -bg white -height 10 -wrap word -undo 1 -maxundo 0 +pack .top + +.top insert end {Widget .top, bindtag Text. + +Try using the persistent PRIMARY selection with this widget. + +When the selection is cleared in the widget that owns the PRIMARY selection, usually Tk also clears the PRIMARY selection. The persistentSelection package ensures that, instead, the PRIMARY selection retains the last non-empty selected string. +} +.top edit reset + + +# ------------------------------------------------------------------------------ +# Code for monitoring tools can be copied here from allWidgetsDebugDemo.tcl. +# These tools are not necessary for the demo to work, but they show what is +# happening. +# ------------------------------------------------------------------------------ diff --git a/examples/scrollutil/ScrollableFrmContent.tcl b/examples/scrollutil/ScrollableFrmContent.tcl new file mode 100644 index 00000000..6fed941e --- /dev/null +++ b/examples/scrollutil/ScrollableFrmContent.tcl @@ -0,0 +1,490 @@ +#============================================================================== +# Populates the content frame of the BWidget ScrollableFrame widget created in +# the demo script ScrollableFrm.tcl. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +# +# Add some entries to the Tk option database +# +tablelist::setThemeDefaults +if {$ttk::currentTheme eq "aqua"} { + option add *Listbox.selectBackground \ + $tablelist::themeDefaults(-selectbackground) + option add *Listbox.selectForeground \ + $tablelist::themeDefaults(-selectforeground) +} else { + option add *selectBackground $tablelist::themeDefaults(-selectbackground) + option add *selectForeground $tablelist::themeDefaults(-selectforeground) +} +option add *selectBorderWidth $tablelist::themeDefaults(-selectborderwidth) + +# +# Create some widgets in the content frame +# + +# +# A scrolled text widget +# +set row 0 +set l [ttk::label $cf.l$row -text \ + "Contents of the Tablelist distribution file \"CHANGES.txt\":"] +grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} +incr row +set _sa [scrollutil::scrollarea $cf.sa$row] +set txt [text $_sa.txt -font TkFixedFont -width 73] +$_sa setwidget $txt +grid $_sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 0} + +# +# A scrolled listbox widget +# +incr row +set l [ttk::label $cf.l$row -text "Tablelist releases:"] +grid $l -row $row -column 0 -sticky w -padx {10 0} -pady {10 0} +incr row +set _sa [scrollutil::scrollarea $cf.sa$row] +set lb [listbox $_sa.lb -width 0] +$_sa setwidget $lb +grid $_sa -row $row -rowspan 6 -column 0 -sticky w -padx {10 0} -pady {5 0} + +# +# A ttk::combobox widget +# +set l [ttk::label $cf.l$row -text "Release:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {5 0} +ttk::style map TCombobox -fieldbackground {readonly white} +set cb [ttk::combobox $cf.cb -state readonly -width 14] +grid $cb -row $row -column 2 -sticky w -padx {5 10} -pady {5 0} + +# +# A ttk::spinbox widget +# +incr row +set l [ttk::label $cf.l$row -text "Changes:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {10 0} +ttk::style map TSpinbox -fieldbackground {readonly white} +set sb [ttk::spinbox $cf.sb -from 0 -to 20 -state readonly -width 4] +grid $sb -row $row -column 2 -sticky w -padx {5 10} -pady {10 0} + +# +# A ttk::entry widget +# +incr row +set l [ttk::label $cf.l$row -text "Comment:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {10 0} +set e [ttk::entry $cf.e -width 32] +grid $e -row $row -column 2 -sticky w -padx {5 10} -pady {10 0} + +# +# A ttk::separator widget +# +incr row +set sep [ttk::separator $cf.sep] +grid $sep -row $row -column 1 -columnspan 2 -sticky we -padx 10 -pady {10 0} + +# +# A mentry widget of type "Date" +# +incr row +set l [ttk::label $cf.l$row -text "Date of first release:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {10 0} +set me [mentry::dateMentry $cf.me Ymd -] +grid $me -row $row -column 2 -sticky w -padx {5 10} -pady {10 0} + +incr row +grid rowconfigure $cf $row -weight 1 + +# +# A scrolled tablelist widget +# +incr row +set l [ttk::label $cf.l$row -text \ + "Tablelist release statistics, displayed in a tablelist widget:"] +grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} +incr row +set _sa [scrollutil::scrollarea $cf.sa$row] +set tbl [tablelist::tablelist $_sa.tbl \ + -columns {0 "Release" left 0 "Changes" right 0 "Comment" left} \ + -height 16 -width 0 -showseparators yes -stripebackground #f0f0f0 \ + -incrarrowtype down -labelcommand tablelist::sortByColumn] +if {[$tbl cget -selectborderwidth] == 0} { + $tbl configure -spacing 1 +} +$tbl columnconfigure 0 -name release -sortmode dictionary +$tbl columnconfigure 1 -name changes -sortmode integer +$tbl columnconfigure 2 -name comment +$_sa setwidget $tbl +grid $_sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 0} + +# +# A scrolled ttk::treeview widget +# +incr row +set l [ttk::label $cf.l$row -text \ + "Tablelist release statistics, displayed in a ttk::treeview widget:"] +grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} +incr row +set _sa [scrollutil::scrollarea $cf.sa$row -borderwidth 0] +set tv [ttk::treeview $_sa.tv -columns {release changes comment} \ + -show headings -height 16 -selectmode browse] +$tv heading release -text " Release" -anchor w +$tv heading changes -text "Changes " -anchor e +$tv heading comment -text " Comment" -anchor w +$tv column release -anchor w +$tv column changes -anchor e +$tv column comment -anchor w +$_sa setwidget $tv +grid $_sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 10} + +grid columnconfigure $cf 2 -weight 1 + +# +# Populate the widgets +# + +set chan [open [file join $tablelist::library "CHANGES.txt"]] +set content [read -nonewline $chan] +close $chan +$txt insert end $content + +# +# Make the text widget readonly +# +$txt configure -insertwidth 0 +wcb::callback $txt before insert cancelEdit +wcb::callback $txt before delete cancelEdit + +set lineList [split $content "\n"] +set totalChanges 0 +set lineIdx 0 +set latest true +foreach line $lineList { + if {[string match "What *" $line]} { + if {$lineIdx != 0} { + if {$changes == 0} { + set changes 1 + } + switch $version { + 6.0 { set comment "Added support for header items" } + 5.0 { set comment "Added support for tree functionality" } + 4.0 { set comment "Added support for the tile engine" } + 3.0 { set comment "Added support for interactive cell editing" } + 2.0 { set comment "Added support for embedded images" } + default { + if {$latest} { + set comment "Latest release" + set latest false + } else { + set comment "" + } + } + } + set item [list "Tablelist $version" $changes $comment] + $tbl insert end $item + $tv insert {} end -values $item + incr totalChanges $changes + } + + set idx [string last " " $line] + set version [string range $line [incr idx] end-1] + $lb insert end "Tablelist $version" + + set changes 0 + } elseif {[string match {[1-9]*} $line]} { + incr changes + } + + incr lineIdx +} + +if {$changes == 0} { + set changes 1 +} +set comment "" +set item [list "Tablelist $version" $changes $comment] +$tbl insert end $item +$tv insert {} end -values $item +incr totalChanges $changes + +$lb insert end "Tablelist 0.8" +set item [list "Tablelist 0.8" 0 "First release, on 2000-10-27"] +$tbl insert end $item +$tv insert {} end -values $item + +$tbl header insert 0 \ + [list "All [$tbl size] releases" $totalChanges "Total number"] +$tbl header rowconfigure 0 -foreground blue + +$cb configure -values [$lb get 0 end] +$cb current 0 + +$sb set [$tbl getcells 0,changes] +$e insert 0 [$tbl getcells 0,comment] +$me put 0 2000 10 27 + +# +# Make the columns of the treeview as wide as those of the tablelist +# +foreach colId [$tv cget -columns] { + $tv column $colId -width [$tbl columnwidth $colId -total] +} + +# +# Set the ScrollableFrame's width, height, and yscrollincrement +# +update idletasks +set height [expr {[winfo reqheight $cf.l0] + [winfo reqheight $cf.sa1] + 25}] +$sf configure -width [winfo reqwidth $cf] -height $height \ + -yscrollincrement [expr {[winfo reqheight $lb] / 10}] + +pack $sa -expand yes -fill both -padx 10 -pady 10 + +# +# Create two ttk::button widgets within a frame outside the scrollarea +# +set bf [ttk::frame .bf] +set b1 [ttk::button $bf.b1 -text "Configure Tablelist Widget" \ + -command configTablelist] +set b2 [ttk::button $bf.b2 -text "Close" -command exit] +pack $b2 -side right -padx 10 -pady {0 10} +pack $b1 -side left -padx 10 -pady {0 10} + +pack $bf -side bottom -fill x +pack $tf -side top -expand yes -fill both + +#------------------------------------------------------------------------------ + +proc cancelEdit {w args} { + wcb::cancel +} + +#------------------------------------------------------------------------------ + +proc configTablelist {} { + set top .top + if {[winfo exists $top]} { + raise $top + focus $top + return "" + } + + toplevel $top + wm title $top "Tablelist Widget Configuration" + + # + # Create a ScrollableFrame within a scrollarea + # + set f [ttk::frame $top.f] + set sa [scrollutil::scrollarea $f.sa] + set sf [ScrollableFrame $sa.sf -constrainedwidth yes] + $sa setwidget $sf + + # + # Work around a tile bug which is not handled in + # the BWidget procedure ScrollableFrame::create + # + if {$ttk::currentTheme eq "aqua"} { + $sf:cmd configure -background #ececec + } + + # + # Register the ScrollableFrame for scrolling by the mouse wheel event + # bindings created by the scrollutil::createWheelEventBindings command + # + scrollutil::enableScrollingByWheel $sf + + # + # Get the content frame + # + set cf [$sf getframe] + + # + # Create some widgets in the content frame, corresponding + # to the configuration options of the tablelist widget + # + global tbl + set row 0 + foreach configSet [$tbl configure] { + if {[llength $configSet] != 5} { + continue + } + + set opt [lindex $configSet 0] + set w [ttk::label $cf.l$row -text $opt] + grid $w -row $row -column 0 -sticky w -padx {5 0} -pady {5 0} + + set w $cf.w$row + switch -- $opt { + -activestyle - + -arrowstyle - + -incrarrowtype - + -labelrelief - + -relief - + -selectmode - + -selecttype - + -state - + -treestyle { + ttk::combobox $w -state readonly -width 12 + + switch -- $opt { + -activestyle { set values {frame none underline} } + -arrowstyle { + set values {flat5x3 flat5x4 flat6x4 flat7x4 flat7x5 + flat7x7 flat8x4 flat8x5 flat9x5 flat9x6 flat11x6 + flat15x8 flatAngle7x4 flatAngle7x5 flatAngle9x5 + flatAngle9x6 flatAngle9x7 flatAngle10x6 + flatAngle10x7 flatAngle11x6 flatAngle15x8 photo7x4 + photo7x7 photo9x5 photo11x6 photo15x8 sunken8x7 + sunken10x9 sunken12x11} + } + -incrarrowtype { set values {up down} } + -labelrelief - + -relief { + set values {flat groove raised ridge solid sunken} + } + -selectmode { + set values {single browse multiple extended} + } + -selecttype { set values {row cell} } + -state { set values {disabled normal} } + -treestyle { + set values {adwaita ambiance aqua arc baghira bicolor1 + bicolor2 bicolor3 bicolor4 blueMenta classic1 classic2 + classic3 classic4 dust dustSand gtk klearlooks mate + menta mint mint2 newWave oxygen1 oxygen2 phase plain1 + plain2 plain3 plain4 plastik plastique radiance ubuntu + ubuntu2 ubuntu3 ubuntuMate vistaAero vistaClassic + win7Aero win7Classic win10 winnative winxpBlue + winxpOlive winxpSilver yuyo} + } + } + + $w configure -values $values + $w set [$tbl cget $opt] + bind $w <> [list applyValue %W $opt] + grid $w -row $row -column 1 -sticky w -padx 5 -pady {5 0} + + # + # Adapt the handling of the mouse wheel + # events for the ttk::combobox widget + # + scrollutil::adaptWheelEventHandling $w + } + + -autofinishediting - + -autoscan - + -customdragsource - + -displayondemand - + -editselectedonly - + -exportselection - + -forceeditendcommand - + -fullseparators - + -instanttoggle - + -movablecolumns - + -movablerows - + -protecttitlecolumns - + -resizablecolumns - + -setfocus - + -setgrid - + -showarrow - + -showbusycursor - + -showeditcursor - + -showhorizseparator - + -showlabels - + -showseparators - + -tight { + ttk::checkbutton $w -command [list applyBoolean $w $opt] + global $w + set $w [$tbl cget $opt] + $w configure -text [expr {[set $w] ? "true": "false"}] + grid $w -row $row -column 1 -sticky w -padx 5 -pady {5 0} + } + + -borderwidth - + -height - + -highlightthickness - + -labelborderwidth - + -labelheight - + -labelpady - + -selectborderwidth - + -spacing - + -stripeheight - + -titlecolumns - + -treecolumn - + -width { + ttk::spinbox $w -from 0 -to 999 -width 4 -command \ + [list applyValue $w $opt] + $w set [$tbl cget $opt] + $w configure -invalidcommand bell -validate key \ + -validatecommand \ + {expr {[string length %P] <= 3 && [regexp {^[0-9]*$} %S]}} + foreach event { } { + bind $w $event [list applyValue %W $opt] + } + grid $w -row $row -column 1 -sticky w -padx 5 -pady {5 0} + + # + # Adapt the handling of the mouse wheel + # events for the ttk::spinbox widget + # + scrollutil::adaptWheelEventHandling $w + } + + default { + ttk::entry $w -width 20 + $w insert 0 [$tbl cget $opt] + foreach event { } { + bind $w $event [list applyValue %W $opt] + } + grid $w -row $row -column 1 -sticky we -padx 5 -pady {5 0} + } + } + + incr row + } + + grid rowconfigure $cf all -uniform AllRows + grid columnconfigure $cf 1 -weight 1 + + # + # Set the ScrollableFrame's width, height, and yscrollincrement + # + update idletasks + set rowHeight [expr {[winfo reqheight $cf] / $row}] + $sf configure -width [winfo reqwidth $cf] \ + -height [expr {10*$rowHeight + 5}] -yscrollincrement $rowHeight + + # + # Create a ttk::button widget outside the scrollarea + # + set b [ttk::button $f.b -text "Close" -command [list destroy $top]] + + pack $b -side bottom -pady {0 10} + pack $sa -side top -expand yes -fill both -padx 10 -pady 10 + pack $f -expand yes -fill both +} + +#------------------------------------------------------------------------------ + +proc applyValue {w opt} { + global tbl + if {[catch {$tbl configure $opt [$w get]} result] != 0} { + bell + tk_messageBox -title "Error" -icon error -message $result \ + -parent [winfo toplevel $w] + ### $w set [$tbl cget $opt] ;# not supported by ttk::entry + $w delete 0 end + $w insert 0 [$tbl cget $opt] + } +} + +#------------------------------------------------------------------------------ + +proc applyBoolean {w opt} { + global tbl $w + set val [set $w] + $tbl configure $opt $val + $w configure -text [expr {$val ? "true" : "false"}] +} diff --git a/examples/scrollutil/ScrollableFrmDemo1.tcl b/examples/scrollutil/ScrollableFrmDemo1.tcl new file mode 100755 index 00000000..0b0c2495 --- /dev/null +++ b/examples/scrollutil/ScrollableFrmDemo1.tcl @@ -0,0 +1,131 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the use of the Scrollutil package in connection with the BWidget +# ScrollableFrame widget. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require Tk 8.5 +package require BWidget +Widget::theme yes +package require scrollutil_tile + +wm title . "European Capitals Quiz" + +# +# Create a ScrollableFrame within a scrollarea +# +set f [ttk::frame .f] +set sa [scrollutil::scrollarea $f.sa] +set sf [ScrollableFrame $sa.sf] +$sa setwidget $sf + +# +# Work around a tile bug which is not handled in +# the BWidget procedure ScrollableFrame::create +# +if {$ttk::currentTheme eq "aqua"} { + $sf:cmd configure -background #ececec +} + +# +# Create mouse wheel event bindings for the binding tag "all" and +# register the ScrollableFrame for scrolling by these bindings +# +scrollutil::createWheelEventBindings all +scrollutil::enableScrollingByWheel $sf + +# +# Get the content frame and populate it +# + +set cf [$sf getframe] + +set countryList { + Albania Andorra Austria Belarus Belgium "Bosnia and Herzegovina" Bulgaria + Croatia Cyprus "Czech Republic" Denmark Estonia Finland France Germany + Greece Hungary Iceland Ireland Italy Kosovo Latvia Liechtenstein Lithuania + Luxembourg Macedonia Malta Moldova Monaco Montenegro Netherlands Norway + Poland Portugal Romania Russia "San Marino" Serbia Slovakia Slovenia + Spain Sweden Switzerland Ukraine "United Kingdom" "Vatican City" +} +set capitalList { + Tirana "Andorra la Vella" Vienna Minsk Brussels Sarajevo Sofia + Zagreb Nicosia Prague Copenhagen Tallinn Helsinki Paris Berlin + Athens Budapest Reykjavik Dublin Rome Pristina Riga Vaduz Vilnius + Luxembourg Skopje Valletta Chisinau Monaco Podgorica Amsterdam Oslo + Warsaw Lisbon Bucharest Moscow "San Marino" Belgrade Bratislava Ljubljana + Madrid Stockholm Bern Kiev London "Vatican City" +} + +foreach country $countryList capital $capitalList { + set capitalArr($country) $capital +} + +set capitalList [lsort $capitalList] + +ttk::style map TCombobox -fieldbackground {readonly white} +set btnStyle [expr {$::ttk::currentTheme eq "aqua" ? "TButton" : "Toolbutton"}] + +set row 0 +foreach country $countryList { + set w [ttk::label $cf.l$row -text $country] + grid $w -row $row -column 0 -sticky w -padx {5 0} -pady {4 0} + + set w [ttk::combobox $cf.cb$row -state readonly -width 14 \ + -values $capitalList] + bind $w <> [list checkCapital %W $country] + grid $w -row $row -column 1 -sticky w -padx {5 0} -pady {4 0} + + # + # Adapt the handling of the mouse wheel events for the ttk::combobox widget + # + scrollutil::adaptWheelEventHandling $w + + set b [ttk::button $cf.b$row -style $btnStyle -text "Resolve" \ + -command [list setCapital $w $country]] + grid $b -row $row -column 2 -sticky w -padx 5 -pady {4 0} + + incr row +} + +# +# Set the ScrollableFrame's width, height, and yscrollincrement +# +update idletasks +set rowHeight [expr {[winfo reqheight $cf] / $row}] +$sf configure -width [winfo reqwidth $cf] \ + -height [expr {10*$rowHeight + 5}] -yscrollincrement $rowHeight + +# +# Create a ttk::button widget outside the scrollarea +# +set b [ttk::button $f.b -text "Close" -command exit] + +pack $b -side bottom -pady {0 10} +pack $sa -side top -expand yes -fill both -padx 10 -pady 10 +pack $f -expand yes -fill both + +#------------------------------------------------------------------------------ + +proc checkCapital {w country} { + $w selection clear + global capitalArr + if {[$w get] eq $capitalArr($country)} { + $w configure -foreground "" + } else { + bell + $w configure -foreground red + } +} + +#------------------------------------------------------------------------------ + +proc setCapital {w country} { + $w selection clear + $w configure -foreground "" + global capitalArr + $w set $capitalArr($country) +} diff --git a/examples/scrollutil/ScrollableFrmDemo2.tcl b/examples/scrollutil/ScrollableFrmDemo2.tcl new file mode 100755 index 00000000..3e43474c --- /dev/null +++ b/examples/scrollutil/ScrollableFrmDemo2.tcl @@ -0,0 +1,65 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the use of the Scrollutil package in connection with the BWidget +# ScrollableFrame widget. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require Tk 8.5.9 ;# for ttk::spinbox +package require BWidget +Widget::theme yes +package require mentry_tile 3.2 ;# for mouse wheel support +package require tablelist_tile 6.5 ;# for -(x|y)mousewheelwindow + ;# and scrollutil::scrollarea +package require scrollutil_tile + +wm title . "Scrollutil Demo" + +# +# Create a ScrollableFrame within a scrollarea +# +set tf [ttk::frame .tf] +set sa [scrollutil::scrollarea $tf.sa] +set sf [ScrollableFrame $sa.sf] +$sa setwidget $sf + +# +# Work around a tile bug which is not handled in +# the BWidget procedure ScrollableFrame::create +# +if {$ttk::currentTheme eq "aqua"} { + $sf:cmd configure -background #ececec +} + +# +# Get the content frame and populate it +# +set cf [$sf getframe] +source ScrollableFrmContent.tcl + +# +# Additional stuff related to the mouse wheel events: +# + +# +# Create mouse wheel event bindings for the binding tag "all" and +# register the ScrollableFrame for scrolling by these bindings +# +scrollutil::createWheelEventBindings all +scrollutil::enableScrollingByWheel $sf + +# +# Adapt the handling of the mouse wheel events for the text, listbox, +# ttk::combobox, ttk::spinbox, tablelist, and ttk::treeview widgets, as +# well as for the entry components of the mentry widget of type "Date" +# +set entryList [$me entries] +scrollutil::adaptWheelEventHandling $txt $lb $cb $sb $tbl $tv {*}$entryList + +# +# For the entry components of the mentry widget +# set the "focus check window" to the mentry +# +scrollutil::setFocusCheckWindow {*}$entryList $me diff --git a/examples/scrollutil/ScrolledFrmContent.tcl b/examples/scrollutil/ScrolledFrmContent.tcl new file mode 100644 index 00000000..7eba8138 --- /dev/null +++ b/examples/scrollutil/ScrolledFrmContent.tcl @@ -0,0 +1,498 @@ +#============================================================================== +# Populates the content frame of the iwidgets::scrolledframe widget created in +# the demo script ScrolledFrm.tcl. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +# +# Add some entries to the Tk option database +# +tablelist::setThemeDefaults +if {$ttk::currentTheme eq "aqua"} { + option add *Listbox.selectBackground \ + $tablelist::themeDefaults(-selectbackground) + option add *Listbox.selectForeground \ + $tablelist::themeDefaults(-selectforeground) +} else { + option add *selectBackground $tablelist::themeDefaults(-selectbackground) + option add *selectForeground $tablelist::themeDefaults(-selectforeground) +} +option add *selectBorderWidth $tablelist::themeDefaults(-selectborderwidth) + +# +# Create some widgets in the content frame +# + +# +# A scrolled text widget +# +set row 0 +set l [ttk::label $cf.l$row -text \ + "Contents of the Tablelist distribution file \"CHANGES.txt\":"] +grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} +incr row +set sa [scrollutil::scrollarea $cf.sa$row] +set txt [text $sa.txt -font TkFixedFont -width 73] +$sa setwidget $txt +grid $sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 0} + +# +# A scrolled listbox widget +# +incr row +set l [ttk::label $cf.l$row -text "Tablelist releases:"] +grid $l -row $row -column 0 -sticky w -padx {10 0} -pady {10 0} +incr row +set sa [scrollutil::scrollarea $cf.sa$row] +set lb [listbox $sa.lb -width 0] +$sa setwidget $lb +grid $sa -row $row -rowspan 6 -column 0 -sticky w -padx {10 0} -pady {5 0} + +# +# A ttk::combobox widget +# +set l [ttk::label $cf.l$row -text "Release:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {5 0} +ttk::style map TCombobox -fieldbackground {readonly white} +set cb [ttk::combobox $cf.cb -state readonly -width 14] +grid $cb -row $row -column 2 -sticky w -padx {5 10} -pady {5 0} + +# +# A ttk::spinbox widget +# +incr row +set l [ttk::label $cf.l$row -text "Changes:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {10 0} +ttk::style map TSpinbox -fieldbackground {readonly white} +set sb [ttk::spinbox $cf.sb -from 0 -to 20 -state readonly -width 4] +grid $sb -row $row -column 2 -sticky w -padx {5 10} -pady {10 0} + +# +# A ttk::entry widget +# +incr row +set l [ttk::label $cf.l$row -text "Comment:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {10 0} +set e [ttk::entry $cf.e -width 32] +grid $e -row $row -column 2 -sticky w -padx {5 10} -pady {10 0} + +# +# A ttk::separator widget +# +incr row +set sep [ttk::separator $cf.sep] +grid $sep -row $row -column 1 -columnspan 2 -sticky we -padx 10 -pady {10 0} + +# +# A mentry widget of type "Date" +# +incr row +set l [ttk::label $cf.l$row -text "Date of first release:"] +grid $l -row $row -column 1 -sticky w -padx {10 0} -pady {10 0} +set me [mentry::dateMentry $cf.me Ymd -] +grid $me -row $row -column 2 -sticky w -padx {5 10} -pady {10 0} + +incr row +grid rowconfigure $cf $row -weight 1 + +# +# A scrolled tablelist widget +# +incr row +set l [ttk::label $cf.l$row -text \ + "Tablelist release statistics, displayed in a tablelist widget:"] +grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} +incr row +set sa [scrollutil::scrollarea $cf.sa$row] +set tbl [tablelist::tablelist $sa.tbl \ + -columns {0 "Release" left 0 "Changes" right 0 "Comment" left} \ + -height 16 -width 0 -showseparators yes -stripebackground #f0f0f0 \ + -incrarrowtype down -labelcommand tablelist::sortByColumn] +if {[$tbl cget -selectborderwidth] == 0} { + $tbl configure -spacing 1 +} +$tbl columnconfigure 0 -name release -sortmode dictionary +$tbl columnconfigure 1 -name changes -sortmode integer +$tbl columnconfigure 2 -name comment +$sa setwidget $tbl +grid $sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 0} + +# +# A scrolled ttk::treeview widget +# +incr row +set l [ttk::label $cf.l$row -text \ + "Tablelist release statistics, displayed in a ttk::treeview widget:"] +grid $l -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {10 0} +incr row +set sa [scrollutil::scrollarea $cf.sa$row -borderwidth 0] +set tv [ttk::treeview $sa.tv -columns {release changes comment} \ + -show headings -height 16 -selectmode browse] +$tv heading release -text " Release" -anchor w +$tv heading changes -text "Changes " -anchor e +$tv heading comment -text " Comment" -anchor w +$tv column release -anchor w +$tv column changes -anchor e +$tv column comment -anchor w +$sa setwidget $tv +grid $sa -row $row -column 0 -columnspan 3 -sticky w -padx 10 -pady {5 10} + +grid columnconfigure $cf 2 -weight 1 + +# +# Populate the widgets +# + +set chan [open [file join $tablelist::library "CHANGES.txt"]] +set content [read -nonewline $chan] +close $chan +$txt insert end $content + +# +# Make the text widget readonly +# +$txt configure -insertwidth 0 +wcb::callback $txt before insert cancelEdit +wcb::callback $txt before delete cancelEdit + +set lineList [split $content "\n"] +set totalChanges 0 +set lineIdx 0 +set latest true +foreach line $lineList { + if {[string match "What *" $line]} { + if {$lineIdx != 0} { + if {$changes == 0} { + set changes 1 + } + switch $version { + 6.0 { set comment "Added support for header items" } + 5.0 { set comment "Added support for tree functionality" } + 4.0 { set comment "Added support for the tile engine" } + 3.0 { set comment "Added support for interactive cell editing" } + 2.0 { set comment "Added support for embedded images" } + default { + if {$latest} { + set comment "Latest release" + set latest false + } else { + set comment "" + } + } + } + set item [list "Tablelist $version" $changes $comment] + $tbl insert end $item + $tv insert {} end -values $item + incr totalChanges $changes + } + + set idx [string last " " $line] + set version [string range $line [incr idx] end-1] + $lb insert end "Tablelist $version" + + set changes 0 + } elseif {[string match {[1-9]*} $line]} { + incr changes + } + + incr lineIdx +} + +if {$changes == 0} { + set changes 1 +} +set comment "" +set item [list "Tablelist $version" $changes $comment] +$tbl insert end $item +$tv insert {} end -values $item +incr totalChanges $changes + +$lb insert end "Tablelist 0.8" +set item [list "Tablelist 0.8" 0 "First release, on 2000-10-27"] +$tbl insert end $item +$tv insert {} end -values $item + +$tbl header insert 0 \ + [list "All [$tbl size] releases" $totalChanges "Total number"] +$tbl header rowconfigure 0 -foreground blue + +$cb configure -values [$lb get 0 end] +$cb current 0 + +$sb set [$tbl getcells 0,changes] +$e insert 0 [$tbl getcells 0,comment] +$me put 0 2000 10 27 + +# +# Make the columns of the treeview as wide as those of the tablelist +# +foreach colId [$tv cget -columns] { + $tv column $colId -width [$tbl columnwidth $colId -total] +} + +pack $sf -expand yes -fill both -padx 10 -pady 10 + +# +# Set the scrolledframe's width, height, and yscrollincrement +# +update idletasks +set vsb [$sf component vertsb] +set width [expr {[winfo reqwidth $cf] + [winfo reqwidth $vsb] + 2}] +set height [expr {[winfo reqheight $cf.l0] + [winfo reqheight $cf.sa1] + 27}] +$sf configure -width $width -height $height +$canvas configure -yscrollincrement [expr {[winfo reqheight $lb] / 10}] +after 200 [list $sf configure -hscrollmode dynamic] + +# +# Create two ttk::button widgets within a frame outside the scrolledframe +# +set bf [ttk::frame .bf] +set b1 [ttk::button $bf.b1 -text "Configure Tablelist Widget" \ + -command configTablelist] +set b2 [ttk::button $bf.b2 -text "Close" -command exit] +pack $b2 -side right -padx 10 -pady {0 10} +pack $b1 -side left -padx 10 -pady {0 10} + +pack $bf -side bottom -fill x +pack $tf -side top -expand yes -fill both + +#------------------------------------------------------------------------------ + +proc cancelEdit {w args} { + wcb::cancel +} + +#------------------------------------------------------------------------------ + +proc configTablelist {} { + set top .top + if {[winfo exists $top]} { + raise $top + focus $top + return "" + } + + toplevel $top + wm title $top "Tablelist Widget Configuration" + + # + # Create a scrolledframe + # + set f [ttk::frame $top.f] + set sf [iwidgets::scrolledframe $f.sf -borderwidth 1 -relief sunken \ + -scrollmargin 0 -hscrollmode none] + + # + # Unfortunately, the iwidgets::scrolledframe widget has + # no built-in equivalents of the BWidget ScrollableFrame + # widget options -constrainedwidth and -yscrollincrement + # + set canvas [$sf component canvas] + bind $canvas { + %W itemconfigure frameTag -width [winfo width %W] + } + $canvas configure -background $::bg + + # + # Register the scrolledframe for scrolling by the mouse wheel event + # bindings created by the scrollutil::createWheelEventBindings command + # + scrollutil::enableScrollingByWheel $sf + + # + # Get the content frame + # + set cf [$sf childsite] + $cf configure -background $::bg + + # + # Create some widgets in the content frame, corresponding + # to the configuration options of the tablelist widget + # + global tbl + set row 0 + foreach configSet [$tbl configure] { + if {[llength $configSet] != 5} { + continue + } + + set opt [lindex $configSet 0] + set w [ttk::label $cf.l$row -text $opt] + grid $w -row $row -column 0 -sticky w -padx {5 0} -pady {5 0} + + set w $cf.w$row + switch -- $opt { + -activestyle - + -arrowstyle - + -incrarrowtype - + -labelrelief - + -relief - + -selectmode - + -selecttype - + -state - + -treestyle { + ttk::combobox $w -state readonly -width 12 + + switch -- $opt { + -activestyle { set values {frame none underline} } + -arrowstyle { + set values {flat5x3 flat5x4 flat6x4 flat7x4 flat7x5 + flat7x7 flat8x4 flat8x5 flat9x5 flat9x6 flat11x6 + flat15x8 flatAngle7x4 flatAngle7x5 flatAngle9x5 + flatAngle9x6 flatAngle9x7 flatAngle10x6 + flatAngle10x7 flatAngle11x6 flatAngle15x8 photo7x4 + photo7x7 photo9x5 photo11x6 photo15x8 sunken8x7 + sunken10x9 sunken12x11} + } + -incrarrowtype { set values {up down} } + -labelrelief - + -relief { + set values {flat groove raised ridge solid sunken} + } + -selectmode { + set values {single browse multiple extended} + } + -selecttype { set values {row cell} } + -state { set values {disabled normal} } + -treestyle { + set values {adwaita ambiance aqua arc baghira bicolor1 + bicolor2 bicolor3 bicolor4 blueMenta classic1 classic2 + classic3 classic4 dust dustSand gtk klearlooks mate + menta mint mint2 newWave oxygen1 oxygen2 phase plain1 + plain2 plain3 plain4 plastik plastique radiance ubuntu + ubuntu2 ubuntu3 ubuntuMate vistaAero vistaClassic + win7Aero win7Classic win10 winnative winxpBlue + winxpOlive winxpSilver yuyo} + } + } + + $w configure -values $values + $w set [$tbl cget $opt] + bind $w <> [list applyValue %W $opt] + grid $w -row $row -column 1 -sticky w -padx 5 -pady {5 0} + + # + # Adapt the handling of the mouse wheel + # events for the ttk::combobox widget + # + scrollutil::adaptWheelEventHandling $w + } + + -autofinishediting - + -autoscan - + -customdragsource - + -displayondemand - + -editselectedonly - + -exportselection - + -forceeditendcommand - + -fullseparators - + -instanttoggle - + -movablecolumns - + -movablerows - + -protecttitlecolumns - + -resizablecolumns - + -setfocus - + -setgrid - + -showarrow - + -showbusycursor - + -showeditcursor - + -showhorizseparator - + -showlabels - + -showseparators - + -tight { + ttk::checkbutton $w -command [list applyBoolean $w $opt] + global $w + set $w [$tbl cget $opt] + $w configure -text [expr {[set $w] ? "true": "false"}] + grid $w -row $row -column 1 -sticky w -padx 5 -pady {5 0} + } + + -borderwidth - + -height - + -highlightthickness - + -labelborderwidth - + -labelheight - + -labelpady - + -selectborderwidth - + -spacing - + -stripeheight - + -titlecolumns - + -treecolumn - + -width { + ttk::spinbox $w -from 0 -to 999 -width 4 -command \ + [list applyValue $w $opt] + $w set [$tbl cget $opt] + $w configure -invalidcommand bell -validate key \ + -validatecommand \ + {expr {[string length %P] <= 3 && [regexp {^[0-9]*$} %S]}} + foreach event { } { + bind $w $event [list applyValue %W $opt] + } + grid $w -row $row -column 1 -sticky w -padx 5 -pady {5 0} + + # + # Adapt the handling of the mouse wheel + # events for the ttk::spinbox widget + # + scrollutil::adaptWheelEventHandling $w + } + + default { + ttk::entry $w -width 20 + $w insert 0 [$tbl cget $opt] + foreach event { } { + bind $w $event [list applyValue %W $opt] + } + grid $w -row $row -column 1 -sticky we -padx 5 -pady {5 0} + } + } + + incr row + } + + grid rowconfigure $cf all -uniform AllRows + grid columnconfigure $cf 1 -weight 1 + + # + # Set the scrolledframe's width, height, and yscrollincrement + # + update idletasks + set vsb [$sf component vertsb] + set width [expr {[winfo reqwidth $cf] + [winfo reqwidth $vsb] + 2}] + set rowHeight [expr {[winfo reqheight $cf] / $row}] + $sf configure -width $width -height [expr {10*$rowHeight + 7}] + $canvas configure -yscrollincrement $rowHeight + + # + # Create a ttk::button widget outside the scrolledframe + # + set b [ttk::button $f.b -text "Close" -command [list destroy $top]] + + pack $b -side bottom -pady {0 10} + pack $sf -side top -expand yes -fill both -padx 10 -pady 10 + pack $f -expand yes -fill both +} + +#------------------------------------------------------------------------------ + +proc applyValue {w opt} { + global tbl + if {[catch {$tbl configure $opt [$w get]} result] != 0} { + bell + tk_messageBox -title "Error" -icon error -message $result \ + -parent [winfo toplevel $w] + ### $w set [$tbl cget $opt] ;# not supported by ttk::entry + $w delete 0 end + $w insert 0 [$tbl cget $opt] + } +} + +#------------------------------------------------------------------------------ + +proc applyBoolean {w opt} { + global tbl $w + set val [set $w] + $tbl configure $opt $val + $w configure -text [expr {$val ? "true" : "false"}] +} diff --git a/examples/scrollutil/ScrolledFrmDemo1.tcl b/examples/scrollutil/ScrolledFrmDemo1.tcl new file mode 100755 index 00000000..01cf881d --- /dev/null +++ b/examples/scrollutil/ScrolledFrmDemo1.tcl @@ -0,0 +1,136 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the use of the Scrollutil package in connection with the +# iwidgets::scrolledframe widget. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require Tk 8.5 +if {[catch {package require iwidgets} result1] != 0 && + [catch {package require Iwidgets} result2] != 0} { + error "$result1; $result2" +} +source scrolledwidgetPatch.itk ;# adds ttk::scrollbar widgets +package require scrollutil + +wm title . "European Capitals Quiz" + +set bg [ttk::style lookup TFrame -background] +if {$ttk::currentTheme eq "aqua"} { + set bg #ececec ;# workaround for a tile bug +} + +# +# Create a scrolledframe +# +set f [ttk::frame .f] +set sf [iwidgets::scrolledframe $f.sf -borderwidth 1 -relief sunken \ + -scrollmargin 0] +set canvas [$sf component canvas] +$canvas configure -background $bg + +# +# Create mouse wheel event bindings for the binding tag "all" and +# register the scrolledframe for scrolling by these bindings +# +scrollutil::createWheelEventBindings all +scrollutil::enableScrollingByWheel $sf + +# +# Get the content frame and populate it +# + +set cf [$sf childsite] +$cf configure -background $bg + +set countryList { + Albania Andorra Austria Belarus Belgium "Bosnia and Herzegovina" Bulgaria + Croatia Cyprus "Czech Republic" Denmark Estonia Finland France Germany + Greece Hungary Iceland Ireland Italy Kosovo Latvia Liechtenstein Lithuania + Luxembourg Macedonia Malta Moldova Monaco Montenegro Netherlands Norway + Poland Portugal Romania Russia "San Marino" Serbia Slovakia Slovenia + Spain Sweden Switzerland Ukraine "United Kingdom" "Vatican City" +} +set capitalList { + Tirana "Andorra la Vella" Vienna Minsk Brussels Sarajevo Sofia + Zagreb Nicosia Prague Copenhagen Tallinn Helsinki Paris Berlin + Athens Budapest Reykjavik Dublin Rome Pristina Riga Vaduz Vilnius + Luxembourg Skopje Valletta Chisinau Monaco Podgorica Amsterdam Oslo + Warsaw Lisbon Bucharest Moscow "San Marino" Belgrade Bratislava Ljubljana + Madrid Stockholm Bern Kiev London "Vatican City" +} + +foreach country $countryList capital $capitalList { + set capitalArr($country) $capital +} + +set capitalList [lsort $capitalList] + +ttk::style map TCombobox -fieldbackground {readonly white} +set btnStyle [expr {$::ttk::currentTheme eq "aqua" ? "TButton" : "Toolbutton"}] + +set row 0 +foreach country $countryList { + set w [ttk::label $cf.l$row -text $country] + grid $w -row $row -column 0 -sticky w -padx {5 0} -pady {4 0} + + set w [ttk::combobox $cf.cb$row -state readonly -width 14 \ + -values $capitalList] + bind $w <> [list checkCapital %W $country] + grid $w -row $row -column 1 -sticky w -padx {5 0} -pady {4 0} + + # + # Adapt the handling of the mouse wheel events for the ttk::combobox widget + # + scrollutil::adaptWheelEventHandling $w + + set b [ttk::button $cf.b$row -style $btnStyle -text "Resolve" \ + -command [list setCapital $w $country]] + grid $b -row $row -column 2 -sticky w -padx 5 -pady {4 0} + + incr row +} + +# +# Set the scrolledframe's width, height, and yscrollincrement +# +update idletasks +set vsb [$sf component vertsb] +set width [expr {[winfo reqwidth $cf] + [winfo reqwidth $vsb] + 2}] +set rowHeight [expr {[winfo reqheight $cf] / $row}] +$sf configure -width $width -height [expr {10*$rowHeight + 7}] +$canvas configure -yscrollincrement $rowHeight +after 100 [list $sf configure -hscrollmode dynamic] + +# +# Create a ttk::button widget outside the scrolledframe +# +set b [ttk::button $f.b -text "Close" -command exit] + +pack $b -side bottom -pady {0 10} +pack $sf -side top -expand yes -fill both -padx 10 -pady 10 +pack $f -expand yes -fill both + +#------------------------------------------------------------------------------ + +proc checkCapital {w country} { + $w selection clear + global capitalArr + if {[$w get] eq $capitalArr($country)} { + $w configure -foreground "" + } else { + bell + $w configure -foreground red + } +} + +#------------------------------------------------------------------------------ + +proc setCapital {w country} { + $w selection clear + $w configure -foreground "" + global capitalArr + $w set $capitalArr($country) +} diff --git a/examples/scrollutil/ScrolledFrmDemo2.tcl b/examples/scrollutil/ScrolledFrmDemo2.tcl new file mode 100755 index 00000000..fc0e5e31 --- /dev/null +++ b/examples/scrollutil/ScrolledFrmDemo2.tcl @@ -0,0 +1,67 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the use of the Scrollutil package in connection with the +# iwidgets::scrolledframe widget. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require Tk 8.5.9 ;# for ttk::spinbox +if {[catch {package require iwidgets} result1] != 0 && + [catch {package require Iwidgets} result2] != 0} { + error "$result1; $result2" +} +source scrolledwidgetPatch.itk ;# adds ttk::scrollbar widgets +package require mentry_tile 3.2 ;# for mouse wheel support +package require tablelist_tile 6.5 ;# for -(x|y)mousewheelwindow + ;# and scrollutil::scrollarea +package require scrollutil_tile + +wm title . "Scrollutil Demo" + +set bg [ttk::style lookup TFrame -background] +if {$ttk::currentTheme eq "aqua"} { + set bg #ececec ;# workaround for a tile bug +} + +# +# Create a scrolledframe +# +set tf [ttk::frame .tf] +set sf [iwidgets::scrolledframe $tf.sf -borderwidth 1 -relief sunken \ + -scrollmargin 0] +set canvas [$sf component canvas] +$canvas configure -background $bg + +# +# Get the content frame and populate it +# +set cf [$sf childsite] +$cf configure -background $bg +source ScrolledFrmContent.tcl + +# +# Additional stuff related to the mouse wheel events: +# + +# +# Create mouse wheel event bindings for the binding tag "all" +# and register the scrolledframe for scrolling by these bindings +# +scrollutil::createWheelEventBindings all +scrollutil::enableScrollingByWheel $sf + +# +# Adapt the handling of the mouse wheel events for the text, listbox, +# ttk::combobox, ttk::spinbox, tablelist, and ttk::treeview widgets, as +# well as for the entry components of the mentry widget of type "Date" +# +set entryList [$me entries] +scrollutil::adaptWheelEventHandling $txt $lb $cb $sb $tbl $tv {*}$entryList + +# +# For the entry components of the mentry widget +# set the "focus check window" to the mentry +# +scrollutil::setFocusCheckWindow {*}$entryList $me diff --git a/examples/scrollutil/ScrolledTablelist1.tcl b/examples/scrollutil/ScrolledTablelist1.tcl new file mode 100755 index 00000000..588a6b1b --- /dev/null +++ b/examples/scrollutil/ScrolledTablelist1.tcl @@ -0,0 +1,85 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the traditional scrollbar management in connection with a +# tablelist widget. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require tablelist_tile 6.3 + +wm title . "Scrolled Tablelist" + +# +# Create the tablelist and the scrollbars as children +# of a frame having -borderwidth 1 and -relief sunken +# +set f [ttk::frame .f] +set frm [ttk::frame $f.frm -borderwidth 1 -relief sunken] +set tbl $frm.tbl +set vsb $frm.vsb +set hsb $frm.hsb +tablelist::tablelist $tbl -columntitles \ + {"Column 0" "Column 1" "Column 2" "Column 3" + "Column 4" "Column 5" "Column 6" "Column 7"} \ + -titlecolumns 1 -borderwidth 0 \ + -xscrollcommand [list $hsb set] -yscrollcommand [list $vsb set] +switch [tk windowingsystem] { + x11 { set width 53 } + win32 { set width 58 } + aqua { set width 52 } +} +$tbl configure -width $width +ttk::scrollbar $vsb -orient vertical -command [list $tbl yview] +ttk::scrollbar $hsb -orient horizontal -command [list $tbl xview] + +# +# Populate the tablelist widget +# +set itemList {} +for {set row 0} {$row < 2} {incr row} { + set item {} + for {set col 0} {$col < 8} {incr col} { + lappend item "header cell $row,$col" + } + lappend itemList $item +} +$tbl header insertlist end $itemList +set itemList {} +for {set row 0} {$row < 40} {incr row} { + set item {} + for {set col 0} {$col < 8} {incr col} { + lappend item "body cell $row,$col" + } + lappend itemList $item +} +$tbl insertlist end $itemList + +# +# Manage the widgets within the frame +# +grid $tbl -row 0 -rowspan 2 -column 0 -columnspan 2 -sticky news +if {[tk windowingsystem] eq "win32"} { + grid $vsb -row 0 -rowspan 2 -column 2 -sticky ns +} else { + grid [$tbl cornerpath] -row 0 -column 2 -sticky ew + grid $vsb -row 1 -column 2 -sticky ns +} +grid [$tbl cornerpath -sw] -row 2 -column 0 -sticky ns +grid $hsb -row 2 -column 1 -sticky ew +grid rowconfigure $frm 1 -weight 1 +grid columnconfigure $frm 1 -weight 1 + +# +# Create a ttk::button widget outside the frame +# +set b [ttk::button $f.b -text "Close" -command exit] +pack $b -side bottom -pady {0 10} + +# +# Manage the frame +# +pack $frm -expand yes -fill both -padx 10 -pady 10 + +pack $f -expand yes -fill both diff --git a/examples/scrollutil/ScrolledTablelist2.tcl b/examples/scrollutil/ScrolledTablelist2.tcl new file mode 100755 index 00000000..d6d11ec1 --- /dev/null +++ b/examples/scrollutil/ScrolledTablelist2.tcl @@ -0,0 +1,66 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the use of the scrollutil::scrollarea widget in connection with +# a tablelist. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require tablelist_tile 6.5 +package require scrollutil_tile + +wm title . "Scrolled Tablelist" + +# +# Create the tablelist within a scrollarea +# +set f [ttk::frame .f] +set sa [scrollutil::scrollarea $f.sa] +set tbl $sa.tbl +tablelist::tablelist $tbl -columntitles \ + {"Column 0" "Column 1" "Column 2" "Column 3" + "Column 4" "Column 5" "Column 6" "Column 7"} \ + -titlecolumns 1 +switch [tk windowingsystem] { + x11 { set width 53 } + win32 { set width 58 } + aqua { set width 52 } +} +$tbl configure -width $width +$sa setwidget $tbl + +# +# Populate the tablelist widget +# +set itemList {} +for {set row 0} {$row < 2} {incr row} { + set item {} + for {set col 0} {$col < 8} {incr col} { + lappend item "header cell $row,$col" + } + lappend itemList $item +} +$tbl header insertlist end $itemList +set itemList {} +for {set row 0} {$row < 40} {incr row} { + set item {} + for {set col 0} {$col < 8} {incr col} { + lappend item "body cell $row,$col" + } + lappend itemList $item +} +$tbl insertlist end $itemList + +# +# Create a ttk::button widget outside the scrollarea +# +set b [ttk::button $f.b -text "Close" -command exit] +pack $b -side bottom -pady {0 10} + +# +# Manage the scrollarea +# +pack $sa -expand yes -fill both -padx 10 -pady 10 + +pack $f -expand yes -fill both diff --git a/examples/scrollutil/SyncListboxes.tcl b/examples/scrollutil/SyncListboxes.tcl new file mode 100755 index 00000000..732b50c6 --- /dev/null +++ b/examples/scrollutil/SyncListboxes.tcl @@ -0,0 +1,102 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the use of the scrollutil::scrollsync widget in connection with +# two listbox widgets. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require scrollutil_tile + +wm title . "European Countries" + +# +# Create two ttk::label widgets within a ttk::frame +# +set f [ttk::frame .f] +set tf [ttk::frame $f.tf] +set l1 [ttk::label $tf.l1 -text "Countries"] +set l2 [ttk::label $tf.l2 -text "Capitals"] +grid $l1 $l2 +grid columnconfigure $tf all -weight 1 -uniform AllCols + +# +# Create a scrollsync widget within a scrollarea +# +set sa [scrollutil::scrollarea $f.sa] +set ss [scrollutil::scrollsync $sa.ss] +$sa setwidget $ss + +# +# Populate the scrollsync widget with two listboxes +# + +set countryList { + Albania Andorra Austria Belarus Belgium "Bosnia and Herzegovina" Bulgaria + Croatia Cyprus "Czech Republic" Denmark Estonia Finland France Germany + Greece Hungary Iceland Ireland Italy Kosovo Latvia Liechtenstein Lithuania + Luxembourg Macedonia Malta Moldova Monaco Montenegro Netherlands Norway + Poland Portugal Romania Russia "San Marino" Serbia Slovakia Slovenia + Spain Sweden Switzerland Ukraine "United Kingdom" "Vatican City" +} +set capitalList { + Tirana "Andorra la Vella" Vienna Minsk Brussels Sarajevo Sofia + Zagreb Nicosia Prague Copenhagen Tallinn Helsinki Paris Berlin + Athens Budapest Reykjavik Dublin Rome Pristina Riga Vaduz Vilnius + Luxembourg Skopje Valletta Chisinau Monaco Podgorica Amsterdam Oslo + Warsaw Lisbon Bucharest Moscow "San Marino" Belgrade Bratislava Ljubljana + Madrid Stockholm Bern Kiev London "Vatican City" +} + +set lb1 [listbox $ss.lb1 -activestyle none -highlightthickness 0 -width 16] +set lb2 [listbox $ss.lb2 -activestyle none -highlightthickness 0 -width 16] +$ss setwidgets [list $lb1 $lb2] + +foreach country $countryList { + $lb1 insert end " $country " +} +foreach capital $capitalList { + $lb2 insert end " $capital " +} + +set itemCount [$lb1 size] +for {set idx 0} {$idx < $itemCount} {incr idx} { + if {$idx % 2 == 1} { + $lb1 itemconfigure $idx -background #f0f0f0 + $lb2 itemconfigure $idx -background #f0f0f0 + } +} + +grid $lb1 $lb2 -sticky news -padx {0 2} +grid rowconfigure $ss 0 -weight 1 +grid columnconfigure $ss all -weight 1 + +# +# Create a ttk::button widget +# +set b [ttk::button $f.b -text "Close" -command exit] + +pack $b -side bottom -pady {0 10} +pack $tf -side top -fill x -pady {10 0} ;# for -padx see the proc updatePadx +pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10} +pack $f -expand yes -fill both + +# +# Sets the -padx pack option for $w, depending on +# the mapped state of the vertical scrollbar $vsb. +# +proc updatePadx {w vsb vsbMapped} { + set sa [winfo parent $vsb] + set l [expr {10 + [$sa cget -borderwidth]}] + set r $l + if {$vsbMapped} { + incr r [winfo width $vsb] + } + + pack configure $w -padx [list $l $r] +} + +updatePadx $tf $sa.vsb 0 +bind $sa.vsb [list updatePadx $tf %W 1] ;# $tf doesn't contain % chars +bind $sa.vsb [list updatePadx $tf %W 0] ;# $tf doesn't contain % chars diff --git a/examples/scrollutil/SyncTablelists.tcl b/examples/scrollutil/SyncTablelists.tcl new file mode 100755 index 00000000..4d2e74f9 --- /dev/null +++ b/examples/scrollutil/SyncTablelists.tcl @@ -0,0 +1,81 @@ +#!/usr/bin/env wish + +#============================================================================== +# Demonstrates the use of the scrollutil::scrollsync widget in connection with +# three tablelist widgets. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require tablelist_tile +package require scrollutil_tile + +wm title . "Synchronized Tablelists" + +# +# Create three ttk::label widgets within a ttk::frame +# +set f [ttk::frame .f] +set tf [ttk::frame $f.tf] +set l1 [ttk::label $tf.l1 -text "Left Table"] +set l2 [ttk::label $tf.l2 -text "Middle Table"] +set l3 [ttk::label $tf.l3 -text "Right Table"] +grid $l1 $l2 $l3 +grid columnconfigure $tf all -weight 1 -uniform AllCols + +# +# Create a scrollsync widget within a scrollarea +# +set sa [scrollutil::scrollarea $f.sa] +set ss [scrollutil::scrollsync $sa.ss] +$sa setwidget $ss + +# +# Populate the scrollsync widget with three tablelists +# + +option add *Tablelist.stripeBackground #f0f0f0 + +for {set n 1; set colWidth 40} {$n <= 3} {incr n; incr colWidth 20} { + set tbl [tablelist::tablelist $ss.tbl$n \ + -columns [list 0 "Column 0" left $colWidth "Column 1" left]] + set tbl$n $tbl + + for {set i 0} {$i < 40} {incr i} { + $tbl insert end [list "cell $i,0" "cell $i,1"] + } +} +$ss setwidgets [list $tbl1 $tbl2 $tbl3] + +grid $tbl1 $tbl2 $tbl3 -sticky news -padx {0 2} +grid rowconfigure $ss 0 -weight 1 +grid columnconfigure $ss all -weight 1 + +# +# Create a ttk::button widget +# +set b [ttk::button $f.b -text "Close" -command exit] + +pack $b -side bottom -pady {0 10} +pack $tf -side top -fill x -pady {10 0} ;# for -padx see the proc updatePadx +pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10} +pack $f -expand yes -fill both + +# +# Sets the -padx pack option for $w, depending on +# the mapped state of the vertical scrollbar $vsb. +# +proc updatePadx {w vsb vsbMapped} { + set sa [winfo parent $vsb] + set l [expr {10 + [$sa cget -borderwidth]}] + set r $l + if {$vsbMapped} { + incr r [winfo width $vsb] + } + + pack configure $w -padx [list $l $r] +} + +updatePadx $tf $sa.vsb 0 +bind $sa.vsb [list updatePadx $tf %W 1] ;# $tf doesn't contain % chars +bind $sa.vsb [list updatePadx $tf %W 0] ;# $tf doesn't contain % chars diff --git a/examples/scrollutil/scrolledwidgetPatch.itk b/examples/scrollutil/scrolledwidgetPatch.itk new file mode 100644 index 00000000..6cc197b2 --- /dev/null +++ b/examples/scrollutil/scrolledwidgetPatch.itk @@ -0,0 +1,48 @@ +#============================================================================== +# Patch for the iwidgets distribution file scrolledwidget.itk. It replaces the +# Tk core scrollbars with ttk::scrollbar widgets. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +itcl::body iwidgets::Scrolledwidget::constructor {args} { + # + # Turn off the borderwidth on the hull + # and save off the interior for later use + # + component hull configure -borderwidth 0 + set _interior $itk_interior + + # + # Check if the scrollbars need mapping upon a configure event + # + bind $_interior [itcl::code $this _configureEvent] + + # + # Turn off propagation in the containing shell + # + if {[grid propagate $_interior]} { + grid propagate $_interior no + } + + # + # Create the vertical scrollbar + # + itk_component add vertsb { + ttk::scrollbar $itk_interior.vertsb -orient vertical + } {} + + # + # Create the horizontal scrollbar + # + itk_component add horizsb { + ttk::scrollbar $itk_interior.horizsb -orient horizontal + } {} + + # + # Initialize the widget based on the command line options + # + eval itk_initialize $args +} + +itcl::configbody iwidgets::Scrolledwidget::sbwidth {} diff --git a/examples/tablelist/browse.tcl b/examples/tablelist/browse.tcl index 575db39d..3dc72761 100644 --- a/examples/tablelist/browse.tcl +++ b/examples/tablelist/browse.tcl @@ -2,10 +2,10 @@ # Demonstrates how to use a tablelist widget for displaying information about # the children of an arbitrary widget. # -# Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist 5.17 +package require tablelist 6.6 namespace eval demo { variable dir [file dirname [info script]] @@ -25,7 +25,7 @@ source [file join $demo::dir config.tcl] # demo::displayChildren # # Displays information on the children of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayChildren w { @@ -37,7 +37,7 @@ proc demo::displayChildren w { } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .browseTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -47,7 +47,7 @@ proc demo::displayChildren w { # # Create a vertically scrolled tablelist widget with 9 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf frame $tf @@ -104,7 +104,7 @@ proc demo::displayChildren w { bind $bodyTag <> +[list demo::postPopupMenu $top %X %Y] # - # Create three buttons within a frame child of the top-level widget + # Create three buttons within a frame child of the toplevel widget # set bf $top.bf frame $bf @@ -119,12 +119,12 @@ proc demo::displayChildren w { # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news - variable winSys - if {[string compare $winSys "aqua"] == 0} { + variable winSys ;# see config.tcl + if {[string compare $winSys "win32"] == 0} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid rowconfigure $tf 1 -weight 1 grid columnconfigure $tf 0 -weight 1 @@ -226,7 +226,7 @@ proc demo::formatBoolean val { #------------------------------------------------------------------------------ # demo::labelCmd # -# Sorts the contents of the tablelist widget tbl by its col'th column and makes +# Sorts the content of the tablelist widget tbl by its col'th column and makes # sure the items will be updated 500 ms later (because one of the items might # refer to a canvas containing the arrow that displays the sort order). #------------------------------------------------------------------------------ @@ -310,7 +310,7 @@ proc demo::putChildrenOfSelWidget tbl { # demo::dispConfigOfSelWidget # # Displays the configuration options of the selected widget within the -# tablelist tbl in a tablelist widget contained in a newly created top-level +# tablelist tbl in a tablelist widget contained in a newly created toplevel # widget. #------------------------------------------------------------------------------ proc demo::dispConfigOfSelWidget tbl { diff --git a/examples/tablelist/browseTree.tcl b/examples/tablelist/browseTree.tcl index 2e99d9cb..7035ea7b 100644 --- a/examples/tablelist/browseTree.tcl +++ b/examples/tablelist/browseTree.tcl @@ -2,11 +2,11 @@ # Demonstrates how to use a tablelist widget for displaying information about # the children of an arbitrary widget. # -# Copyright (c) 2010-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2010-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require Tk 8.3 -package require tablelist 5.17 +package require tablelist 6.6 namespace eval demo { variable dir [file dirname [info script]] @@ -26,7 +26,7 @@ source [file join $demo::dir config.tcl] # demo::displayChildren # # Displays information on the children of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayChildren w { @@ -38,7 +38,7 @@ proc demo::displayChildren w { } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .browseTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -48,7 +48,7 @@ proc demo::displayChildren w { # # Create a vertically scrolled tablelist widget with 9 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf frame $tf @@ -106,7 +106,7 @@ proc demo::displayChildren w { bind $bodyTag <> +[list demo::postPopupMenu $top %X %Y] # - # Create three buttons within a frame child of the top-level widget + # Create three buttons within a frame child of the toplevel widget # set bf $top.bf frame $bf @@ -121,12 +121,12 @@ proc demo::displayChildren w { # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news - variable winSys - if {[string compare $winSys "aqua"] == 0} { + variable winSys ;# see config.tcl + if {[string compare $winSys "win32"] == 0} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid rowconfigure $tf 1 -weight 1 grid columnconfigure $tf 0 -weight 1 @@ -266,7 +266,7 @@ proc demo::formatBoolean val { #------------------------------------------------------------------------------ # demo::labelCmd # -# Sorts the contents of the tablelist widget tbl by its col'th column and makes +# Sorts the content of the tablelist widget tbl by its col'th column and makes # sure the items will be updated 500 ms later (because one of the items might # refer to a canvas containing the arrow that displays the sort order). #------------------------------------------------------------------------------ @@ -351,7 +351,7 @@ proc demo::putChildrenOfSelWidget tbl { # demo::dispConfigOfSelWidget # # Displays the configuration options of the selected widget within the -# tablelist tbl in a tablelist widget contained in a newly created top-level +# tablelist tbl in a tablelist widget contained in a newly created toplevel # widget. #------------------------------------------------------------------------------ proc demo::dispConfigOfSelWidget tbl { @@ -424,7 +424,7 @@ proc demo::restoreExpandedStates {tbl nodeIdx expandedWidgetsName} { foreach key [$tbl childkeys $nodeIdx] { set pathName [$tbl rowattrib $key pathName] - if {[info exists expandedWidgets($)]} { + if {[info exists expandedWidgets($pathName)]} { $tbl expand $key -partly restoreExpandedStates $tbl $key expandedWidgets } diff --git a/examples/tablelist/browseTree_tile.tcl b/examples/tablelist/browseTree_tile.tcl index 93def871..8fe286d4 100644 --- a/examples/tablelist/browseTree_tile.tcl +++ b/examples/tablelist/browseTree_tile.tcl @@ -2,10 +2,10 @@ # Demonstrates how to use a tablelist widget for displaying information about # the children of an arbitrary widget. # -# Copyright (c) 2010-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2010-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 namespace eval demo { variable dir [file dirname [info script]] @@ -32,7 +32,7 @@ if {[tablelist::getCurrentTheme] eq "aqua"} { # demo::displayChildren # # Displays information on the children of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayChildren w { @@ -44,7 +44,7 @@ proc demo::displayChildren w { } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .browseTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -54,7 +54,7 @@ proc demo::displayChildren w { # # Create a vertically scrolled tablelist widget with 9 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf ttk::frame $tf @@ -112,7 +112,7 @@ proc demo::displayChildren w { bind $bodyTag <> +[list demo::postPopupMenu $top %X %Y] # - # Create three buttons within a tile frame child of the top-level widget + # Create three buttons within a tile frame child of the toplevel widget # set bf $top.bf ttk::frame $bf @@ -127,11 +127,11 @@ proc demo::displayChildren w { # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news - if {[tablelist::getCurrentTheme] eq "aqua"} { + if {[tk windowingsystem] eq "win32"} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid rowconfigure $tf 1 -weight 1 grid columnconfigure $tf 0 -weight 1 @@ -271,7 +271,7 @@ proc demo::formatBoolean val { #------------------------------------------------------------------------------ # demo::labelCmd # -# Sorts the contents of the tablelist widget tbl by its col'th column and makes +# Sorts the content of the tablelist widget tbl by its col'th column and makes # sure the items will be updated 500 ms later (because one of the items might # refer to a canvas containing the arrow that displays the sort order). #------------------------------------------------------------------------------ @@ -356,7 +356,7 @@ proc demo::putChildrenOfSelWidget tbl { # demo::dispConfigOfSelWidget # # Displays the configuration options of the selected widget within the -# tablelist tbl in a tablelist widget contained in a newly created top-level +# tablelist tbl in a tablelist widget contained in a newly created toplevel # widget. #------------------------------------------------------------------------------ proc demo::dispConfigOfSelWidget tbl { diff --git a/examples/tablelist/browse_tile.tcl b/examples/tablelist/browse_tile.tcl index 6910b56c..42db8ff6 100644 --- a/examples/tablelist/browse_tile.tcl +++ b/examples/tablelist/browse_tile.tcl @@ -2,10 +2,10 @@ # Demonstrates how to use a tablelist widget for displaying information about # children of an arbitrary widget. # -# Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 namespace eval demo { variable dir [file dirname [info script]] @@ -32,7 +32,7 @@ if {[tablelist::getCurrentTheme] eq "aqua"} { # demo::displayChildren # # Displays information on the children of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayChildren w { @@ -44,7 +44,7 @@ proc demo::displayChildren w { } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .browseTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -54,7 +54,7 @@ proc demo::displayChildren w { # # Create a vertically scrolled tablelist widget with 9 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf ttk::frame $tf @@ -111,7 +111,7 @@ proc demo::displayChildren w { bind $bodyTag <> +[list demo::postPopupMenu $top %X %Y] # - # Create three buttons within a tile frame child of the top-level widget + # Create three buttons within a tile frame child of the toplevel widget # set bf $top.bf ttk::frame $bf @@ -126,11 +126,11 @@ proc demo::displayChildren w { # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news - if {[tablelist::getCurrentTheme] eq "aqua"} { + if {[tk windowingsystem] eq "win32"} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid rowconfigure $tf 1 -weight 1 grid columnconfigure $tf 0 -weight 1 @@ -232,7 +232,7 @@ proc demo::formatBoolean val { #------------------------------------------------------------------------------ # demo::labelCmd # -# Sorts the contents of the tablelist widget tbl by its col'th column and makes +# Sorts the content of the tablelist widget tbl by its col'th column and makes # sure the items will be updated 500 ms later (because one of the items might # refer to a canvas containing the arrow that displays the sort order). #------------------------------------------------------------------------------ @@ -316,7 +316,7 @@ proc demo::putChildrenOfSelWidget tbl { # demo::dispConfigOfSelWidget # # Displays the configuration options of the selected widget within the -# tablelist tbl in a tablelist widget contained in a newly created top-level +# tablelist tbl in a tablelist widget contained in a newly created toplevel # widget. #------------------------------------------------------------------------------ proc demo::dispConfigOfSelWidget tbl { diff --git a/examples/tablelist/bwidget.tcl b/examples/tablelist/bwidget.tcl index d8acf1d1..01306c12 100755 --- a/examples/tablelist/bwidget.tcl +++ b/examples/tablelist/bwidget.tcl @@ -5,11 +5,11 @@ # widgets from the BWidget package and of the Tk core checkbutton and # menubutton widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require Tk 8.4 ;# because of "-compound" -package require tablelist 5.17 +package require tablelist 6.6 package require BWidget wm title . "Serial Line Configuration" @@ -19,9 +19,7 @@ wm title . "Serial Line Configuration" # set dir [file dirname [info script]] source [file join $dir option.tcl] -option add *Tablelist*Checkbutton.background white -option add *Tablelist*Checkbutton.activeBackground white -option add *Tablelist*Entry.background white +option add *Tablelist*Entry.background white # # Register some widgets from the BWidget package for interactive cell editing @@ -198,7 +196,7 @@ proc editStartCmd {tbl row col text} { # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { diff --git a/examples/tablelist/bwidget_tile.tcl b/examples/tablelist/bwidget_tile.tcl index be7a1a96..f7364fee 100755 --- a/examples/tablelist/bwidget_tile.tcl +++ b/examples/tablelist/bwidget_tile.tcl @@ -5,10 +5,10 @@ # widgets from the BWidget package and of the Tk core checkbutton and # menubutton widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 package require BWidget wm title . "Serial Line Configuration" @@ -18,9 +18,7 @@ wm title . "Serial Line Configuration" # set dir [file dirname [info script]] source [file join $dir option_tile.tcl] -option add *Tablelist*Checkbutton.background white -option add *Tablelist*Checkbutton.activeBackground white -option add *Tablelist*Entry.background white +option add *Tablelist*Entry.background white # # Register some widgets from the BWidget package for interactive cell editing @@ -204,7 +202,7 @@ proc editStartCmd {tbl row col text} { # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { diff --git a/examples/tablelist/config.tcl b/examples/tablelist/config.tcl index 8712a79b..3c433bc8 100644 --- a/examples/tablelist/config.tcl +++ b/examples/tablelist/config.tcl @@ -2,16 +2,16 @@ # Demonstrates how to use a tablelist widget for displaying and editing the # configuration options of an arbitrary widget. # -# Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist 5.17 +package require tablelist 6.6 namespace eval demo { # # Get the current windowing system ("x11", "win32", "classic", or "aqua") # and add some entries to the Tk option database for the following - # widget hierarchy within a top-level widget of the class DemoTop: + # widget hierarchy within a toplevel widget of the class DemoTop: # # Name Class # ----------------------------- @@ -38,12 +38,11 @@ namespace eval demo { option add *DemoTop*Font TkDefaultFont option add *DemoTop*selectBackground #5294e2 option add *DemoTop*selectForeground white - } else { - option add *DemoTop.tf.borderWidth 1 - option add *DemoTop.tf.relief sunken - option add *DemoTop.tf.tbl.borderWidth 0 - option add *DemoTop.tf.tbl.highlightThickness 0 } + option add *DemoTop.tf.borderWidth 1 + option add *DemoTop.tf.relief sunken + option add *DemoTop.tf.tbl.borderWidth 0 + option add *DemoTop.tf.tbl.highlightThickness 0 option add *DemoTop.tf.tbl.background white option add *DemoTop.tf.tbl.stripeBackground #f0f0f0 option add *DemoTop.tf.tbl.setGrid yes @@ -55,7 +54,7 @@ namespace eval demo { # demo::displayConfig # # Displays the configuration options of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayConfig w { @@ -67,7 +66,7 @@ proc demo::displayConfig w { } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .configTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -78,7 +77,7 @@ proc demo::displayConfig w { # # Create a scrolled tablelist widget with 5 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf frame $tf @@ -103,7 +102,7 @@ proc demo::displayConfig w { scrollbar $hsb -orient horizontal -command [list $tbl xview] # - # Create three buttons within a frame child of the top-level widget + # Create three buttons within a frame child of the toplevel widget # set bf $top.bf frame $bf @@ -119,11 +118,11 @@ proc demo::displayConfig w { # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news variable winSys - if {[string compare $winSys "aqua"] == 0} { + if {[string compare $winSys "win32"] == 0} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid $hsb -row 2 -column 0 -sticky ew grid rowconfigure $tf 1 -weight 1 diff --git a/examples/tablelist/config_tile.tcl b/examples/tablelist/config_tile.tcl index 94b58878..a412ce81 100644 --- a/examples/tablelist/config_tile.tcl +++ b/examples/tablelist/config_tile.tcl @@ -2,16 +2,16 @@ # Demonstrates how to use a tablelist widget for displaying and editing the # configuration options of an arbitrary widget. # -# Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 namespace eval demo { # # Get the current windowing system ("x11", "win32", or "aqua") # and add some entries to the Tk option database for the following - # widget hierarchy within a top-level widget of the class DemoTop: + # widget hierarchy within a toplevel widget of the class DemoTop: # # Name Class # ----------------------------- @@ -23,10 +23,6 @@ namespace eval demo { # if {[tk windowingsystem] eq "x11"} { option add *DemoTop*Font TkDefaultFont - } else { - option add *DemoTop.tf.borderWidth 1 - option add *DemoTop.tf.relief sunken - option add *DemoTop.tf.tbl.borderWidth 0 } tablelist::setThemeDefaults set foreground [winfo rgb . $tablelist::themeDefaults(-foreground)] @@ -41,6 +37,9 @@ namespace eval demo { option add *DemoTop*selectBorderWidth \ $tablelist::themeDefaults(-selectborderwidth) } + option add *DemoTop.tf.borderWidth 1 + option add *DemoTop.tf.relief sunken + option add *DemoTop.tf.tbl.borderWidth 0 option add *DemoTop.tf.tbl.background white option add *DemoTop.tf.tbl.stripeBackground #f0f0f0 option add *DemoTop.tf.tbl.setGrid yes @@ -59,7 +58,7 @@ if {$demo::currentTheme eq "aqua"} { # demo::displayConfig # # Displays the configuration options of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayConfig w { @@ -71,7 +70,7 @@ proc demo::displayConfig w { } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .configTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -82,7 +81,7 @@ proc demo::displayConfig w { # # Create a scrolled tablelist widget with 5 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf ttk::frame $tf @@ -107,7 +106,7 @@ proc demo::displayConfig w { ttk::scrollbar $hsb -orient horizontal -command [list $tbl xview] # - # Create three buttons within a tile frame child of the top-level widget + # Create three buttons within a tile frame child of the toplevel widget # set bf $top.bf ttk::frame $bf @@ -122,11 +121,11 @@ proc demo::displayConfig w { # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news - if {[tablelist::getCurrentTheme] eq "aqua"} { + if {[tk windowingsystem] eq "win32"} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid $hsb -row 2 -column 0 -sticky ew grid rowconfigure $tf 1 -weight 1 diff --git a/examples/tablelist/dirViewer.tcl b/examples/tablelist/dirViewer.tcl index 6604ade4..d66ad62f 100755 --- a/examples/tablelist/dirViewer.tcl +++ b/examples/tablelist/dirViewer.tcl @@ -1,14 +1,14 @@ #!/usr/bin/env wish #============================================================================== -# Demonstrates how to use a tablelist widget for displaying the contents of a +# Demonstrates how to use a tablelist widget for displaying the content of a # directory. # -# Copyright (c) 2010-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2010-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require Tk 8.3 -package require tablelist 5.17 +package require tablelist 6.6 # # Add some entries to the Tk option database @@ -26,7 +26,7 @@ image create photo fileImg -file [file join $dir file.gif] #------------------------------------------------------------------------------ # displayContents # -# Displays the contents of the directory dir in a tablelist widget. +# Displays the content of the directory dir in a tablelist widget. #------------------------------------------------------------------------------ proc displayContents dir { # @@ -84,12 +84,12 @@ proc displayContents dir { # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news - global winSys - if {[string compare $winSys "aqua"] == 0} { + global winSys ;# see option.tcl + if {[string compare $winSys "win32"] == 0} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid $hsb -row 2 -column 0 -sticky ew grid rowconfigure $tf 1 -weight 1 @@ -99,7 +99,7 @@ proc displayContents dir { pack $tf -side top -expand yes -fill both # - # Populate the tablelist with the contents of the given directory + # Populate the tablelist with the content of the given directory # $tbl sortbycolumn 0 putContents $dir $tbl root @@ -108,7 +108,7 @@ proc displayContents dir { #------------------------------------------------------------------------------ # putContents # -# Outputs the contents of the directory dir into the tablelist widget tbl, as +# Outputs the content of the directory dir into the tablelist widget tbl, as # child items of the one identified by nodeIdx. #------------------------------------------------------------------------------ proc putContents {dir tbl nodeIdx} { @@ -263,7 +263,7 @@ proc formatSize val { #------------------------------------------------------------------------------ # expandCmd # -# Outputs the contents of the directory whose leaf name is displayed in the +# Outputs the content of the directory whose leaf name is displayed in the # first cell of the specified row of the tablelist widget tbl, as child items # of the one identified by row, and updates the image displayed in that cell. #------------------------------------------------------------------------------ @@ -291,7 +291,7 @@ proc collapseCmd {tbl row} { #------------------------------------------------------------------------------ # putContentsOfSelFolder # -# Outputs the contents of the selected folder into the tablelist widget tbl. +# Outputs the content of the selected folder into the tablelist widget tbl. #------------------------------------------------------------------------------ proc putContentsOfSelFolder tbl { set row [$tbl curselection] @@ -351,7 +351,7 @@ proc postPopupMenu {rootX rootY} { #------------------------------------------------------------------------------ # refreshView # -# Redisplays the contents of the directory dir in the tablelist widget tbl and +# Redisplays the content of the directory dir in the tablelist widget tbl and # restores the expanded states of the folders as well as the vertical view. #------------------------------------------------------------------------------ proc refreshView {dir tbl} { @@ -366,7 +366,7 @@ proc refreshView {dir tbl} { } # - # Redisplay the directory's (possibly changed) contents and restore + # Redisplay the directory's (possibly changed) content and restore # the expanded states of the folders, along with the vertical view # putContents $dir $tbl root diff --git a/examples/tablelist/dirViewer_tile.tcl b/examples/tablelist/dirViewer_tile.tcl index dca277fe..f89ee5b7 100755 --- a/examples/tablelist/dirViewer_tile.tcl +++ b/examples/tablelist/dirViewer_tile.tcl @@ -1,13 +1,13 @@ #!/usr/bin/env wish #============================================================================== -# Demonstrates how to use a tablelist widget for displaying the contents of a +# Demonstrates how to use a tablelist widget for displaying the content of a # directory. # -# Copyright (c) 2010-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2010-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 # # Add some entries to the Tk option database @@ -32,7 +32,7 @@ if {[tablelist::getCurrentTheme] eq "aqua"} { #------------------------------------------------------------------------------ # displayContents # -# Displays the contents of the directory dir in a tablelist widget. +# Displays the content of the directory dir in a tablelist widget. #------------------------------------------------------------------------------ proc displayContents dir { # @@ -90,11 +90,11 @@ proc displayContents dir { # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news - if {[tablelist::getCurrentTheme] eq "aqua"} { + if {[tk windowingsystem] eq "win32"} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid $hsb -row 2 -column 0 -sticky ew grid rowconfigure $tf 1 -weight 1 @@ -104,7 +104,7 @@ proc displayContents dir { pack $tf -side top -expand yes -fill both # - # Populate the tablelist with the contents of the given directory + # Populate the tablelist with the content of the given directory # $tbl sortbycolumn 0 putContents $dir $tbl root @@ -113,7 +113,7 @@ proc displayContents dir { #------------------------------------------------------------------------------ # putContents # -# Outputs the contents of the directory dir into the tablelist widget tbl, as +# Outputs the content of the directory dir into the tablelist widget tbl, as # child items of the one identified by nodeIdx. #------------------------------------------------------------------------------ proc putContents {dir tbl nodeIdx} { @@ -268,7 +268,7 @@ proc formatSize val { #------------------------------------------------------------------------------ # expandCmd # -# Outputs the contents of the directory whose leaf name is displayed in the +# Outputs the content of the directory whose leaf name is displayed in the # first cell of the specified row of the tablelist widget tbl, as child items # of the one identified by row, and updates the image displayed in that cell. #------------------------------------------------------------------------------ @@ -296,7 +296,7 @@ proc collapseCmd {tbl row} { #------------------------------------------------------------------------------ # putContentsOfSelFolder # -# Outputs the contents of the selected folder into the tablelist widget tbl. +# Outputs the content of the selected folder into the tablelist widget tbl. #------------------------------------------------------------------------------ proc putContentsOfSelFolder tbl { set row [$tbl curselection] @@ -356,7 +356,7 @@ proc postPopupMenu {rootX rootY} { #------------------------------------------------------------------------------ # refreshView # -# Redisplays the contents of the directory dir in the tablelist widget tbl and +# Redisplays the content of the directory dir in the tablelist widget tbl and # restores the expanded states of the folders as well as the vertical view. #------------------------------------------------------------------------------ proc refreshView {dir tbl} { @@ -371,7 +371,7 @@ proc refreshView {dir tbl} { } # - # Redisplay the directory's (possibly changed) contents and restore + # Redisplay the directory's (possibly changed) content and restore # the expanded states of the folders, along with the vertical view # putContents $dir $tbl root diff --git a/examples/tablelist/embeddedWindows.tcl b/examples/tablelist/embeddedWindows.tcl index 7b08698e..6d3c0b63 100755 --- a/examples/tablelist/embeddedWindows.tcl +++ b/examples/tablelist/embeddedWindows.tcl @@ -3,10 +3,10 @@ #============================================================================== # Demonstrates the use of embedded windows in tablelist widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist 5.17 +package require tablelist 6.6 wm title . "Tk Library Scripts" @@ -31,7 +31,7 @@ image create photo openImg -file [file join $dir open.gif] # dynamic-width columns and interactive sort capability # set tf .tf -frame $tf -class ScrollArea +frame $tf -class ScrollArea set tbl $tf.tbl set vsb $tf.vsb tablelist::tablelist $tbl \ @@ -66,15 +66,21 @@ eval font create BoldFont [font actual $tblFont] -size $size -weight bold # Populate the tablelist widget # cd $tk_library -set maxFileSize 0 +set totalSize 0 +set maxSize 0 foreach fileName [lsort [glob *.tcl]] { set fileSize [file size $fileName] $tbl insert end [list $fileName $fileSize $fileSize "" no] - if {$fileSize > $maxFileSize} { - set maxFileSize $fileSize + incr totalSize $fileSize + if {$fileSize > $maxSize} { + set maxSize $fileSize } } +if {$tk_version >= 8.5} { + $tbl header insert 0 [list "[$tbl size] *.tcl files" "" $totalSize "" ""] + $tbl header rowconfigure 0 -foreground blue +} #------------------------------------------------------------------------------ # createFrame @@ -103,7 +109,7 @@ proc createFrame {tbl row col w} { # Manage the child frame # set fileSize [$tbl cellcget $row,fileSize -text] - place $w.f -relwidth [expr {double($fileSize) / $::maxFileSize}] + place $w.f -relwidth [expr {double($fileSize) / $::maxSize}] } #------------------------------------------------------------------------------ @@ -121,13 +127,14 @@ proc createButton {tbl row col w} { #------------------------------------------------------------------------------ # viewFile # -# Displays the contents of the file whose name is contained in the row with the +# Displays the content of the file whose name is contained in the row with the # given key of the tablelist widget tbl. #------------------------------------------------------------------------------ proc viewFile {tbl key} { set top .top$key if {[winfo exists $top]} { raise $top + focus $top return "" } @@ -148,10 +155,10 @@ proc viewFile {tbl key} { scrollbar $vsb -orient vertical -command [list $txt yview] # - # Insert the file's contents into the text widget + # Insert the file's content into the text widget # set chan [open $fileName] - $txt insert end [read $chan] + $txt insert end [read -nonewline $chan] close $chan set btn [button $top.btn -text "Close" -command [list destroy $top]] @@ -190,11 +197,11 @@ set btn [button .btn -text "Close" -command exit] # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news -if {[string compare $winSys "aqua"] == 0} { +if {[string compare $winSys "win32"] == 0} { ;# see option.tcl + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns +} else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns -} else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid rowconfigure $tf 1 -weight 1 grid columnconfigure $tf 0 -weight 1 diff --git a/examples/tablelist/embeddedWindows_tile.tcl b/examples/tablelist/embeddedWindows_tile.tcl index 2eb39561..9facb108 100755 --- a/examples/tablelist/embeddedWindows_tile.tcl +++ b/examples/tablelist/embeddedWindows_tile.tcl @@ -3,10 +3,10 @@ #============================================================================== # Demonstrates the use of embedded windows in tablelist widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 wm title . "Tile Library Scripts" @@ -95,15 +95,21 @@ if {[info exists ttk::library]} { } else { cd $tile::library } -set maxFileSize 0 +set totalSize 0 +set maxSize 0 foreach fileName [lsort [glob *.tcl]] { set fileSize [file size $fileName] $tbl insert end [list $fileName $fileSize $fileSize "" no] - if {$fileSize > $maxFileSize} { - set maxFileSize $fileSize + incr totalSize $fileSize + if {$fileSize > $maxSize} { + set maxSize $fileSize } } +if {$tk_version >= 8.5} { + $tbl header insert 0 [list "[$tbl size] *.tcl files" "" $totalSize "" ""] + $tbl header rowconfigure 0 -foreground blue +} #------------------------------------------------------------------------------ # createFrame @@ -132,7 +138,7 @@ proc createFrame {tbl row col w} { # Manage the child frame # set fileSize [$tbl cellcget $row,fileSize -text] - place $w.f -relwidth [expr {double($fileSize) / $::maxFileSize}] + place $w.f -relwidth [expr {double($fileSize) / $::maxSize}] } #------------------------------------------------------------------------------ @@ -150,13 +156,14 @@ proc createButton {tbl row col w} { #------------------------------------------------------------------------------ # viewFile # -# Displays the contents of the file whose name is contained in the row with the +# Displays the content of the file whose name is contained in the row with the # given key of the tablelist widget tbl. #------------------------------------------------------------------------------ proc viewFile {tbl key} { set top .top$key if {[winfo exists $top]} { raise $top + focus $top return "" } @@ -171,16 +178,16 @@ proc viewFile {tbl key} { ttk::frame $tf -class ScrollArea set txt $tf.txt set vsb $tf.vsb - text $txt -background white -font TkFixedFont -highlightthickness 0 \ - -setgrid yes -yscrollcommand [list $vsb set] + text $txt -background white -font TkFixedFont -setgrid yes \ + -yscrollcommand [list $vsb set] catch {$txt configure -tabstyle wordprocessor} ;# for Tk 8.5 and above ttk::scrollbar $vsb -orient vertical -command [list $txt yview] # - # Insert the file's contents into the text widget + # Insert the file's content into the text widget # set chan [open $fileName] - $txt insert end [read $chan] + $txt insert end [read -nonewline $chan] close $chan set bf $top.bf @@ -224,11 +231,11 @@ set btn [ttk::button $bf.btn -text "Close" -command exit] # Manage the widgets # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news -if {[tablelist::getCurrentTheme] eq "aqua"} { +if {[tk windowingsystem] eq "win32"} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns +} else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns -} else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid rowconfigure $tf 1 -weight 1 grid columnconfigure $tf 0 -weight 1 diff --git a/examples/tablelist/images.tcl b/examples/tablelist/images.tcl index c0c1cfb3..d9d48eee 100644 --- a/examples/tablelist/images.tcl +++ b/examples/tablelist/images.tcl @@ -1,7 +1,7 @@ #============================================================================== # Creates some images. # -# Copyright (c) 2011-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2011-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -15,13 +15,13 @@ image create photo uncheckedImg -file [file join $dir unchecked.gif] # set colorNames { "red" "green" "blue" "magenta" - "yellow" "cyan" "white" "light gray" + "yellow" "cyan" "light gray" "white" "dark red" "dark green" "dark blue" "dark magenta" "dark yellow" "dark cyan" "dark gray" "black" } set colorValues { #FF0000 #00FF00 #0000FF #FF00FF - #FFFF00 #00FFFF #FFFFFF #C0C0C0 + #FFFF00 #00FFFF #C0C0C0 #FFFFFF #800000 #008000 #000080 #800080 #808000 #008080 #808080 #000000 } diff --git a/examples/tablelist/iwidgets.tcl b/examples/tablelist/iwidgets.tcl index 2b0eec8b..5159d243 100755 --- a/examples/tablelist/iwidgets.tcl +++ b/examples/tablelist/iwidgets.tcl @@ -5,12 +5,15 @@ # widgets from the Iwidgets package and of the Tk core checkbutton and # menubutton widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require Tk 8.4 ;# because of "-compound" -package require tablelist 5.17 -package require Iwidgets +package require tablelist 6.6 +if {[catch {package require iwidgets} result1] != 0 && + [catch {package require Iwidgets} result2] != 0} { + error "$result1; $result2" +} wm title . "Serial Line Configuration" @@ -19,8 +22,6 @@ wm title . "Serial Line Configuration" # set dir [file dirname [info script]] source [file join $dir option.tcl] -option add *Tablelist*Checkbutton.background white -option add *Tablelist*Checkbutton.activeBackground white option add *Tablelist*textBackground white option add *Tablelist*Entry.disabledBackground white option add *Tablelist*Entry.disabledForeground black @@ -202,7 +203,7 @@ proc editStartCmd {tbl row col text} { # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { diff --git a/examples/tablelist/iwidgets_tile.tcl b/examples/tablelist/iwidgets_tile.tcl index 3a49e673..05f81213 100755 --- a/examples/tablelist/iwidgets_tile.tcl +++ b/examples/tablelist/iwidgets_tile.tcl @@ -5,11 +5,14 @@ # widgets from the Iwidgets package and of the Tk core checkbutton and # menubutton widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 -package require Iwidgets +package require tablelist_tile 6.6 +if {[catch {package require iwidgets} result1] != 0 && + [catch {package require Iwidgets} result2] != 0} { + error "$result1; $result2" +} wm title . "Serial Line Configuration" @@ -18,8 +21,6 @@ wm title . "Serial Line Configuration" # set dir [file dirname [info script]] source [file join $dir option_tile.tcl] -option add *Tablelist*Checkbutton.background white -option add *Tablelist*Checkbutton.activeBackground white option add *Tablelist*textBackground white option add *Tablelist*Entry.disabledBackground white option add *Tablelist*Entry.disabledForeground black @@ -208,7 +209,7 @@ proc editStartCmd {tbl row col text} { # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { diff --git a/examples/tablelist/miscWidgets.tcl b/examples/tablelist/miscWidgets.tcl index c8da1632..77587533 100755 --- a/examples/tablelist/miscWidgets.tcl +++ b/examples/tablelist/miscWidgets.tcl @@ -5,11 +5,11 @@ # Oakley's combobox, the mentry widgets of type "Date" and "Time", and of the # Tk core entry, spinbox, checkbutton, and menubutton widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require Tk 8.4 ;# because of "-compound" and the spinbox widget -package require tablelist 5.17 +package require tablelist 6.6 package require combobox package require mentry @@ -20,8 +20,6 @@ wm title . "Serial Line Configuration" # set dir [file dirname [info script]] source [file join $dir option.tcl] -option add *Tablelist*Checkbutton.background white -option add *Tablelist*Checkbutton.activeBackground white option add *Tablelist*Entry.background white option add *Tablelist*Spinbox.background white option add *Tablelist*Spinbox.readonlyBackground white @@ -208,7 +206,7 @@ array set msgs { # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { diff --git a/examples/tablelist/miscWidgets_tile.tcl b/examples/tablelist/miscWidgets_tile.tcl index 75208061..8c6f3e4c 100755 --- a/examples/tablelist/miscWidgets_tile.tcl +++ b/examples/tablelist/miscWidgets_tile.tcl @@ -5,10 +5,10 @@ # Oakley's combobox, the mentry widgets of type "Date" and "Time", and of the # Tk core entry, spinbox, checkbutton, and menubutton widgets. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 package require combobox package require mentry @@ -19,8 +19,6 @@ wm title . "Serial Line Configuration" # set dir [file dirname [info script]] source [file join $dir option_tile.tcl] -option add *Tablelist*Checkbutton.background white -option add *Tablelist*Checkbutton.activeBackground white option add *Tablelist*Entry.background white option add *Tablelist*Spinbox.background white option add *Tablelist*Spinbox.readonlyBackground white @@ -214,7 +212,7 @@ array set msgs { # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { diff --git a/examples/tablelist/option.tcl b/examples/tablelist/option.tcl index 272a4164..d0612943 100644 --- a/examples/tablelist/option.tcl +++ b/examples/tablelist/option.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains some Tk option database settings. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -27,13 +27,6 @@ if {[string compare $winSys "x11"] == 0} { option add *Font TkDefaultFont option add *selectBackground #5294e2 option add *selectForeground white -} else { - option add *ScrollArea.borderWidth 1 - option add *ScrollArea.relief sunken - option add *ScrollArea.Tablelist.borderWidth 0 - option add *ScrollArea.Tablelist.highlightThickness 0 - option add *ScrollArea.Text.borderWidth 0 - option add *ScrollArea.Text.highlightThickness 0 } option add *Tablelist.background white option add *Tablelist.stripeBackground #f0f0f0 @@ -41,3 +34,9 @@ option add *Tablelist.setGrid yes option add *Tablelist.movableColumns yes option add *Tablelist.labelCommand tablelist::sortByColumn option add *Tablelist.labelCommand2 tablelist::addToSortColumns +option add *ScrollArea.borderWidth 1 +option add *ScrollArea.relief sunken +option add *ScrollArea.Tablelist.borderWidth 0 +option add *ScrollArea.Tablelist.highlightThickness 0 +option add *ScrollArea.Text.borderWidth 0 +option add *ScrollArea.Text.highlightThickness 0 diff --git a/examples/tablelist/option_tile.tcl b/examples/tablelist/option_tile.tcl index a33c1bf4..03f6cef4 100644 --- a/examples/tablelist/option_tile.tcl +++ b/examples/tablelist/option_tile.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains some Tk option database settings. # -# Copyright (c) 2004-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -10,12 +10,6 @@ # if {[tk windowingsystem] eq "x11"} { option add *Font TkDefaultFont -} else { - option add *ScrollArea.borderWidth 1 - option add *ScrollArea.relief sunken - option add *ScrollArea.Tablelist.borderWidth 0 - option add *ScrollArea.Text.borderWidth 0 - option add *ScrollArea.Text.highlightThickness 0 } tablelist::setThemeDefaults if {[tablelist::getCurrentTheme] eq "aqua"} { @@ -34,3 +28,8 @@ option add *Tablelist.setGrid yes option add *Tablelist.movableColumns yes option add *Tablelist.labelCommand tablelist::sortByColumn option add *Tablelist.labelCommand2 tablelist::addToSortColumns +option add *ScrollArea.borderWidth 1 +option add *ScrollArea.relief sunken +option add *ScrollArea.Tablelist.borderWidth 0 +option add *ScrollArea.Text.borderWidth 0 +option add *ScrollArea.Text.highlightThickness 0 diff --git a/examples/tablelist/styles.tcl b/examples/tablelist/styles.tcl index 96467a68..865d6f49 100755 --- a/examples/tablelist/styles.tcl +++ b/examples/tablelist/styles.tcl @@ -3,10 +3,10 @@ #============================================================================== # Demonstrates some ways of improving the look & feel of a tablelist widget. # -# Copyright (c) 2002-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2002-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist 5.17 +package require tablelist 6.6 wm title . "Tablelist Styles" diff --git a/examples/tablelist/styles_tile.tcl b/examples/tablelist/styles_tile.tcl index f0abebf7..00813bc4 100755 --- a/examples/tablelist/styles_tile.tcl +++ b/examples/tablelist/styles_tile.tcl @@ -3,10 +3,10 @@ #============================================================================== # Demonstrates some ways of improving the look & feel of a tablelist widget. # -# Copyright (c) 2002-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2002-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 wm title . "Tablelist Styles" diff --git a/examples/tablelist/tileWidgets.tcl b/examples/tablelist/tileWidgets.tcl index cafc90af..7d217234 100755 --- a/examples/tablelist/tileWidgets.tcl +++ b/examples/tablelist/tileWidgets.tcl @@ -2,12 +2,12 @@ #============================================================================== # Demonstrates the interactive tablelist cell editing with the aid of some -# widgets from the tile package and of the Tk core spinbox widget. +# widgets from the tile package. # -# Copyright (c) 2005-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2005-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require tablelist_tile 5.17 +package require tablelist_tile 6.6 wm title . "Serial Line Configuration" @@ -31,13 +31,6 @@ source [file join $dir images.tcl] # set f [ttk::frame .f] -# -# Work around the improper appearance of the tile scrollbars in the aqua theme -# -if {[tablelist::getCurrentTheme] eq "aqua"} { - interp alias {} ttk::scrollbar {} ::scrollbar -} - # # Create a tablelist widget with editable columns (except the first one) # @@ -205,7 +198,7 @@ proc editStartCmd {tbl row col text} { # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { diff --git a/examples/wcb/entrytest.tcl b/examples/wcb/entrytest.tcl index cb65985d..2e31b4a4 100755 --- a/examples/wcb/entrytest.tcl +++ b/examples/wcb/entrytest.tcl @@ -1,11 +1,11 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: wcb::callback before insert ... # wcb::postInsertEntryText # wcb::cancel # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2018 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require wcb diff --git a/examples/wcb/listboxtest1.tcl b/examples/wcb/listboxtest1.tcl index 0a89a541..0118e213 100755 --- a/examples/wcb/listboxtest1.tcl +++ b/examples/wcb/listboxtest1.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: wcb::callback before selset # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2018 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require wcb diff --git a/examples/wcb/listboxtest2.tcl b/examples/wcb/listboxtest2.tcl index 93edce2d..82ac4df2 100755 --- a/examples/wcb/listboxtest2.tcl +++ b/examples/wcb/listboxtest2.tcl @@ -1,9 +1,9 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: wcb::callback before activate # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2018 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require wcb diff --git a/examples/wcb/option.tcl b/examples/wcb/option.tcl index de0e56ee..cf1a7d39 100644 --- a/examples/wcb/option.tcl +++ b/examples/wcb/option.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains some Tk option database settings. # -# Copyright (c) 2010-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2010-2018 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -26,7 +26,7 @@ switch $winSys { catch {font create TkDefaultFont -family Helvetica -size -12} option add *Font TkDefaultFont - option add *selectBackground #678db2 + option add *selectBackground #5294e2 option add *selectForeground white } classic { diff --git a/examples/wcb/texttest1.tcl b/examples/wcb/texttest1.tcl index 9a2c354d..bea08a22 100755 --- a/examples/wcb/texttest1.tcl +++ b/examples/wcb/texttest1.tcl @@ -1,5 +1,5 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: wcb::callback before insert ... # wcb::callback before delete @@ -10,7 +10,7 @@ # wcb::cancel # wcb::extend # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2018 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require wcb diff --git a/examples/wcb/texttest2.tcl b/examples/wcb/texttest2.tcl index 5ac1ef9d..ee89ae63 100755 --- a/examples/wcb/texttest2.tcl +++ b/examples/wcb/texttest2.tcl @@ -1,5 +1,5 @@ #!/usr/bin/env wish -## -*- tcl -*- + #============================================================================== # Demo: wcb::callback before insert ... # wcb::callback before delete @@ -10,7 +10,7 @@ # wcb::cancel # wcb::extend # -# Copyright (c) 2004-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2004-2018 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== package require Tk 8.4 ;# because of the undo mechanism for text widgets diff --git a/examples/widgetPlus/widgetPlusDemo.tcl b/examples/widgetPlus/widgetPlusDemo.tcl new file mode 100644 index 00000000..ab638633 --- /dev/null +++ b/examples/widgetPlus/widgetPlusDemo.tcl @@ -0,0 +1,162 @@ +#!/bin/sh +# the next line restarts using tclsh \ +exec tclsh "$0" "$@" + +# Copyright (c) 2017-2018 Keith Nash. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# This script is a demo of Undo/Redo in the widgetPlus widgets (entryPlus etc) and +# in the text widget. + +package require Tk +package require snit +package require widgetPlus +namespace import widgetPlus::* + +# ------------------------------------------------------------------------------ +# Command CreateWidget +# ------------------------------------------------------------------------------ +# Command to create a widgetPlus widget, initialize it, and map it. +# If there is an existing widget with the same name it is destroyed. +# +# When debugging, note that the Undo/Redo innards differ if $w has or does not +# have a -textvariable. +# +# The options added by widgetPlus are shown on the first line of each widgetPlus +# command. The options on continuation lines are those of the widget hull. +# ------------------------------------------------------------------------------ + +proc CreateWidget {w} { + destroy $w + switch -exact -- $::hullType { + entry {entryPlus $w -undo 1 -maxundo 0 \ + -bg white} + + spinbox {spinboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5} \ + -bg white} + + ttk::entry {ttkEntryPlus $w -undo 1 -maxundo 0} + + ttk::spinbox {ttkSpinboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5}} + + ttk::combobox {ttkComboboxPlus $w -undo 1 -maxundo 0 \ + -values {1 2 3 4 5}} + + default {error {set ::hullType to entry, ttk::entry, spinbox,\ + ttk::spinbox, or ttk::combobox}} + } + + pack $w -side left + + $w delete 0 end + $w insert end {Initial Text} + $w edit reset + + return +} + + +# ------------------------------------------------------------------------------ +# Command CreateDemo +# ------------------------------------------------------------------------------ +# Command to create a megawidget with a descriptive label, a radiobutton widget +# selector, and a widgetPlus widget. +# ------------------------------------------------------------------------------ + +proc CreateDemo {w} { + frame $w + label $w.lab -text {Use radiobuttons to choose widget:} + pack $w.lab -pady 10 + + frame $w.f + radiobutton $w.f.rb0 -value entry -text entry + radiobutton $w.f.rb1 -value spinbox -text spinbox + radiobutton $w.f.rb2 -value ttk::entry -text ttk::entry + radiobutton $w.f.rb3 -value ttk::spinbox -text ttk::spinbox + radiobutton $w.f.rb4 -value ttk::combobox -text ttk::combobox + + foreach rb {.f.rb0 .f.rb1 .f.rb2 .f.rb3 .f.rb4} { + $w$rb configure -variable ::hullType -command [list CreateWidget $w.g.e] + } + pack $w.f.rb0 $w.f.rb1 $w.f.rb2 $w.f.rb3 $w.f.rb4 -side left -padx 5 + pack $w.f + set ::hullType entry + + frame $w.g + pack $w.g -padx 20 -pady {20 10} + + frame $w.g.filler -height 30 -width 1 + pack $w.g.filler -side left + + # Start with "entry", specified by ::hullType. + CreateWidget $w.g.e + return $w +} + +# Select, create and map a widgetPlus widget. + +CreateDemo .wpdemo +pack .wpdemo + +# Choose options: whether to use persistentSelection, ntext. +set PS 0 +set NT 0 + +# Create and map a text widget. + +text .top -height 17 -bg white -wrap word -undo 1 -maxundo 0 +pack .top + +set RR \u00ae + +.top insert end "Try Undo/Redo on the widget modified with widgetPlus (above) and the text widget (here). + +On X11 systems (Linux$RR, BSD$RR, Solaris$RR ...) + <> is mapped to + <> is mapped to + +On Windows$RR systems + <> is mapped to + <> is mapped to + +On Aqua$RR systems (i.e. Apple$RR macOS$RR or OS X$RR) + <> is mapped to + <> is mapped to +" + +if $PS { + .top insert end "\nAlso try using the persistent PRIMARY selection." +} + +.top edit reset + +if $NT { + # Create and map a ntext widget. + package require ntext + text .mid -height 5 -bg white -wrap word -undo 1 -maxundo 0 + pack .mid -pady {10 0} + bindtags .mid {.mid Ntext . all} + if $PS { + .mid insert end "Also try the persistent PRIMARY selection, and Undo/Redo, on this ntext widget." + } else { + .mid insert end "Also try Undo/Redo on this ntext widget." + } + .mid edit reset +} + +if $PS { + # Append this code to test persistentSelection. + package require persistentSelection + persistentSelection::fixText + bind Text <> {persistentSelection::report text %W} + bind Ntext <> {persistentSelection::report text %W} + bind EntryPlus <> {persistentSelection::report entry %W} + bind TEntryPlus <> {persistentSelection::report entry %W} + bind SpinboxPlus <> {persistentSelection::report entry %W} + bind TSpinboxPlus <> {persistentSelection::report entry %W} + bind TComboboxPlus <> {persistentSelection::report entry %W} +} diff --git a/modules/controlwidget/ChangeLog b/modules/controlwidget/ChangeLog index 39e4a4a0..9d7366c8 100644 --- a/modules/controlwidget/ChangeLog +++ b/modules/controlwidget/ChangeLog @@ -1,3 +1,9 @@ +2017-05-22 Arjen Markus + * demo-rdial.tcl: Updated demo for the rdial widget + * rdial.tcl: Added support for mousewheel + * pkgIndex.tcl: Bumped verion of rdial to 0.7 + * controlwidget.man: Added description of new options and support of mousewheel + 2010-10-06 Arjen Markus * demo-*.tcl: Added shebang and package require statements as per ticket 19721eff15 * demo-meters.tcl: Changed line-endings to UNIX convention as per ticket af953d9fbf diff --git a/modules/controlwidget/controlwidget.man b/modules/controlwidget/controlwidget.man index 657de96d..836992e2 100755 --- a/modules/controlwidget/controlwidget.man +++ b/modules/controlwidget/controlwidget.man @@ -344,6 +344,10 @@ Color for the needle and the pin [call [cmd ::controlwidget::rdial] [arg w] [arg args]] Create a rotating dial. You can drag the dial to change the value. With the shift button depressed the value changes slowly, with the control button depressed it changes fast. +Similarly, you can control the dial via the mouse wheel, with the shift and control button +working in the same way as with the mouse pointer. + +[emph Note:] The shift and control buttons currently have no effect on Windows. [list_begin arguments] [arg_def widget w in] @@ -361,6 +365,8 @@ Value for the dial (if not associated with a variable) Whether a horizontal disk/dial is required ("horizontal") or a vertical one ("vertical") [opt_def step value] Initial step for incrementing or decrementing the value +[opt_def bindwheel value] +Step size for controlling the dial's value via the mouse wheel [opt_def slow value] Factor on the step size for incrementing or decrementing the value slowly [opt_def fast value] diff --git a/modules/controlwidget/pkgIndex.tcl b/modules/controlwidget/pkgIndex.tcl index aa4473a5..99c5f1e5 100755 --- a/modules/controlwidget/pkgIndex.tcl +++ b/modules/controlwidget/pkgIndex.tcl @@ -12,7 +12,7 @@ if {![package vsatisfies [package provide Tcl] 8.5]} { package ifneeded controlwidget 0.1 [list source [file join $dir controlwidget.tcl]] package ifneeded meter 1.0 [list source [file join $dir vertical_meter.tcl]] package ifneeded led 1.0 [list source [file join $dir led.tcl]] -package ifneeded rdial 0.3 [list source [file join $dir rdial.tcl]] +package ifneeded rdial 0.7 [list source [file join $dir rdial.tcl]] package ifneeded tachometer 0.1 [list source [file join $dir tachometer.tcl]] package ifneeded voltmeter 0.1 [list source [file join $dir voltmeter.tcl]] package ifneeded radioMatrix 1.0 [list source [file join $dir radioMatrix.tcl]] diff --git a/modules/controlwidget/rdial.tcl b/modules/controlwidget/rdial.tcl index bd7feec2..df7f8ab9 100755 --- a/modules/controlwidget/rdial.tcl +++ b/modules/controlwidget/rdial.tcl @@ -30,8 +30,8 @@ # # THE AUTHOR AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND -# NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND +# NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, # AND THE AUTHOR AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE # MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # @@ -41,12 +41,20 @@ # rdial::create w ?-width wid? ?-height hgt? ?-value floatval? # ?-bg|-background bcol? ?-fg|-foreground fcol? ?-step step? # ?-callback script? ?-scale "degrees"|"radians"|factor? -# ?-slow sfact? ?-fast ffact? ?-orient horizontal|vertical? +# ?-slow sfact? ?-fast ffact? ?-orient "horizontal"|"vertical"? +# ?-variable varname? ?-bindwheel step? # # History: # 20100526: -scale option added # 20100626: incorrect "rotation direction" in vertical mode repaired # 20100704: added -variable option and methods get and set (AM) +# 20101020: bug {[info exists ...]<0} => {![info exists ...]} repaired +# 20101112: drag: set opt(-value) depending on scale - thank's Manfred R. +# 20101118: -variable option added +# 20170518: -bindwheel option added for scrollwheel input +# 20170523: boolean variable buttonwheel controls Button/Wheel binding. +# if false the event is used (by default in Windows), +# the event if it is false (other systems). # # Todo: # option -variable -- conflicts with -value @@ -82,6 +90,7 @@ snit::widget controlwidget::rdial { option -fast -default 10 option -scale -default 1.0 -configuremethod SetOption option -variable -default {} -configuremethod VariableName + option -bindwheel -default 2.0 -configuremethod SetOption variable d2r variable sfact @@ -89,9 +98,17 @@ snit::widget controlwidget::rdial { variable ovalue variable sector 88 variable callback + variable buttonwheel 1 + variable wheelfactor 15.0 constructor args { + + # I did not find a platform independent method :-( + if {$::tcl_platform(platform) eq "windows"} { + set buttonwheel 0 + } + # # A few constants to reduce expr # @@ -108,8 +125,6 @@ snit::widget controlwidget::rdial { grid $win.c -sticky nsew - # just for laziness ;) - set nsc [namespace current] set wid $options(-width) set hgt $options(-height) set bgc $options(-background) @@ -119,30 +134,50 @@ snit::widget controlwidget::rdial { $win.c configure -width $wid -height $hgt # standard bindings bind $win.c [list $self SetVar ovalue %x] - bind $win.c [list $self drag %W %x] - bind $win.c [list $self drag %W %x] - # fine movement - bind $win.c [list $self SetVar ovalue %x] - bind $win.c [list $self drag %W %x -1] - bind $win.c [list $self drag %W %x -1] + bind $win.c [list $self drag %W %x 0] + bind $win.c [list $self drag %W %x 0] # course movement + bind $win.c [list $self SetVar ovalue %x] + bind $win.c [list $self drag %W %x 1] + bind $win.c [list $self drag %W %x 1] + # fine movement bind $win.c [list $self SetVar ovalue %x] - bind $win.c [list $self drag %W %x 1] - bind $win.c [list $self drag %W %x 1] + bind $win.c [list $self drag %W %x -1] + bind $win.c [list $self drag %W %x -1] } else { $win.c configure -width $hgt -height $wid - # standard bindings + # standard binding bind $win.c [list $self SetVar ovalue %y] - bind $win.c [list $self drag %W %y] - bind $win.c [list $self drag %W %y] - # fine movement - bind $win.c [list $self SetVar ovalue %y] - bind $win.c [list $self drag %W %y -1] - bind $win.c [list $self drag %W %y -1] + bind $win.c [list $self drag %W %y 0] + bind $win.c [list $self drag %W %y 0] # course movement + bind $win.c [list $self SetVar ovalue %y] + bind $win.c [list $self drag %W %y 1] + bind $win.c [list $self drag %W %y 1] + # fine movement bind $win.c [list $self SetVar ovalue %y] - bind $win.c [list $self drag %W %y 1] - bind $win.c [list $self drag %W %y 1] + bind $win.c [list $self drag %W %y -1] + bind $win.c [list $self drag %W %y -1] + } + if {$options(-bindwheel) != 0} { + if {$buttonwheel} { + set up $options(-bindwheel) + set dn [expr {0.0 - $up}] + # standard binding + bind $win.c [list $self roll %W $up 0] + bind $win.c [list $self roll %W $dn 0] + # course movement + bind $win.c [list $self roll %W $up 1] + bind $win.c [list $self roll %W $dn 1] + # fine movement + bind $win.c [list $self roll %W $up -1] + bind $win.c [list $self roll %W $dn -1] + } else { + # it seem that Shift+Control doesn't work :-( + bind $win.c [list $self roll %W %D 0] + bind $win.c [list $self roll %W %D 1] + bind $win.c [list $self roll %W %D -1] + } } if {$options(-variable) ne ""} { @@ -155,7 +190,6 @@ snit::widget controlwidget::rdial { trace add variable ::$options(-variable) write [mymethod variableChanged] } - # draw insides $self draw $win.c $options(-value) } @@ -269,7 +303,6 @@ snit::widget controlwidget::rdial { # draw the thumb wheel view method draw {w val} { - set stp $options(-step) set wid $options(-width) set hgt $options(-height) @@ -310,8 +343,22 @@ snit::widget controlwidget::rdial { set options(-value) $val } - method drag {w coord {mode 0}} { - variable opt + # update rdials after value change + method rdupdate {w diff} { + # calculate "new" calue + set options(-value) [expr {$options(-value)+$diff*$options(-scale)}] + + # call callback if defined... + if {$options(-callback) ne ""} { + {*}$options(-callback) $options(-value) + } + + # draw knob with new angle + $self draw $w $options(-value) + } + + # change by mouse dragging + method drag {w coord mode} { variable ovalue # calculate new value @@ -325,22 +372,29 @@ snit::widget controlwidget::rdial { } elseif {$mode>0} { set diff [expr {$diff*$options(-fast)}] } - set options(-value) [expr {$options(-value)+$diff}] - - # call callback if defined... - if {$options(-callback) ne ""} { - {*}$options(-callback) [expr {$options(-value)*$options(-scale)}] - } + $self rdupdate $w $diff - # draw knob with new angle - $self draw $win.c $options(-value) # store "old" value for diff set ovalue $coord } + + # change by mouse wheel + method roll {w diff mode} { + + if {! $buttonwheel} { + set diff [expr {$diff/$wheelfactor/$options(-bindwheel)}] + } + if {$mode<0} { + set diff [expr {$diff*$options(-slow)}] + } elseif {$mode>0} { + set diff [expr {$diff*$options(-fast)}] + } + $self rdupdate $w $diff + } } # Announce our presence -package provide rdial 0.3 +package provide rdial 0.7 #-------- test & demo ... disable it for package autoloading -> {0} if {0} { @@ -373,11 +427,14 @@ if {0} { } } } - label .lb -text "Use mouse button with Shift &\nControl for dragging the dials" + set help "Use mouse button with Shift &" + append help "\nControl for dragging the dials" + append help "\nwith Mouswheel support" + label .lb -text $help label .lv -textvariable disp_value(rv) controlwidget::rdial .rv -callback {show_value rv} -value $disp_value(rv)\ -width 200 -step 5 -bg blue -fg white \ - -variable score + -variable score -bindwheel -10.0 label .lh -textvariable disp_value(rh) controlwidget::rdial .rh -callback {show_value rh} -value $disp_value(rh)\ -width $disp_value(rh) -height 20 -fg blue -bg yellow -orient vertical diff --git a/modules/ctext/README b/modules/ctext/README index 3cbd1d41..11444791 100644 --- a/modules/ctext/README +++ b/modules/ctext/README @@ -151,5 +151,5 @@ o Thanks Kevin Kenny, Neil Madden, Jeffrey Hobbs, Richard Suchenwirth, - Johan Bengtsson, Mac Cody, Günther, Andreas Sievers, and + Johan Bengtsson, Mac Cody, Gűnther, Andreas Sievers, and Michael Schlenker diff --git a/modules/mentry/CHANGES.txt b/modules/mentry/CHANGES.txt index d7033813..4ee3fd96 100644 --- a/modules/mentry/CHANGES.txt +++ b/modules/mentry/CHANGES.txt @@ -1,6 +1,33 @@ -What is new in Mentry 3.7? +What is new in Mentry 3.9? -------------------------- +1. Included the same version of the general mega-widget utility module + "mwutil.tcl" as in the most recent Tablelist release 6.5. + +2. Corrected two typos related to the "hasattrib" and "unsetattrib" + subcommands. + +3. Minor improvements in the documentation. + +What was new in Mentry 3.8? +--------------------------- + +1. Added support for the themes "aquativo", "Arc", and "clearlooks"; + updated the support for several other themes. + +2. Adapted to some changes in future Tcl and Tk releases (for example, + made sure that it works with Tcl 9.0 and Tk 8.7). + +3. Included the same version of the general mega-widget utility module + "mwutil.tcl" as in the most recent Tablelist release 6.3. + +4. Updated the demo-scripts and the documentation. + +5. Several code improvements and minor bug fixes. + +What was new in Mentry 3.7? +--------------------------- + 1. Minor performance improvements. 2. Included the same version of the general mega-widget utility module diff --git a/modules/mentry/COPYRIGHT.txt b/modules/mentry/COPYRIGHT.txt index d54dac7d..5dd17c2f 100644 --- a/modules/mentry/COPYRIGHT.txt +++ b/modules/mentry/COPYRIGHT.txt @@ -1,5 +1,5 @@ -Multi-entry widget package Mentry, version 3.7 -Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +Multi-entry widget package Mentry, version 3.9 +Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained diff --git a/modules/mentry/ChangeLog b/modules/mentry/ChangeLog index 183ccb28..088feb15 100644 --- a/modules/mentry/ChangeLog +++ b/modules/mentry/ChangeLog @@ -1,3 +1,54 @@ +2019-05-01 Csaba Nemethi + + * CHANGES.txt: Slightly extended. + +2019-05-01 Csaba Nemethi + + * doc/mentry.html: Minor improvements. + * doc/mentryDateTime.html: + +2019-04-23 Csaba Nemethi + + * *.tcl: Bumped the version number to 3.9; updated the + * COPYRIGHT.txt: copyright information. + * README.txt: + + * CHANGES.txt: Updated to reflect the changes. + + * doc/*.html: Bumped the version number to 3.9. + + * scripts/*.tcl: Included the same version of "mwutil.tcl" as in + Tablelist release 6.5; corrected two typos related to the "hasattrib" + and "unsetattrib" subcommands; updated the copyright information. + + * scripts/tclIndex: Newly generated. + + * ../../examples/mentry/*.tcl: Updated the copyright information. + +2018-10-08 Csaba Nemethi + + * *.tcl: Bumped the version number to 3.8; adapted to some changes in + future Tcl and Tk releases (TIP 278, independent Tcl and Tk versions); + updated the copyright information. + + * COPYRIGHT.txt: Bumped the version number to 3.8. + * README.txt: + + * CHANGES.txt: Updated to reflect the changes. + * doc/*.html: + + * doc/*.png: Updated the screenshots. + + * scripts/*.tcl: Added support for the themes "aquativo", "Arc", and + "clearlooks"; updated the support for several other themes; included + the same version of "mwutil.tcl" as in Tablelist release 6.3; several + code improvements and minor bug fixes; updated the copyright + information. + + * scripts/tclIndex: Newly generated. + + * ../../examples/mentry/*.tcl: Various updates. + 2014-02-16 Csaba Nemethi * *.tcl: Bumped the version number to 3.7; updated the diff --git a/modules/mentry/README.txt b/modules/mentry/README.txt index 371fcdfa..6f88afbf 100644 --- a/modules/mentry/README.txt +++ b/modules/mentry/README.txt @@ -7,7 +7,7 @@ csaba.nemethi@t-online.de -What is Mentry? +What Is Mentry? --------------- Mentry is a library package for Tcl/Tk versions 8.0 or higher, written @@ -50,11 +50,11 @@ is http://www.nemethi.de -How to get it? +How to Get It? -------------- Mentry is available for free download from the same URL as Wcb. The -distribution file is "mentry3.7.tar.gz" for UNIX and "mentry3_7.zip" +distribution file is "mentry3.9.tar.gz" for UNIX and "mentry3_9.zip" for Windows. These files contain the same information, except for the additional carriage return character preceding the linefeed at the end of each line in the text files for Windows. @@ -63,7 +63,7 @@ Mentry is also included in tklib, which has the address http://core.tcl.tk/tklib -How to install it? +How to Install It? ------------------ Install the package as a subdirectory of one of the directories given @@ -73,21 +73,25 @@ locations of these library directories are given by the "tcl_library" and "tk_library" variables, respectively. To install Mentry on UNIX, "cd" to the desired directory and unpack the -distribution file "mentry3.7.tar.gz": +distribution file "mentry3.9.tar.gz": - gunzip -c mentry3.7.tar.gz | tar -xf - + gunzip -c mentry3.9.tar.gz | tar -xf - -This command will create a directory named "mentry3.7", with the +On most UNIX systems this can be replaced with + + tar -zxf mentry3.9.tar.gz + +Both commands will create a directory named "mentry3.9", with the subdirectories "demos", "doc", and "scripts". On Windows, use WinZip or some other program capable of unpacking the -distribution file "mentry3_7.zip" into the directory "mentry3.7", with +distribution file "mentry3_9.zip" into the directory "mentry3.9", with the subdirectories "demos", "doc", and "scripts". The file "mentryThemes.tcl" in the "scripts" directory is only needed for applications using the package Mentry_tile (see next section). -How to use it? +How to Use It? -------------- The Mentry distribution provides two packages, called Mentry and diff --git a/modules/mentry/doc/datetime1.png b/modules/mentry/doc/datetime1.png index 70582d2f..d1cca3ef 100644 Binary files a/modules/mentry/doc/datetime1.png and b/modules/mentry/doc/datetime1.png differ diff --git a/modules/mentry/doc/datetime2.png b/modules/mentry/doc/datetime2.png index a7293cae..c0f51f74 100644 Binary files a/modules/mentry/doc/datetime2.png and b/modules/mentry/doc/datetime2.png differ diff --git a/modules/mentry/doc/ethernetaddr.png b/modules/mentry/doc/ethernetaddr.png index ad58cfe0..62af86b9 100644 Binary files a/modules/mentry/doc/ethernetaddr.png and b/modules/mentry/doc/ethernetaddr.png differ diff --git a/modules/mentry/doc/index.html b/modules/mentry/doc/index.html index 0a4d7bf1..3c6b558c 100644 --- a/modules/mentry/doc/index.html +++ b/modules/mentry/doc/index.html @@ -1,6 +1,6 @@ - The Multi-Entry Widget Package Mentry 3.7 + The Multi-Entry Widget Package Mentry 3.9 @@ -8,7 +8,7 @@
-

The Multi-Entry Widget Package Mentry 3.7

+

The Multi-Entry Widget Package Mentry 3.9

by

diff --git a/modules/mentry/doc/mentry.html b/modules/mentry/doc/mentry.html index f12231c9..d39f5316 100644 --- a/modules/mentry/doc/mentry.html +++ b/modules/mentry/doc/mentry.html @@ -12,7 +12,7 @@

Mentry Programmer's Guide

-

For Mentry Version 3.7

+

For Mentry Version 3.9

by

@@ -29,7 +29,7 @@

Contents

Overview

    -
  • What is Mentry?
  • +
  • What Is Mentry?
  • How to Get It?
  • @@ -60,7 +60,7 @@

    Examples

    Overview

    -

    What is Mentry?

    +

    What Is Mentry?

    Mentry is a library package for Tcl/Tk versions 8.0 or higher, written in pure Tcl/Tk code.  It contains:

    @@ -145,8 +145,8 @@

    What is Mentry?

    How to Get It?

    Mentry is available for free download from the same URL as Wcb.  The - distribution file is mentry3.7.tar.gz for UNIX and - mentry3_7.zip for Windows.  These files contain the same + distribution file is mentry3.9.tar.gz for UNIX and + mentry3_9.zip for Windows.  These files contain the same information, except for the additional carriage return character preceding the linefeed at the end of each line in the text files for Windows.

    @@ -168,21 +168,29 @@

    How to Install It?

    respectively.

    To install Mentry on UNIX, cd to the desired directory - and unpack the distribution file mentry3.7.tar.gz:

    + and unpack the distribution file mentry3.9.tar.gz:

    -gunzip -c mentry3.7.tar.gz | tar -xf -
    +gunzip -c mentry3.9.tar.gz | tar -xf -
     
    -

    This command will create a directory named mentry3.7, with +

    On most UNIX systems this can be replaced with

    + +
    +
    +tar -zxf mentry3.9.tar.gz
    +
    +
    + +

    Both commands will create a directory named mentry3.9, with the subdirectories demos, doc, and scripts.

    On Windows, use WinZip or some other program capable of unpacking - the distribution file mentry3_7.zip into the directory - mentry3.7, with the subdirectories demos, + the distribution file mentry3_9.zip into the directory + mentry3.9, with the subdirectories demos, doc, and scripts.

    The file mentryThemes.tcl in the scripts @@ -332,20 +340,19 @@

    More on Mentry_tile

    After these cautions concerning the use of tile, the rest of this section describes the differences between the packages Mentry and Mentry_tile.

    -

    The Mentry_tile package checks whether the required Tcl, Tk, and tile - versions are present, by executing the commands

    +

    The Mentry_tile package checks whether the required Tk and tile versions + are present, by executing the commands

    -package require Tcl 8.4
    -package require Tk  8.4
    +package require Tk 8.4
     if {$::tk_version < 8.5 || [regexp {^8\.5a[1-5]$} $::tk_patchLevel]} {
         package require tile 0.6
     }
     
    -

    The last command above reflects the fact that, beginning with Tk 8.5a6, +

    The second command above reflects the fact that, beginning with Tk 8.5a6, tile is integrated into the Tk core and therefore it should only be loaded explicitly when using an earlier Tk version.

    @@ -608,7 +615,7 @@

    A mentry Widget for Phone Numbers

    application displaying the following figure:

    - Phone Number + Phone Number

    Here is the relevant code fragment:

    @@ -661,7 +668,7 @@

    A mentry Widget for Phone Numbers

    # # Label .num displaying the result of getPhoneNumber # -label .num -textvariable num +label .num -textvariable num -background white . . . @@ -818,8 +825,8 @@

    A mentry Widget for Ethernet Addresses

    Ethernet addresses looks like in the following figure:

    - Ethernet Address + Ethernet Address

    Using mentry Widgets for Date and Time

    @@ -856,7 +863,7 @@

    Using mentry Widgets for Date and Time

  • Finally, the procedure mentry::dateTimeentry - creates a new mentry widget for displaying and editing a date & time + creates a new mentry widget for displaying and editing a date & time according to the format passed to the command as a 5- or 6-character string, with the first three characters consisting of the letters "d", "m", and "y" or @@ -877,7 +884,7 @@

    Using mentry Widgets for Date and Time

     package require mentry
     
    -set title "Date & Time"
    +set title "Date & Time"
     wm title . $title 
     
     #
    @@ -895,7 +902,7 @@ 

    Using mentry Widgets for Date and Time

    array set timeSeps {0 : 1 : } # -# Choose the date & time formats; don't use the %p field descriptor +# Choose the date & time formats; don't use the %p field descriptor # for displaying the AM/PM indicator, because it doesn't work on # UNIX if Tcl/Tk 8.4 or higher is used in a non-default locale # @@ -916,7 +923,7 @@

    Using mentry Widgets for Date and Time

    wm deiconify . # -# Frame .f with mentries displaying the date & time +# Frame .f with mentries displaying the date & time # frame .f label .f.lDate -text "Date: " @@ -941,7 +948,7 @@

    Using mentry Widgets for Date and Time

    2  and  timeIdx = 1:

    - Date & Time + Date & Time

    The demo script datetime2.tcl displays both the date and time @@ -951,10 +958,10 @@

    Using mentry Widgets for Date and Time

     #
    -# Frame .f with a mentry displaying the date & time
    +# Frame .f with a mentry displaying the date & time
     #
     frame .f
    -label .f.l -text "Date & time: "
    +label .f.l -text "Date & time: "
     mentry::dateTimeMentry .f.me $dateFmts($dateIdx)$timeFmts($timeIdx) \
                            $dateSeps($dateIdx) $timeSeps($timeIdx) \
                            -justify center -background white
    @@ -963,27 +970,27 @@ 

    Using mentry Widgets for Date and Time

    - Date & Time + Date & Time
    -

    The Mentry package exports two further commands for date, time, and date - & time mentries:

    +

    The Mentry package exports two further commands for date, time, and date & + time mentries:

    • The procedure mentry::putClockVal outputs - the date, time, or date & time corresponding to an integer clock value - specified as its first argument to a date, time, or date & time mentry + the date, time, or date & time corresponding to an integer clock value + specified as its first argument to a date, time, or date & time mentry widget, passed to it as the second parameter.  Like the  clock format  command, the procedure accepts the optional argument pair  -gmt boolean.
    • The procedure mentry::getClockVal returns - the clock value corresponding to the date, time, or date & time - contained in the date, time, or date & time mentry specified as its - first argument.  Like the  clock scan  command, - the procedure accepts the optional argument pairs  -base + the clock value corresponding to the date, time, or date & time contained + in the date, time, or date & time mentry specified as its first + argument.  Like the  clock scan  command, the + procedure accepts the optional argument pairs  -base clockValue  and  -gmt boolean.  On failure, the procedure sets the focus to the first erronous entry child, generates an error, and returns one of the @@ -1043,7 +1050,7 @@

      Using mentry Widgets for Date and Time

      # # Label .dateTime displaying the result of mentry::getClockVal # -label .dateTime -textvariable dateTime +label .dateTime -textvariable dateTime -background white . . . @@ -1060,7 +1067,7 @@

      Using mentry Widgets for Date and Time

      of the -base option when passing the name of the time mentry to the same procedure.

      -

      The demo script datetime2.tcl is more simple:

      +

      The demo script datetime2.tcl is simpler:

      @@ -1082,7 +1089,7 @@ 

      Using mentry Widgets for Date and Time

      # # Label .dateTime displaying the result of mentry::getClockVal # -label .dateTime -textvariable dateTime +label .dateTime -textvariable dateTime -background white . . . @@ -1157,7 +1164,7 @@

      Tile-Based Demo Scripts

      # # Label .base.num displaying the result of getPhoneNumber # -ttk::label .base.num -textvariable num +ttk::label .base.num -textvariable num -background white . . . @@ -1170,8 +1177,8 @@

      Tile-Based Demo Scripts

      appearance:

      - Phone Number + Phone Number

      The only Mentry-specific change in the code above consists of the use of diff --git a/modules/mentry/doc/mentryDateTime.html b/modules/mentry/doc/mentryDateTime.html index b0618a49..10f5a7d1 100644 --- a/modules/mentry/doc/mentryDateTime.html +++ b/modules/mentry/doc/mentryDateTime.html @@ -12,7 +12,7 @@

      Multi-Entry Widgets for Date and Time

      -

      For Mentry Version 3.7

      +

      For Mentry Version 3.9

      by

      @@ -204,7 +204,7 @@

      The mentry::dateTimeMentry
      NAME
      mentry::dateTimeMentry – Create and manipulate - mentry widgets for date & time
      + mentry widgets for date & time
      SYNOPSIS
      @@ -217,7 +217,7 @@

      The mentry::dateTimeMentry
      DESCRIPTION
      This command creates a new mentry widget pathName - for displaying and editing a date & time according to the + for displaying and editing a date & time according to the format argument, which must be a string of length 5 or 6, with the first 3 characters consisting of the letters "d" for the day (01 - 31), @@ -290,7 +290,7 @@

      The mentry::putClockVal Command

      NAME
      mentry::putClockVal – Output a clock value to a - date, time, or date & time mentry
      + date, time, or date & time mentry
      SYNOPSIS
      @@ -302,8 +302,8 @@

      The mentry::putClockVal Command

      DESCRIPTION
      -
      This command outputs the date, time, or date & time corresponding - to the integer clockValue to the mentry widget +
      This command outputs the date, time, or date & time corresponding to + the integer clockValue to the mentry widget pathName, which must have been created with the mentry::dateMentry, mentry::timeMentry, or @@ -335,7 +335,7 @@

      The mentry::getClockVal Command

      NAME
      mentry::getClockVal – Get the clock value from a - date, time, or date & time mentry
      + date, time, or date & time mentry
      SYNOPSIS
      @@ -348,14 +348,14 @@

      The mentry::getClockVal Command

      DESCRIPTION
      This command returns the clock value corresponding to the date, time, - or date & time contained in the mentry widget - pathName, which must have been created with the - mentry::dateMentry, - mentry::timeMentry, or - mentry::dateTimeMentry - command (this is checked by examining the widget's type - attribute, which must have the value "Date", - "Time", or "DateTime").
      + or date & time contained in the mentry widget pathName, + which must have been created with the mentry::dateMentry, mentry::timeMentry, or mentry::dateTimeMentry command (this is + checked by examining the widget's type attribute, which + must have the value "Date", "Time", or + "DateTime").
      Like in the case of the  clock scan  command, the optional argument pair  diff --git a/modules/mentry/doc/mentryFixedPoint.html b/modules/mentry/doc/mentryFixedPoint.html index 16a77c73..86a4de5d 100644 --- a/modules/mentry/doc/mentryFixedPoint.html +++ b/modules/mentry/doc/mentryFixedPoint.html @@ -13,7 +13,7 @@

      Multi-Entry Widgets for Real Numbers
      in Fixed-Point Format

      -

      For Mentry Version 3.7

      +

      For Mentry Version 3.9

      by

      diff --git a/modules/mentry/doc/mentryIPAddr.html b/modules/mentry/doc/mentryIPAddr.html index 37583883..a643f4f3 100644 --- a/modules/mentry/doc/mentryIPAddr.html +++ b/modules/mentry/doc/mentryIPAddr.html @@ -12,7 +12,7 @@

      Multi-Entry Widgets for IP Addresses

      -

      For Mentry Version 3.7

      +

      For Mentry Version 3.9

      by

      diff --git a/modules/mentry/doc/mentryIPv6Addr.html b/modules/mentry/doc/mentryIPv6Addr.html index 909206b9..97812764 100644 --- a/modules/mentry/doc/mentryIPv6Addr.html +++ b/modules/mentry/doc/mentryIPv6Addr.html @@ -12,7 +12,7 @@

      Multi-Entry Widgets for IPv6 Addresses

      -

      For Mentry Version 3.7

      +

      For Mentry Version 3.9

      by

      diff --git a/modules/mentry/doc/mentryThemes.html b/modules/mentry/doc/mentryThemes.html index 0fc1eb15..9de835a6 100644 --- a/modules/mentry/doc/mentryThemes.html +++ b/modules/mentry/doc/mentryThemes.html @@ -12,7 +12,7 @@

      Commands Related to Tile Themes

      -

      For Mentry Version 3.7

      +

      For Mentry Version 3.9

      by

      diff --git a/modules/mentry/doc/mentryWidget.html b/modules/mentry/doc/mentryWidget.html index 6e99dc8c..6acc5a23 100644 --- a/modules/mentry/doc/mentryWidget.html +++ b/modules/mentry/doc/mentryWidget.html @@ -12,7 +12,7 @@

      The mentry::mentry Command

      -

      For Mentry Version 3.7

      +

      For Mentry Version 3.9

      by

      @@ -234,7 +234,7 @@

      Detailed Reference

      These options (described in the options manual entry) specify - the values of the options with the same names for all entry and label + the values of the options of the same names for all entry and label children of the given multi-entry widget.  These values may be changed for an individual child by using the configure subcommand of the Tcl command corresponding to that child.  However, @@ -251,6 +251,12 @@

      Detailed Reference

      -fg (for -foreground) are supported for both classical and tile-based mentry widgets.
      +
      REMARK:  Please take into account that for some + themes (like Arc, plastik, + tileqt, vista, and + xpnative), the -background option + will be ignored for the entry children of a tile-based mentry widget.
      +
      OPTIONS FOR ALL ENTRY CHILDREN
      @@ -264,14 +270,14 @@

      Detailed Reference

      -
      These options specify the values of the options with the same names for +
      These options specify the values of the options of the same names for all entry children of the given multi-entry widget.  These values may be changed for an individual entry child by using the configure subcommand of the Tcl command corresponding to that entry.  The -invalidcommand, -validate, and -validatecommand options are only supported if Tk version 8.3 or higher is used, because the - options with the same names for entry widgets were introduced in Tk + options of the same names for entry widgets were introduced in Tk 8.3.  The options -insertbackground, -insertborderwidth, -insertofftime, -insertontime, -insertwidth, @@ -453,7 +459,7 @@

      Detailed Reference

      This option determines whether the widget accepts the focus during keyboard traversal.  It is almost identical to the standard option - with the same name (see the options manual entry for + of the same name (see the options manual entry for details).  The only difference is that not the widget itself but its first enabled entry child will receive the focus during keyboard traversal with the standard keys (Tab and diff --git a/modules/mentry/doc/phonenumber.png b/modules/mentry/doc/phonenumber.png index 55f4dbb0..1a900469 100644 Binary files a/modules/mentry/doc/phonenumber.png and b/modules/mentry/doc/phonenumber.png differ diff --git a/modules/mentry/doc/phonenumber_tile.png b/modules/mentry/doc/phonenumber_tile.png index dc543a77..707f82b2 100644 Binary files a/modules/mentry/doc/phonenumber_tile.png and b/modules/mentry/doc/phonenumber_tile.png differ diff --git a/modules/mentry/doc/wcbRef.html b/modules/mentry/doc/wcbRef.html index 34a37ac6..1dce6987 100644 --- a/modules/mentry/doc/wcbRef.html +++ b/modules/mentry/doc/wcbRef.html @@ -13,7 +13,7 @@

      Wcb Command Reference

      -

      For Wcb Version 3.5

      +

      For Wcb Version 3.6

      by

      diff --git a/modules/mentry/mentry.tcl b/modules/mentry/mentry.tcl index 7d0f1a58..d0260cbf 100644 --- a/modules/mentry/mentry.tcl +++ b/modules/mentry/mentry.tcl @@ -1,13 +1,13 @@ #============================================================================== # Main Mentry package module. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require -exact mentry::common 3.7 +package require -exact mentry::common 3.9 -package provide Mentry $::mentry::version package provide mentry $::mentry::version +package provide Mentry $::mentry::version ::mentry::useTile 0 ::mentry::createBindings diff --git a/modules/mentry/mentryPublic.tcl b/modules/mentry/mentryPublic.tcl index 8c2d13d0..2ad5908e 100644 --- a/modules/mentry/mentryPublic.tcl +++ b/modules/mentry/mentryPublic.tcl @@ -1,7 +1,7 @@ #============================================================================== # Main Mentry and Mentry_tile package module. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== if {[catch {package require Wcb 3.1} result1] != 0 && @@ -13,9 +13,9 @@ namespace eval ::mentry { # # Public variables: # - variable version 3.7 + variable version 3.9 variable library - if {$tcl_version >= 8.4} { + if {$::tcl_version >= 8.4} { set library [file normalize [DIR]] } else { set library [DIR] ;# no "file normalize" yet diff --git a/modules/mentry/mentry_tile.tcl b/modules/mentry/mentry_tile.tcl index 4a74ab7c..cf0e8299 100644 --- a/modules/mentry/mentry_tile.tcl +++ b/modules/mentry/mentry_tile.tcl @@ -1,18 +1,17 @@ #============================================================================== # Main Mentry_tile package module. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require Tcl 8.4 -package require Tk 8.4 +package require Tk 8.4 if {$::tk_version < 8.5 || [regexp {^8\.5a[1-5]$} $::tk_patchLevel]} { package require tile 0.6 } -package require -exact mentry::common 3.7 +package require -exact mentry::common 3.9 -package provide Mentry_tile $::mentry::version package provide mentry_tile $::mentry::version +package provide Mentry_tile $::mentry::version ::mentry::useTile 1 ::mentry::createBindings diff --git a/modules/mentry/pkgIndex.tcl b/modules/mentry/pkgIndex.tcl index 10122621..d9066dfe 100644 --- a/modules/mentry/pkgIndex.tcl +++ b/modules/mentry/pkgIndex.tcl @@ -1,28 +1,28 @@ #============================================================================== # Mentry and Mentry_tile package index file. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Regular packages: # -package ifneeded mentry 3.7 \ +package ifneeded mentry 3.9 \ [list source [file join $dir mentry.tcl]] -package ifneeded mentry_tile 3.7 \ +package ifneeded mentry_tile 3.9 \ [list source [file join $dir mentry_tile.tcl]] # # Aliases: # -package ifneeded Mentry 3.7 \ - [list package require -exact mentry 3.7] -package ifneeded Mentry_tile 3.7 \ - [list package require -exact mentry_tile 3.7] +package ifneeded Mentry 3.9 \ + [list package require -exact mentry 3.9] +package ifneeded Mentry_tile 3.9 \ + [list package require -exact mentry_tile 3.9] # # Code common to all packages: # -package ifneeded mentry::common 3.7 \ +package ifneeded mentry::common 3.9 \ "namespace eval ::mentry { proc DIR {} {return [list $dir]} } ;\ source [list [file join $dir mentryPublic.tcl]]" diff --git a/modules/mentry/scripts/mentryDateTime.tcl b/modules/mentry/scripts/mentryDateTime.tcl index 3b4e4951..d96bb09a 100644 --- a/modules/mentry/scripts/mentryDateTime.tcl +++ b/modules/mentry/scripts/mentryDateTime.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains the implementation of multi-entry widgets for date and time. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # diff --git a/modules/mentry/scripts/mentryFixedPoint.tcl b/modules/mentry/scripts/mentryFixedPoint.tcl index f7dc76e2..bd834a32 100644 --- a/modules/mentry/scripts/mentryFixedPoint.tcl +++ b/modules/mentry/scripts/mentryFixedPoint.tcl @@ -2,7 +2,7 @@ # Contains the implementation of a multi-entry widget for real numbers in # fixed-point format. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # diff --git a/modules/mentry/scripts/mentryIPAddr.tcl b/modules/mentry/scripts/mentryIPAddr.tcl index 63e82814..e3259491 100644 --- a/modules/mentry/scripts/mentryIPAddr.tcl +++ b/modules/mentry/scripts/mentryIPAddr.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains the implementation of a multi-entry widget for IP addresses. # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # diff --git a/modules/mentry/scripts/mentryIPv6Addr.tcl b/modules/mentry/scripts/mentryIPv6Addr.tcl index baa50b5d..aa4fb56b 100644 --- a/modules/mentry/scripts/mentryIPv6Addr.tcl +++ b/modules/mentry/scripts/mentryIPv6Addr.tcl @@ -1,7 +1,7 @@ #============================================================================== # Contains the implementation of a multi-entry widget for IPv6 addresses. # -# Copyright (c) 2009-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2009-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # diff --git a/modules/mentry/scripts/mentryThemes.tcl b/modules/mentry/scripts/mentryThemes.tcl index e5041457..aa24ecb4 100644 --- a/modules/mentry/scripts/mentryThemes.tcl +++ b/modules/mentry/scripts/mentryThemes.tcl @@ -7,7 +7,7 @@ # - Private procedures related to tile themes # - Private procedures related to global KDE configuration options # -# Copyright (c) 2006-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2006-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -21,11 +21,7 @@ # Returns the current tile theme. #------------------------------------------------------------------------------ proc mentry::getCurrentTheme {} { - if {[info exists ttk::currentTheme]} { - return $ttk::currentTheme - } else { - return $tile::currentTheme - } + return [mwutil::currentTheme] } #------------------------------------------------------------------------------ @@ -36,6 +32,10 @@ proc mentry::getCurrentTheme {} { #------------------------------------------------------------------------------ proc mentry::setThemeDefaults {} { variable themeDefaults + if {[info exists themeDefaults(-readonlybackground)]} { + unset themeDefaults(-readonlybackground) + } + if {[catch {[getCurrentTheme]Theme}] != 0} { # # Fall back to the "default" theme (which is the root of all @@ -45,8 +45,11 @@ proc mentry::setThemeDefaults {} { array set themeDefaults [style configure .] } - set themeDefaults(-readonlybackground) $themeDefaults(-disabledbackground) - set themeDefaults(-font) TkTextFont + if {![info exists themeDefaults(-readonlybackground)]} { + set themeDefaults(-readonlybackground) \ + $themeDefaults(-disabledbackground) + } + set themeDefaults(-font) TkTextFont variable configSpecs foreach opt {-background -foreground -font} { @@ -88,13 +91,13 @@ proc mentry::altTheme {} { proc mentry::aquaTheme {} { variable themeDefaults array set themeDefaults [list \ - -background white \ - -disabledbackground white \ - -foreground black \ - -foreground,background #a3a3a3 \ - -disabledforeground #a3a3a3 \ + -background systemWindowBody \ + -disabledbackground "" \ + -foreground systemModelessDialogActiveText \ + -foreground,background systemModelessDialogInactiveText \ + -disabledforeground systemModelessDialogInactiveText \ -selectbackground systemHighlight \ - -selectforeground systemHighlightText \ + -selectforeground systemModelessDialogActiveText \ -selectborderwidth 0 \ -borderwidth 4 \ -labelpady {4 4} \ @@ -108,7 +111,7 @@ proc mentry::AquativoTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground black \ @@ -120,6 +123,44 @@ proc mentry::AquativoTheme {} { ] } +#------------------------------------------------------------------------------ +# mentry::aquativoTheme +#------------------------------------------------------------------------------ +proc mentry::aquativoTheme {} { + variable themeDefaults + array set themeDefaults [list \ + -background white \ + -disabledbackground "" \ + -foreground black \ + -foreground,background black \ + -disabledforeground #565248 \ + -selectbackground #000000 \ + -selectforeground #ffffff \ + -selectborderwidth 0 \ + -borderwidth 2 \ + -labelpady {2 2} \ + ] +} + +#------------------------------------------------------------------------------ +# mentry::ArcTheme +#------------------------------------------------------------------------------ +proc mentry::ArcTheme {} { + variable themeDefaults + array set themeDefaults [list \ + -background white \ + -disabledbackground #fbfcfc \ + -foreground #5c616c \ + -foreground,background #5c616c \ + -disabledforeground #a9acb2 \ + -selectbackground #5294e2 \ + -selectforeground #ffffff \ + -selectborderwidth 0 \ + -borderwidth 3 \ + -labelpady {1 1} \ + ] +} + #------------------------------------------------------------------------------ # mentry::blueTheme #------------------------------------------------------------------------------ @@ -127,7 +168,7 @@ proc mentry::blueTheme {} { variable themeDefaults array set themeDefaults [list \ -background #e6f3ff \ - -disabledbackground #e6f3ff \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #666666 \ @@ -146,7 +187,7 @@ proc mentry::clamTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #999999 \ @@ -177,6 +218,26 @@ proc mentry::classicTheme {} { ] } +#------------------------------------------------------------------------------ +# mentry::clearlooksTheme +#------------------------------------------------------------------------------ +proc mentry::clearlooksTheme {} { + variable themeDefaults + array set themeDefaults [list \ + -background white \ + -disabledbackground "" \ + -readonlybackground #efebe7 \ + -foreground black \ + -foreground,background black \ + -disabledforeground #b5b3ac \ + -selectbackground #7c99ad \ + -selectforeground #ffffff \ + -selectborderwidth 0 \ + -borderwidth 2 \ + -labelpady {2 2} \ + ] +} + #------------------------------------------------------------------------------ # mentry::defaultTheme #------------------------------------------------------------------------------ @@ -203,7 +264,7 @@ proc mentry::keramikTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #aaaaaa \ @@ -222,7 +283,7 @@ proc mentry::keramik_altTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #aaaaaa \ @@ -241,7 +302,7 @@ proc mentry::krocTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #b2b2b2 \ @@ -260,7 +321,7 @@ proc mentry::plastikTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #aaaaaa \ @@ -268,7 +329,7 @@ proc mentry::plastikTheme {} { -selectforeground #ffffff \ -selectborderwidth 0 \ -borderwidth 2 \ - -labelpady {3 3} \ + -labelpady {2 2} \ ] } @@ -279,7 +340,7 @@ proc mentry::srivTheme {} { variable themeDefaults array set themeDefaults [list \ -background #e6f3ff \ - -disabledbackground #e6f3ff \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #666666 \ @@ -298,7 +359,7 @@ proc mentry::srivlgTheme {} { variable themeDefaults array set themeDefaults [list \ -background #e6f3ff \ - -disabledbackground #e6f3ff \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #666666 \ @@ -317,7 +378,7 @@ proc mentry::stepTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #808080 \ @@ -400,7 +461,7 @@ proc mentry::winxpblueTheme {} { variable themeDefaults array set themeDefaults [list \ -background white \ - -disabledbackground white \ + -disabledbackground "" \ -foreground black \ -foreground,background black \ -disabledforeground #565248 \ diff --git a/modules/mentry/scripts/mentryWidget.tcl b/modules/mentry/scripts/mentryWidget.tcl index 261f9849..ab786cde 100644 --- a/modules/mentry/scripts/mentryWidget.tcl +++ b/modules/mentry/scripts/mentryWidget.tcl @@ -11,7 +11,7 @@ # - Private procedures used in bindings # - Private utility procedures # -# Copyright (c) 1999-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 1999-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -23,14 +23,7 @@ namespace eval mentry { # # Get the current windowing system ("x11", "win32", "classic", or "aqua") # - variable winSys - if {[catch {tk windowingsystem} winSys] != 0} { - switch $::tcl_platform(platform) { - unix { set winSys x11 } - windows { set winSys win32 } - macintosh { set winSys classic } - } - } + variable winSys [mwutil::windowingSystem] # # Create aliases for a few tile commands if not yet present @@ -157,7 +150,7 @@ namespace eval mentry { # Append theme-specific values to some # elements of the array configSpecs # - if {[string compare [getCurrentTheme] "tileqt"] == 0} { + if {[string compare [mwutil::currentTheme] "tileqt"] == 0} { tileqt_kdeStyleChangeNotification } setThemeDefaults @@ -168,19 +161,6 @@ namespace eval mentry { # lappend configSpecs(-takefocus) {} - # - # Define a special tile entry layout - # - style theme settings "default" { - style layout MentryHull.TEntry { - Entry.highlight -children { - Entry.field -border 1 -children { - Entry.padding - } - } - } - } - catch {lappend configSpecs(-cursor) [ttk::cursor text]} ttk::entry $helpEntry -takefocus 0 @@ -238,7 +218,7 @@ namespace eval mentry { # MentryEntry, and MentryLabel. #------------------------------------------------------------------------------ proc mentry::createBindings {} { - + # # Define some Mentry class bindings # bind Mentry continue @@ -248,16 +228,16 @@ proc mentry::createBindings {} { } } bind Mentry { - namespace delete mentry::ns%W + namespace delete ::mentry::ns%W catch {rename ::%W ""} } + bind Mentry <> { + after idle [list mentry::updateConfigSpecs %W] + } variable usingTile if {$usingTile} { bind Mentry { mentry::updateAppearance %W } bind Mentry { mentry::updateAppearance %W } - bind Mentry <> { - after idle [list mentry::updateConfigSpecs %W] - } } # @@ -366,12 +346,12 @@ proc mentry::mentry args { } # - # Create a hull (a frame or special tile entry widget) of the class Mentry + # Create a hull (a frame or tile entry) of the class Mentry # set win [lindex $args 0] if {[catch { if {$usingTile} { - ttk::entry $win -style MentryHull.TEntry -class Mentry + ttk::entry $win -style Hull$win.TEntry -class Mentry } else { tk::frame $win -class Mentry -container 0 -height 0 -width 0 catch {$win configure -padx 0 -pady 0} @@ -410,27 +390,25 @@ proc mentry::mentry args { foreach opt $configOpts { set data($opt) [lindex $configSpecs($opt) 3] } + set data(currentTheme) [mwutil::currentTheme] + if {[string compare $data(currentTheme) "tileqt"] == 0} { + set data(widgetStyle) [tileqt_currentThemeName] + if {[info exists ::env(KDE_SESSION_VERSION)] && + [string length $::env(KDE_SESSION_VERSION)] != 0} { + set data(colorScheme) [getKdeConfigVal "General" "ColorScheme"] + } else { + set data(colorScheme) [getKdeConfigVal "KDE" "colorScheme"] + } + } else { + set data(widgetStyle) "" + set data(colorScheme) "" + } if {$usingTile} { setThemeDefaults variable themeDefaults - foreach opt {-disabledbackground -disabledforeground \ - -readonlybackground} { - set data($opt) $themeDefaults($opt) - } - - set data(currentTheme) [getCurrentTheme] set data(themeDefaults) [array get themeDefaults] - if {[string compare $data(currentTheme) "tileqt"] == 0} { - set data(widgetStyle) [tileqt_currentThemeName] - if {[info exists ::env(KDE_SESSION_VERSION)] && - [string length $::env(KDE_SESSION_VERSION)] != 0} { - set data(colorScheme) [getKdeConfigVal "General" "ColorScheme"] - } else { - set data(colorScheme) [getKdeConfigVal "KDE" "colorScheme"] - } - } else { - set data(widgetStyle) "" - set data(colorScheme) "" + foreach opt {-disabledbackground -readonlybackground} { + set data($opt) $themeDefaults($opt) } } @@ -509,10 +487,12 @@ proc mentry::doConfig {win opt val} { # Some options need special handling # if {[string compare $opt "-font"] == 0 && $usingTile} { - mentry::adjustChildren $win + adjustChildren $win } elseif {[string compare $opt "-foreground"] == 0 && $usingTile && !$data(inActiveWin)} { - updateAppearance $win + foreach w [labels $win] { + $w configure $opt $themeDefaults(-foreground,background) + } } } @@ -551,10 +531,11 @@ proc mentry::doConfig {win opt val} { set data($opt) $val if {[string compare $opt "-background"] == 0 && $usingTile} { # - # Most themes support the -fieldbackground option for the - # style element Entry.field. The aqua theme supports the - # -background option instead. Some themes (like plastik, - # tileqt, vista, and xpnative) don't support either of them. + # Most themes support the -fieldbackground option + # for the style element Entry.field. The aqua + # theme supports the -background option instead. + # Some themes (like Arc, plastik, tileqt, vista, + # and xpnative) don't support either of them. # styleConfig $win.TEntry -fieldbackground $val \ -background $val @@ -594,7 +575,12 @@ proc mentry::doConfig {win opt val} { # Set also the hull's background, because # of the shadow colors of its 3-D border # - $win configure $opt $labelBg + if {$usingTile} { + styleConfig Hull$win.TEntry -fieldbackground $labelBg \ + -background $labelBg + } else { + $win configure $opt $labelBg + } } elseif {[regexp \ {^-(disabledbackground|readonlybackground|state)$} \ $opt] && $::tk_version >= 8.4} { @@ -829,6 +815,9 @@ proc mentry::createChildren {win body} { } $w configure -background $labelBg -state $labelState } + if {$usingTile} { + $w configure -disabledforeground $themeDefaults(-disabledforeground) + } # # Replace the binding tag Label with MentryLabel @@ -868,14 +857,14 @@ proc mentry::createChildren {win body} { # multi-entry widget. #------------------------------------------------------------------------------ proc mentry::mentryWidgetCmd {win args} { - variable cmdOpts - upvar ::mentry::ns${win}::data data - set argCount [llength $args] if {$argCount == 0} { mwutil::wrongNumArgs "$win option ?arg arg ...?" } + upvar ::mentry::ns${win}::data data + + variable cmdOpts set cmd [mwutil::fullOpt "option" [lindex $args 0] $cmdOpts] switch $cmd { adjustentry { @@ -1017,7 +1006,7 @@ proc mentry::mentryWidgetCmd {win args} { mwutil::wrongNumArgs "$win $cmd name" } - return [mwutil::hasattribSubCmd $win "widget" [lindex $argList 1]] + return [mwutil::hasattribSubCmd $win "widget" [lindex $args 1]] } isempty { @@ -1132,7 +1121,7 @@ proc mentry::mentryWidgetCmd {win args} { mwutil::wrongNumArgs "$win $cmd name" } - return [mwutil::unsetattribSubCmd $win "widget" [lindex $argList 1]] + return [mwutil::unsetattribSubCmd $win "widget" [lindex $args 1]] } } } @@ -1425,28 +1414,18 @@ proc mentry::updateAppearance {win event} { switch $event { { set data(inActiveWin) 1 - if {[string compare $data(-state) "disabled"] == 0} { - set labelFg $themeDefaults(-disabledforeground) - } else { - set labelFg $data(-foreground) - } - foreach w [labels $win] { - $w configure -foreground $labelFg - } + set labelFg $data(-foreground) } { set data(inActiveWin) 0 - if {[string compare $data(-state) "disabled"] == 0} { - set labelFg $themeDefaults(-disabledforeground) - } else { - set labelFg $themeDefaults(-foreground,background) - } - foreach w [labels $win] { - $w configure -foreground $labelFg - } + set labelFg $themeDefaults(-foreground,background) } } + + foreach w [labels $win] { + $w configure -foreground $labelFg + } } #------------------------------------------------------------------------------ @@ -1463,9 +1442,8 @@ proc mentry::updateConfigSpecs win { return "" } + set currentTheme [mwutil::currentTheme] upvar ::mentry::ns${win}::data data - - set currentTheme [getCurrentTheme] if {[string compare $currentTheme $data(currentTheme)] == 0} { if {[string compare $currentTheme "tileqt"] == 0} { set widgetStyle [tileqt_currentThemeName] @@ -1484,53 +1462,56 @@ proc mentry::updateConfigSpecs win { } } - # - # Populate the array tmp with values corresponding to the old theme - # and the array themeDefaults with values corresponding to the new one - # - array set tmp $data(themeDefaults) - setThemeDefaults + variable usingTile + if {$usingTile} { + # + # Populate the array tmp with values corresponding to the old theme + # and the array themeDefaults with values corresponding to the new one + # + array set tmp $data(themeDefaults) + setThemeDefaults - # - # Set those configuration options whose values equal the old - # theme-specific defaults to the new theme-specific ones - # - variable themeDefaults - foreach opt {-disabledbackground -disabledforeground -readonlybackground} { - set data($opt) $themeDefaults($opt) - } - foreach opt {-background -foreground -font} { - if {[string compare $data($opt) $tmp($opt)] == 0} { - doConfig $win $opt $themeDefaults($opt) + # + # Set those configuration options whose values equal the old + # theme-specific defaults to the new theme-specific ones + # + variable themeDefaults + foreach opt {-disabledbackground -readonlybackground} { + set data($opt) $themeDefaults($opt) } - } - mentry::adjustChildren $win + foreach opt {-background -foreground -font} { + if {[string compare $data($opt) $tmp($opt)] == 0} { + doConfig $win $opt $themeDefaults($opt) + } + } + adjustChildren $win - # - # Most themes support the -fieldbackground option for the - # style element Entry.field. The aqua theme supports the - # -background option instead. Some themes (like plastik, - # tileqt, vista, and xpnative) don't support either of them. - # - styleConfig $win.TEntry -fieldbackground $data(-background) \ - -background $data(-background) + # + # Most themes support the -fieldbackground option for the + # style element Entry.field. The aqua theme supports the + # -background option instead. Some themes (like Arc, plastik, + # tileqt, vista, and xpnative) don't support either of them. + # + foreach style [list $win.TEntry Hull$win.TEntry] { + styleConfig $style -fieldbackground $data(-background) \ + -background $data(-background) + } - # - # Set the foreground color of the label children - # - if {[string compare $data(-state) "disabled"] == 0} { - set labelFg $themeDefaults(-disabledforeground) - } elseif {$data(inActiveWin)} { - set labelFg $data(-foreground) - } else { - set labelFg $themeDefaults(-foreground,background) - } - foreach w [labels $win] { - $w configure -foreground $labelFg + # + # Set the foreground color of the label children + # + if {$data(inActiveWin)} { + set labelFg $data(-foreground) + } else { + set labelFg $themeDefaults(-foreground,background) + } + foreach w [labels $win] { + $w configure -foreground $labelFg \ + -disabledforeground $themeDefaults(-disabledforeground) + } } set data(currentTheme) $currentTheme - set data(themeDefaults) [array get themeDefaults] if {[string compare $currentTheme "tileqt"] == 0} { set data(widgetStyle) [tileqt_currentThemeName] if {[info exists ::env(KDE_SESSION_VERSION)] && @@ -1543,6 +1524,9 @@ proc mentry::updateConfigSpecs win { set data(widgetStyle) "" set data(colorScheme) "" } + if {$usingTile} { + set data(themeDefaults) [array get themeDefaults] + } } #------------------------------------------------------------------------------ @@ -2073,7 +2057,7 @@ proc mentry::configEntry {w args} { # Returns the requested width in pixels of the tile entry widget w. #------------------------------------------------------------------------------ proc mentry::reqEntryWidth w { - if {[string compare [getCurrentTheme] "vista"] == 0} { + if {[string compare [mwutil::currentTheme] "vista"] == 0} { # # If the tile entry was created with -width 1 or -width 2 then # in the "vista" theme its width will silently be changed to 3. diff --git a/modules/mentry/scripts/mwutil.tcl b/modules/mentry/scripts/mwutil.tcl index 3d461fb3..166e3ed6 100644 --- a/modules/mentry/scripts/mwutil.tcl +++ b/modules/mentry/scripts/mwutil.tcl @@ -5,11 +5,10 @@ # - Namespace initialization # - Public utility procedures # -# Copyright (c) 2000-2014 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require Tcl 8 -package require Tk 8 +package require Tk 8 # # Namespace initialization @@ -20,8 +19,13 @@ namespace eval mwutil { # # Public variables: # - variable version 2.8 - variable library [file dirname [info script]] + variable version 2.12 + variable library + if {$::tcl_version >= 8.4} { + set library [file dirname [file normalize [info script]]] + } else { + set library [file dirname [info script]] ;# no "file normalize" yet + } # # Public procedures: @@ -30,7 +34,8 @@ namespace eval mwutil { defineKeyNav processTraversal focusNext focusPrev \ configureWidget fullConfigOpt fullOpt enumOpts \ configureSubCmd attribSubCmd hasattribSubCmd \ - unsetattribSubCmd getScrollInfo + unsetattribSubCmd getScrollInfo hasFocus \ + genMouseWheelEvent windowingSystem currentTheme # # Make modified versions of the procedures tk_focusNext and @@ -45,10 +50,10 @@ namespace eval mwutil { # # Build the procedures focusNext and focusPrev # - foreach direction {Next Prev} { - set procBody [info body tk_focus$direction] + foreach dir {Next Prev} { + set procBody [info body tk_focus$dir] regsub -all {winfo children} $procBody {getChildren $class} procBody - proc focus$direction {w class} $procBody + proc focus$dir {w class} $procBody } } makeFocusProcs @@ -141,7 +146,7 @@ proc mwutil::defineKeyNav class { # # Processes the given traversal event for the mega-widget of the specified # class containing the widget w if that mega-widget is not the only widget -# receiving the focus during keyboard traversal within its top-level widget. +# receiving the focus during keyboard traversal within its toplevel widget. #------------------------------------------------------------------------------ proc mwutil::processTraversal {w class event} { set win [getAncestorByClass $w $class] @@ -153,9 +158,9 @@ proc mwutil::processTraversal {w class event} { } if {[string compare $target $win] != 0} { - set focus [focus] - if {[string length $focus] != 0} { - event generate $focus <> + set focusWin [focus -displayof $win] + if {[string length $focusWin] != 0} { + event generate $focusWin <> } focus $target @@ -491,7 +496,8 @@ proc mwutil::getScrollInfo argList { wrongNumArgs "moveto fraction" } - set fraction [format "%f" [lindex $argList 1]] + set fraction [lindex $argList 1] + format "%f" $fraction ;# floating-point number check with error message return [list moveto $fraction] } elseif {[string first $opt "scroll"] == 0} { if {$argCount != 3} { @@ -511,3 +517,67 @@ proc mwutil::getScrollInfo argList { return -code error "unknown option \"$opt\": must be moveto or scroll" } } + +#------------------------------------------------------------------------------ +# mwutil::hasFocus +# +# Returns a boolean value indicating whether the focus window is (a descendant +# of) the widget w. +#------------------------------------------------------------------------------ +proc mwutil::hasFocus w { + return [expr {[string first $w. [focus -displayof $w].] == 0}] +} + +#------------------------------------------------------------------------------ +# mwutil::genMouseWheelEvent +# +# Generates a mouse wheel event with the given root coordinates and delta on +# the widget w. +#------------------------------------------------------------------------------ +proc mwutil::genMouseWheelEvent {w event rootX rootY delta} { + set needsFocus [expr {[package vcompare $::tk_patchLevel "8.6b2"] < 0 && + [string compare $::tcl_platform(platform) "windows"] == 0}] + + if {$needsFocus} { + set focusWin [focus -displayof $w] + focus $w + } + + event generate $w $event -rootx $rootX -rooty $rootY -delta $delta + + if {$needsFocus} { + focus $focusWin + } +} + +#------------------------------------------------------------------------------ +# mwutil::windowingSystem +# +# Returns the current windowing system ("x11", "win32", "classic", or "aqua"). +#------------------------------------------------------------------------------ +proc mwutil::windowingSystem {} { + if {[catch {tk windowingsystem} winSys] != 0} { + switch $::tcl_platform(platform) { + unix { set winSys x11 } + windows { set winSys win32 } + macintosh { set winSys classic } + } + } + + return $winSys +} + +#------------------------------------------------------------------------------ +# mwutil::currentTheme +# +# Returns the current tile theme. +#------------------------------------------------------------------------------ +proc mwutil::currentTheme {} { + if {[info exists ::ttk::currentTheme]} { + return $::ttk::currentTheme + } elseif {[info exists ::tile::currentTheme]} { + return $::tile::currentTheme + } else { + return "" + } +} diff --git a/modules/mentry/scripts/tclIndex b/modules/mentry/scripts/tclIndex index c8571a6c..2051624d 100644 --- a/modules/mentry/scripts/tclIndex +++ b/modules/mentry/scripts/tclIndex @@ -6,6 +6,17 @@ # element name is the name of a command and the value is # a script that loads the command. +set auto_index(::mentry::dateMentry) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::timeMentry) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::dateTimeMentry) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::putClockVal) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::getClockVal) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::checkIfDateOrTimeMentry) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::getClockValFromDateMentry) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::getClockValFromTimeMentry) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::getClockValFromDateTimeMentry) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::incrDateTimeComp) [list source [file join $dir mentryDateTime.tcl]] +set auto_index(::mentry::setMeridian) [list source [file join $dir mentryDateTime.tcl]] set auto_index(::mentry::fixedPointMentry) [list source [file join $dir mentryFixedPoint.tcl]] set auto_index(::mentry::putReal) [list source [file join $dir mentryFixedPoint.tcl]] set auto_index(::mentry::getReal) [list source [file join $dir mentryFixedPoint.tcl]] @@ -15,14 +26,22 @@ set auto_index(::mentry::putIPAddr) [list source [file join $dir mentryIPAddr.tc set auto_index(::mentry::getIPAddr) [list source [file join $dir mentryIPAddr.tcl]] set auto_index(::mentry::checkIfIPAddrMentry) [list source [file join $dir mentryIPAddr.tcl]] set auto_index(::mentry::incrIPAddrComp) [list source [file join $dir mentryIPAddr.tcl]] +set auto_index(::mentry::ipv6AddrMentry) [list source [file join $dir mentryIPv6Addr.tcl]] +set auto_index(::mentry::putIPv6Addr) [list source [file join $dir mentryIPv6Addr.tcl]] +set auto_index(::mentry::getIPv6Addr) [list source [file join $dir mentryIPv6Addr.tcl]] +set auto_index(::mentry::checkIfIPv6AddrMentry) [list source [file join $dir mentryIPv6Addr.tcl]] +set auto_index(::mentry::incrIPv6AddrComp) [list source [file join $dir mentryIPv6Addr.tcl]] set auto_index(::mentry::getCurrentTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::setThemeDefaults) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::altTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::aquaTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::AquativoTheme) [list source [file join $dir mentryThemes.tcl]] +set auto_index(::mentry::aquativoTheme) [list source [file join $dir mentryThemes.tcl]] +set auto_index(::mentry::ArcTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::blueTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::clamTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::classicTheme) [list source [file join $dir mentryThemes.tcl]] +set auto_index(::mentry::clearlooksTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::defaultTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::keramikTheme) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::keramik_altTheme) [list source [file join $dir mentryThemes.tcl]] @@ -39,38 +58,6 @@ set auto_index(::mentry::xpnativeTheme) [list source [file join $dir mentryTheme set auto_index(::mentry::getKdeConfigVal) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::makeKdeDirList) [list source [file join $dir mentryThemes.tcl]] set auto_index(::mentry::readKdeConfigVal) [list source [file join $dir mentryThemes.tcl]] -set auto_index(::mwutil::makeFocusProcs) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::getChildren) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::wrongNumArgs) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::getAncestorByClass) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::convEventFields) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::defineKeyNav) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::processTraversal) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::configureWidget) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::fullConfigOpt) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::fullOpt) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::enumOpts) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::configureSubCmd) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::attribSubCmd) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::hasattribSubCmd) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::unsetattribSubCmd) [list source [file join $dir mwutil.tcl]] -set auto_index(::mwutil::getScrollInfo) [list source [file join $dir mwutil.tcl]] -set auto_index(::mentry::ipv6AddrMentry) [list source [file join $dir mentryIPv6Addr.tcl]] -set auto_index(::mentry::putIPv6Addr) [list source [file join $dir mentryIPv6Addr.tcl]] -set auto_index(::mentry::getIPv6Addr) [list source [file join $dir mentryIPv6Addr.tcl]] -set auto_index(::mentry::checkIfIPv6AddrMentry) [list source [file join $dir mentryIPv6Addr.tcl]] -set auto_index(::mentry::incrIPv6AddrComp) [list source [file join $dir mentryIPv6Addr.tcl]] -set auto_index(::mentry::dateMentry) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::timeMentry) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::dateTimeMentry) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::putClockVal) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::getClockVal) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::checkIfDateOrTimeMentry) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::getClockValFromDateMentry) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::getClockValFromTimeMentry) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::getClockValFromDateTimeMentry) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::incrDateTimeComp) [list source [file join $dir mentryDateTime.tcl]] -set auto_index(::mentry::setMeridian) [list source [file join $dir mentryDateTime.tcl]] set auto_index(::mentry::createTileAliases) [list source [file join $dir mentryWidget.tcl]] set auto_index(::mentry::extendConfigSpecs) [list source [file join $dir mentryWidget.tcl]] set auto_index(::mentry::createBindings) [list source [file join $dir mentryWidget.tcl]] @@ -115,3 +102,23 @@ set auto_index(::mentry::entrySetCursor) [list source [file join $dir mentryWidg set auto_index(::mentry::entryViewCursor) [list source [file join $dir mentryWidget.tcl]] set auto_index(::mentry::configEntry) [list source [file join $dir mentryWidget.tcl]] set auto_index(::mentry::reqEntryWidth) [list source [file join $dir mentryWidget.tcl]] +set auto_index(::mwutil::makeFocusProcs) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::getChildren) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::wrongNumArgs) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::getAncestorByClass) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::convEventFields) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::defineKeyNav) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::processTraversal) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::configureWidget) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::fullConfigOpt) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::fullOpt) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::enumOpts) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::configureSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::attribSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::hasattribSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::unsetattribSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::getScrollInfo) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::hasFocus) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::genMouseWheelEvent) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::windowingSystem) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::currentTheme) [list source [file join $dir mwutil.tcl]] diff --git a/modules/ntext/ChangeLog b/modules/ntext/ChangeLog index 5b8f2aff..6eaf0f58 100644 --- a/modules/ntext/ChangeLog +++ b/modules/ntext/ChangeLog @@ -1,3 +1,35 @@ +2018-02-17 Keith Nash + + * Bugfix - generate <> for Tk < 8.6.9 in the corner case in + which the CLIPBOARD is <>d into the PRIMARY selection. + * Increase version to 1.0b3 + +2018-01-26 Keith Nash + + * Update to correspond to current tk8.x/text.tcl -- + core-8-5-branch 2015-10-04 artifact [6af61544] check-in [55133bde] + core-8-6-branch 2017-09-22 artifact [24e611b8] check-in [ba5ef805] + trunk 2017-10-07 artifact [642cbaf3] check-in [429e2357] + revised_text 2018-01-15 artifact [a76837e9] check-in [74f86687] + * Adapt to work with revised_text. + * Add revisions made to Tk library/text.tcl since the last release + of ntext. + * When indenting word-wrapped lines, use the text widget tag option + -lmargincolor if available (i.e. for Tk 8.6.6 and above). Add command + ::ntext::syncIndentColor and variable ::ntext::indentColor for this + purpose. + * Add the option to use the block cursor when in "overwrite" mode. Make + this the default for Tk 8.5.12 or newer (earlier versions have a bug + in their block cursor). + * Generate a <> event when the PRIMARY selection changes + as a result of an "insert" or "delete" operation, in older versions of + Tk. (This missing feature is added to the text widget itself in + Tk 8.6.9.) + * Add a new example for unusual scrolling cases identified in + revised_text. + * Update docs and examples. + * Increase version to 1.0b2 + 2017-03-31 Keith Nash * Update to correspond to current tk8.x/text.tcl -- diff --git a/modules/ntext/ntext.man b/modules/ntext/ntext.man index 850ca5fd..82277d5a 100644 --- a/modules/ntext/ntext.man +++ b/modules/ntext/ntext.man @@ -13,7 +13,7 @@ The purpose of the [package ntext] package is to make the text widget behave mor The package provides a binding tag named [emph Ntext] for use by text widgets in place of the default [emph Text] binding tag. [para] -Package [package ntext] 's functions and variables are contained entirely in the [var ::ntext] namespace; its other code is contained in the binding tag [emph Ntext]. [package ntext] has no exports to the global or other namespaces, and no new widget commands. It uses modified copies of the Tk code, leaving the original code, and the [emph Text] binding tag, unchanged. +Package [package ntext] 's functions and variables are contained entirely in the [var ::ntext] namespace; its other code is contained in the binding tag [emph Ntext]. [package ntext] has no exports to the global or other namespaces, and no new widget commands. It uses modified copies of the [package Tk] code, leaving the original code, and the [emph Text] binding tag, unchanged. [comment {use emph instead of term, because term creates a hyperlink, and ntext, Ntext and Text occur in almost every sentence: the page would be covered with the same hyperlinks many times}] [para] @@ -26,7 +26,7 @@ The differences between the [emph Ntext] binding tag and the default [emph Text] [item] When a logical line with leading whitespace is word-wrapped onto more than one display line, the wrapped display lines begin further to the left than the first display line, which can make the text layout untidy and difficult to read. [emph Ntext] can indent the wrapped lines to match the leading whitespace of the first display line (this facility is switched off by default). For details see [term ntextIndent]. -[item] When the user navigates or selects text, Tcl/Tk sometimes needs to detect word boundaries. [emph Ntext] provides improved rules for word boundary detection. For details see [term ntextWordBreak]. +[item] When the user navigates or selects text, [const Tcl/Tk] sometimes needs to detect word boundaries. [emph Ntext] provides improved rules for word boundary detection. For details see [term ntextWordBreak]. [list_end] @@ -52,6 +52,10 @@ Replacement for ::tk_textCut that also maintains [emph Ntext] indentation (see [ Replacement for ::tk_textPaste that also maintains [emph Ntext] indentation (see [term ntextIndent]). +[call [cmd ::ntext::syncIndentColor] [arg pathName]] + +Command to apply the current value of the variable [var ::ntext::indentColor] to existing lines in a text widget. This command is useful if a text widget has been created, text has been inserted in the widget, [emph {and then}] the value of [var ::ntext::indentColor] is changed (see [term ntextIndent]). + [list_end] [section {CONFIGURATION OPTIONS}] @@ -92,6 +96,18 @@ The behaviour of [emph Ntext] may be configured application-wide by setting the [item] For more information see [term ntextBindings] [list_end] + +[para] +[var ::ntext::classicParagraphs] +[list_begin itemized] +[item] + [const 0] - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit. The bindings involve vertical scrolling of the screen and are . +[item] + [const 1] - on macOS Aqua, certain keyboard bindings are made to behave in the same way as classic [emph Text], ignoring the conventions of Aqua. The bindings involve vertical scrolling of the screen and are . +[item] + For more information see [term ntextBindings] +[list_end] + [para] [var ::ntext::classicSelection] [list_begin itemized] @@ -123,6 +139,20 @@ The behaviour of [emph Ntext] may be configured application-wide by setting the For more information see [term ntextIndent] [list_end] [para] +[var ::ntext::indentColor] +[list_begin itemized] +[item] + [const {{}}] - if the value is the empty string, then the indent of wrapped display lines has the same color as the widget background. +[item] + [emph color] - a valid [package Tk] color to use for the indent of wrapped display lines (default value [emph #d9d9d9]). +[para] + Coloring is implemented with the text widget tag option [arg -lmargincolor], which is available from [package Tk] 8.6.6 onwards. [emph Ntext] indent coloring has no effect in earlier versions of [package Tk]. +[para] + The value of [var ::ntext::indentColor] will often be set at startup. If the value is changed when text widgets already exist and contain text, those widgets can be updated by calling command [cmd ::ntext::syncIndentColor]. +[item] + For more information see [term ntextIndent] +[list_end] +[para] [var ::ntext::overwrite] [list_begin itemized] [item] @@ -134,13 +164,16 @@ The behaviour of [emph Ntext] may be configured application-wide by setting the [item] For more information see [term ntextBindings] [list_end] + [para] -[var ::ntext::classicParagraphs] +[var ::ntext::useBlockCursor] [list_begin itemized] [item] - [const 0] - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit. The bindings involve vertical scrolling of the screen and are . + [const 0] - the block cursor will not be used. When the widget is in [emph overwrite] mode (see [const ::ntext::overwrite]), the ordinary cursor will change color instead. [item] - [const 1] - on macOS Aqua, certain keyboard bindings are made to behave in the same way as classic [emph Text], ignoring the conventions of Aqua. The bindings involve vertical scrolling of the screen and are . + [const 1] - the block cursor will be used when the widget is in [emph overwrite] mode (see [const ::ntext::overwrite]). +[item] + The default value depends on the version of [const Tk]. In versions of [const Tk] earlier than [const 8.5.12], the sizing of the block cursor had a bug, and [var ::ntext::useBlockCursor] defaults to [const 0]. From [const 8.5.12] onwards the bug is fixed, and [var ::ntext::useBlockCursor] defaults to [const 1]. [item] For more information see [term ntextBindings] [list_end] diff --git a/modules/ntext/ntext.tcl b/modules/ntext/ntext.tcl index bd20c724..f344ff21 100644 --- a/modules/ntext/ntext.tcl +++ b/modules/ntext/ntext.tcl @@ -7,7 +7,8 @@ # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998 by Scriptics Corporation. -# Copyright (c) 2005-2017 additions by Keith Nash. +# Copyright (c) 2015-2017 Gregor Cramer +# Copyright (c) 2005-2018 additions by Keith Nash. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. @@ -15,14 +16,39 @@ ##### START OF CODE THAT IS MODIFIED from the following versions of text.tcl: # +# tag 8-6-8 +# 2017-09-22 artifact [24e611b8] part of check-in [16815561] & [ba5ef805] # branch core-8-6-branch -# 2015-10-09 artifact [e9c33ef1] part of check-in [553899e9] +# 2017-09-22 artifact [24e611b8] part of check-in [8cc5e98d] & [ba5ef805] # branch core-8-5-branch -# 2015-10-04 artifact [6af61544] part of check-in [55133bde] +# 2015-10-04 artifact [6af61544] part of check-in [ffd695c5] & [55133bde] # trunk -# 2016-09-27 artifact [530d3c1b] part of check-in [6b21cc27] -# -# Not yet adapted to revised text widget by Gregor Cramer, or to Androwish. +# 2017-10-07 artifact [642cbaf3] part of check-in [06baa487] & [429e2357] +# branch revised_text +# 2018-01-15 artifact [a76837e9] part of check-in [74f86687] +# +# Not yet adapted to Androwish. + + +########################################################################## +# TODO: (from revised_text's text.tcl) +# Currently we cannot use identifier "begin" for very first index, because +# it has still lowest precedence, and this may clash if the application is +# using this identifier for marks. In a later version of this file all +# occurences of "1.0" should be replaced with "begin", as soon as "begin" +# has highest precedence. +########################################################################## +# TODO: (revised_text with Ntext) +# - Ntext tries to be compatible with all versions of Tk from 8.5 onwards. +# - Therefore Ntext sometimes keeps "unrevised text" code when this has +# been replaced with a simpler equivalent in revised_text's text.tcl. +# - In other places Ntext uses [catch] to test for revised_text before +# using its facilities. +# - Ntext does not use some revised_text code - these (and some other) +# places can be discovered by searching for "revised_text". +# - Any Ntext code that breaks revised_text facilities (e.g. "watch") is +# considered a bug. Please report such bugs using the tklib tracker. +########################################################################## #------------------------------------------------------------------------- # Elements of ::tk::Priv that are used in this file: @@ -47,7 +73,7 @@ #------------------------------------------------------------------------- -#------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------ # ntext no longer uses private commands ::tk::* from tk8.x/text.tcl. Any # necessary commands are defined below in the ::ntext namespace, even if the # corresponding ::tk::* command from tk8.x/text.tcl is identical. This makes @@ -56,7 +82,28 @@ # ntext still uses the private array ::tk::Priv (shared with text.tcl etc) and # the private command ::tk::GetSelection (from tk.tcl). There is a small risk # of breakage if one of these private items is altered in Tk. -#------------------------------------------------------------------------------- +# ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# <> events +# ------------------------------------------------------------------------------ +# - The text widget generates a <> event when the "selection" method +# changes the selected text. +# - For Tk earlier than 8.6.9, the text widget does not generate this event when +# the selection range is changed by an "insert" or "delete" method. +# - When using "insert" or "delete" methods with these earlier versions of Tk, +# it is the responsibility of the programmer to generate <> events +# if they are needed. This bug was fixed in Tk 8.6.9. +# - The Ntext bindings mostly handle these cases appropriately (usually by using +# the "tag" method to remove the selection, thereby generating a <> +# event). +# - In a few cases, a binding that calls an "insert" or "delete" method changes +# the selection without causing the widget to generate a <> event. +# In these cases an "event generate" command has been added to the script. +# - The bindings affected are: , <>, <>. +# - The variable $::ntext::GenerateSelect records whether the version of Tk +# requires these bindings to generate <> events. +# ------------------------------------------------------------------------------ package require Tcl 8.5 package require Tk 8.5 @@ -325,7 +372,7 @@ switch -exact -- [tk windowingsystem] { bind Ntext <1> { set ::ntext::Bcount 1 ntext::TextButton1 %W %x %y - %W tag remove sel 0.0 end + %W tag remove sel 1.0 end } bind Ntext { set tk::Priv(x) %x @@ -342,7 +389,7 @@ bind Ntext { if {$::ntext::Bcount != 1} { set ::ntext::Bcount 1 ntext::TextButton1 %W %x %y - %W tag remove sel 0.0 end + %W tag remove sel 1.0 end } set ::ntext::Bcount 2 set tk::Priv(selectMode) word @@ -446,7 +493,9 @@ bind Ntext { bind Ntext { # nothing } # stop an accidental movement triggering bind Ntext { # nothing } - +# revised_text uses displaychars not displayindices in <>, +# <> <> <>. Ntext keeps +# displayindices so cursor navigation does not ignore embedded windows/images. bind Ntext <> { ntext::AdjustInsert %W left ntext::TextSetCursor %W insert-1displayindices @@ -471,10 +520,10 @@ bind Ntext <> { ntext::TextKeySelect %W [%W index {insert + 1displayindices}] } bind Ntext <> { - ntext::TextKeySelect %W [ntext::TextUpDownLine %W -1] + ntext::TextKeySelect %W [ntext::TextUpDownLine %W -1 yes] } bind Ntext <> { - ntext::TextKeySelect %W [ntext::TextUpDownLine %W 1] + ntext::TextKeySelect %W [ntext::TextUpDownLine %W 1 yes] } bind Ntext <> { ntext::AdjustInsert %W left @@ -564,7 +613,7 @@ bind Ntext { } } bind Ntext { - # Needed only to keep binding from triggering; doesn't + # Needed only to keep binding from triggering; doesn't # have to actually do anything. break } @@ -580,46 +629,60 @@ bind Ntext { } } bind Ntext { - ntext::TextInsert %W \n - if {[%W cget -autoseparators]} { - %W edit separator - } -} -bind Ntext { - if {[ntext::TextCursorInSelection %W]} { - # When deleting the selection, make this an atomic operation on the Undo - # stack, i.e. separate it from other delete operations on either side. + if {[%W cget -state] eq "normal"} { + ntext::TextInsert %W \n if {[%W cget -autoseparators]} { %W edit separator - } else { } - set ::ntext::OldFirst [%W index sel.first] - %W delete sel.first sel.last - ntext::AdjustIndentOneLine %W $::ntext::OldFirst - if {[%W cget -autoseparators]} { - %W edit separator - } else { + } +} +bind Ntext { + if {[%W cget -state] eq "normal"} { + if {[ntext::TextCursorInSelection %W]} { + # When deleting the selection, make this an atomic operation on the Undo + # stack, i.e. separate it from other delete operations on either side. + if {[%W cget -autoseparators]} { + %W edit separator + } else { + } + set ::ntext::OldFirst [%W index sel.first] + ntext::TextDelete %W sel.first sel.last + ntext::AdjustIndentOneLine %W $::ntext::OldFirst + if {[%W cget -autoseparators]} { + %W edit separator + } else { + } + if {$::ntext::GenerateSelect} { + # The PRIMARY selection has changed but the widget does + # not generate this event. + event generate %W <> + } else { + } + } elseif {[%W compare end != insert+1i]} { + %W delete insert + ntext::AdjustIndentOneLine %W insert } - } elseif {[%W compare end != insert+1c]} { - %W delete insert - ntext::AdjustIndentOneLine %W insert + %W see insert } - %W see insert } bind Ntext { - if {[ntext::TextCursorInSelection %W]} { - set ::ntext::OldFirst [%W index sel.first] - %W delete sel.first sel.last - ntext::AdjustIndentOneLine %W $::ntext::OldFirst - } elseif {[%W compare insert != 1.0]} { - %W delete insert-1c - ntext::AdjustIndentOneLine %W insert + if {[%W cget -state] eq "normal"} { + if {[ntext::TextCursorInSelection %W]} { + set ::ntext::OldFirst [%W index sel.first] + ntext::TextDelete %W sel.first sel.last + ntext::AdjustIndentOneLine %W $::ntext::OldFirst + } elseif {[%W compare insert != 1.0]} { + # ensure that this operation is triggering "watch" + %W mark set insert insert-1i + %W delete insert + ntext::AdjustIndentOneLine %W insert + } + %W see insert } - %W see insert } # This is present in early versions of -# 8.5 and intercepts the Shift-Backspace event. +# 8.5 and intercepts the event. catch {bind Ntext { if {[ntext::TextCursorInSelection %W]} { set ::ntext::OldFirst [%W index sel.first] @@ -673,36 +736,31 @@ bind Ntext <> { ntext::new_textPaste %W } bind Ntext <> { - # Make <> an atomic operation on the Undo stack, - # i.e. separate it from other delete operations on either side - if {[%W tag nextrange sel 1.0 end] ne ""} { - if {[%W cget -autoseparators]} { - %W edit separator - } - set ::ntext::OldFirst [%W index sel.first] - %W delete sel.first sel.last - ntext::AdjustIndentOneLine %W $::ntext::OldFirst - if {[%W cget -autoseparators]} { - %W edit separator + if {[%W cget -state] eq "normal"} { + # Make <> an atomic operation on the Undo stack, + # i.e. separate it from other delete operations on either side + if {[%W tag nextrange sel 1.0 end] ne ""} { + if {[%W cget -autoseparators]} { + %W edit separator + } + set ::ntext::OldFirst [%W index sel.first] + ntext::TextDelete %W sel.first sel.last + ntext::AdjustIndentOneLine %W $::ntext::OldFirst + if {[%W cget -autoseparators]} { + %W edit separator + } } } } bind Ntext <> { - if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)] - || !$tk::Priv(mouseMoved)} { + if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)] || !$tk::Priv(mouseMoved)} { ntext::TextPasteSelection %W %x %y } } # Implement Insert/Overwrite modes bind Ntext { set ntext::overwrite [expr !$ntext::overwrite] -# This behaves strangely on a newline or tab: -# %W configure -blockcursor $ntext::overwrite - if {$ntext::overwrite} { - %W configure -insertbackground red - } else { - %W configure -insertbackground black - } + ::ntext::DefineCursor %W } bind Ntext { ntext::TextInsert %W %A @@ -718,7 +776,7 @@ bind Ntext {# nothing} bind Ntext {# nothing} # Make Escape clear the selection bind Ntext { - %W tag remove sel 0.0 end + %W tag remove sel 1.0 end if {[%W cget -autoseparators]} { %W edit separator } @@ -731,15 +789,15 @@ if {[tk windowingsystem] eq "aqua"} { # Additional Emacs-like bindings: # cf. , but not fixed for TextCursorInSelection and no see bind Ntext { - if {$::ntext::classicExtras && !$tk_strictMotif && - [%W compare end != insert+1c]} { + if {[%W cget -state] eq "normal" && $::ntext::classicExtras && !$tk_strictMotif && + [%W compare end != insert+1i]} { %W delete insert ntext::AdjustIndentOneLine %W insert } } bind Ntext { - if {$::ntext::classicExtras && !$tk_strictMotif && - [%W compare end != insert+1c]} { + if {[%W cget -state] eq "normal" && $::ntext::classicExtras && !$tk_strictMotif && + [%W compare end != insert+1i]} { if {[%W compare insert == {insert lineend}]} { %W delete insert } else { @@ -749,9 +807,9 @@ bind Ntext { } } bind Ntext { - if {$::ntext::classicExtras && !$tk_strictMotif} { + if {[%W cget -state] eq "normal" && $::ntext::classicExtras && !$tk_strictMotif} { %W insert insert \n - %W mark set insert insert-1c + %W mark set insert insert-1i ntext::AdjustIndentOneLine %W "insert + 1 line" } } @@ -761,27 +819,29 @@ bind Ntext { } } bind Ntext <> { - # An Undo operation may remove the separator at the top of the Undo stack. - # Then the item at the top of the stack gets merged with the subsequent - # changes. - # Place separators before and after Undo to prevent this. - if {[%W cget -autoseparators]} { - %W edit separator - } - if {![catch { %W edit undo }]} { - # Cancel the selection so that Undo does not mess it up. - %W tag remove sel 0.0 end - # The undo stack does not record tags - so we need to reapply them. - ntext::AdjustIndentMultipleLines %W 1.0 end - } - if {[%W cget -autoseparators]} { - %W edit separator + if {[%W cget -state] eq "normal"} { + # An Undo operation may remove the separator at the top of the Undo stack. + # Then the item at the top of the stack gets merged with the subsequent + # changes. + # Place separators before and after Undo to prevent this. + if {[%W cget -autoseparators]} { + %W edit separator + } + if {![catch { %W edit undo }]} { + # Cancel the selection so that Undo does not mess it up. + %W tag remove sel 1.0 end + # The undo stack does not record tags - so we need to reapply them. + ntext::AdjustIndentMultipleLines %W 1.0 end + } + if {[%W cget -autoseparators]} { + %W edit separator + } } } bind Ntext <> { - if {![catch { %W edit redo }]} { + if {[%W cget -state] eq "normal" && ![catch { %W edit redo }]} { # Cancel the selection so that Redo does not mess it up. - %W tag remove sel 0.0 end + %W tag remove sel 1.0 end # The redo stack does not record tags - so we need to reapply them. ntext::AdjustIndentMultipleLines %W 1.0 end } @@ -798,7 +858,7 @@ bind Ntext { } } bind Ntext { - if {!$tk_strictMotif && [%W compare end != insert+1c]} { + if {!$tk_strictMotif && [%W compare end != insert+1i]} { %W delete insert [ntext::TextNextWord %W insert] ntext::AdjustIndentOneLine %W insert } @@ -818,22 +878,18 @@ bind Ntext { bind Ntext { if {!$tk_strictMotif} { #ntext::AdjustInsert %W right - ntext::TextSetCursor %W end-1c + ntext::TextSetCursor %W end-1i } } bind Ntext { - if {!$tk_strictMotif} { - %W delete \ - [ntext::TextPrevPos %W insert ntext::new_startOfPreviousWord] \ - insert + if {[%W cget -state] eq "normal" && !$tk_strictMotif} { + ntext::TextDelete %W [ntext::TextPrevPos %W insert ntext::new_startOfPreviousWord] insert } ntext::AdjustIndentOneLine %W insert } bind Ntext { - if {!$tk_strictMotif} { - %W delete \ - [ntext::TextPrevPos %W insert ntext::new_startOfPreviousWord] \ - insert + if {[%W cget -state] eq "normal" && !$tk_strictMotif} { + ntext::TextDelete %W [ntext::TextPrevPos %W insert ntext::new_startOfPreviousWord] insert } ntext::AdjustIndentOneLine %W insert } @@ -847,14 +903,11 @@ if {[tk windowingsystem] eq "aqua"} { # The cursor color indicates the insert/overwrite state. # Make sure it is in sync with the all-widgets value of ::ntext::overwrite. bind Ntext { - if {$ntext::overwrite} { - %W configure -insertbackground red - } else { - %W configure -insertbackground black - } + ::ntext::DefineCursor %W } } + # macOS/Aqua only bindings: # # The following virtual events are not defined on the macOS/Aqua platform: @@ -1103,9 +1156,14 @@ bind Ntext { # A few additional bindings of my own. # cf. , but not fixed for TextCursorInSelection bind Ntext { - if {$::ntext::classicExtras && (!$tk_strictMotif) - && [%W compare insert != 1.0]} { - %W delete insert-1c + if { ([%W cget -state] eq "normal") + && $::ntext::classicExtras + && (!$tk_strictMotif) + && [%W compare insert != 1.0] + } { + # ensure that this operation is triggering "watch" + %W mark set insert insert-1i + %W delete insert %W see insert ntext::AdjustIndentOneLine %W insert } @@ -1136,10 +1194,9 @@ if {[tk windowingsystem] eq "aqua"} { } set ::tk::Priv(prevPos) {} -# The MouseWheel will typically only fire on Windows and macOS/Aqua. -# However, someone could use the "event generate" command to produce one -# on other platforms. We must be careful not to round -ve values of %D -# down to zero. +# The MouseWheel events: + +# We must be careful not to round -ve values of %D down to zero. if {[tk windowingsystem] eq "aqua"} { bind Ntext { @@ -1162,18 +1219,10 @@ if {[tk windowingsystem] eq "aqua"} { # (int)-1/3 = -1 # The following code ensure equal +/- behaviour. bind Ntext { - if {%D >= 0} { - %W yview scroll [expr {-%D/3}] pixels - } else { - %W yview scroll [expr {(2-%D)/3}] pixels - } + %W yview scroll [expr {%D >= 0 ? -%D/3 : (2-%D)/3}] pixels } bind Ntext { - if {%D >= 0} { - %W xview scroll [expr {-%D/3}] pixels - } else { - %W xview scroll [expr {(2-%D)/3}] pixels - } + %W xview scroll [expr {%D >= 0 ? -%D/3 : (2-%D)/3}] pixels } } @@ -1181,7 +1230,7 @@ if {"x11" eq [tk windowingsystem]} { # Support for mousewheels on Linux/Unix commonly comes through mapping # the wheel to the extended buttons. If you have a mousewheel, find # Linux configuration info at: - # http://www.inria.fr/koala/colas/mouse-wheel-scroll/ + # http://linuxreviews.org/howtos/xfree/mouse/ bind Ntext <4> { if {!$tk_strictMotif} { %W yview scroll -50 pixels @@ -1189,7 +1238,7 @@ if {"x11" eq [tk windowingsystem]} { } bind Ntext <5> { if {!$tk_strictMotif} { - %W yview scroll 50 pixels + %W yview scroll +50 pixels } } bind Ntext { @@ -1199,7 +1248,7 @@ if {"x11" eq [tk windowingsystem]} { } bind Ntext { if {!$tk_strictMotif} { - %W xview scroll 50 pixels + %W xview scroll +50 pixels } } } @@ -1210,6 +1259,7 @@ bind Ntext { bind Ntext { unset -nocomplain ::ntext::OldSelectMode(%W) + unset -nocomplain ::ntext::OldInsertBackground(%W) } @@ -1255,12 +1305,21 @@ namespace eval ::ntext { # line according to the magnitude of its hanging (-lmargin2) indent. variable lm2IndentDebug 0 + # Color to use for the hanging (-lmargin2) indent itself. + # Set to {} for no color. + variable indentColor #d9d9d9 + + # Whether to use the -blockcursor when in "overwrite" mode (the alternative + # is a change of color). Defaults to YES iff 8.5.12 or over. For earlier + # versions a bug made the -blockcursor fill the whole of a newline. + variable useBlockCursor [expr {[package vsatisfies [package require Tk] 8.5.12-]}] + # When a keystroke cancels a selection, is the position of the insert mark # preserved, or does it jump to the "appropriate" end of the selection? if {[tk windowingsystem] eq "aqua"} { - variable classicSelection 0 + variable classicSelection 0 } else { - variable classicSelection 1 + variable classicSelection 1 } # Whether or not the macOS/Aqua bindings should use @@ -1278,10 +1337,12 @@ namespace eval ::ntext { # These variables are for internal use by ntext only. They should not be # modified by the user's script. - variable Bcount 0 - variable OldFirst {} + variable GenerateSelect [expr {![package vsatisfies [package require Tk] 8.6.9-]}] + variable Bcount 0 + variable OldFirst {} + # arrays: variable OldSelectMode - # array + variable OldInsertBackground if {[tk windowingsystem] eq "aqua"} { variable EmacsEvents { @@ -1332,25 +1393,25 @@ proc ::ntext::EmacsBindings {argVarName var2 action} { variable classicExtras if {$::ntext::classicExtras && !$::tk_strictMotif} { - set op add + set op add } else { - set op delete + set op delete } foreach {virtual real1 real2} $EmacsEvents { - event $op $virtual $real1 $real2 + event $op $virtual $real1 $real2 } if {[tk windowingsystem] eq "x11"} { - if {!$::tk_strictMotif} { - set op2 add - } else { - set op2 delete - } + if {!$::tk_strictMotif} { + set op2 add + } else { + set op2 delete + } - event $op2 <> - event $op2 <> - event $op2 <> + event $op2 <> + event $op2 <> + event $op2 <> } return @@ -1359,6 +1420,26 @@ proc ::ntext::EmacsBindings {argVarName var2 action} { # Trigger the trace, to call ::ntext::EmacsBindings for the first time. set ::tk_strictMotif $::tk_strictMotif + + +# ::tk::TextCursorPos -- +# Given x and y coordinates, this procedure computes the "cursor" +# position, and returns the index of the character at this position. +# +# Arguments: +# w - The text window. +# x - X-coordinate within the window. +# y - Y-coordinate within the window. + +proc ::ntext::TextCursorPos {w x y} { + if {[$w cget -blockcursor]} { + # If we have a block cursor, then use the actual x-position + # for cursor position. + return [$w index @$x,$y] + } + return [TextClosestGap $w $x $y] +} + # ::tk::TextClosestGap -- # Given x and y coordinates, this procedure finds the closest boundary # between characters to the given coordinates and returns the index @@ -1375,12 +1456,13 @@ set ::tk_strictMotif $::tk_strictMotif proc ::ntext::TextClosestGap {w x y} { set pos [$w index @$x,$y] set bbox [$w bbox $pos] - if {$bbox eq ""} { + if {[llength $bbox] == 0} { return $pos } if {($x - [lindex $bbox 0]) < ([lindex $bbox 2]/2)} { return $pos } + # Never return a position that will place the cursor on the next display # line. This used to happen if $x is closer to the end of the display line # than to its last character. @@ -1389,11 +1471,12 @@ proc ::ntext::TextClosestGap {w x y} { } else { set lineType lines } - if {[$w count -$lineType $pos "$pos + 1 char"] != 0} { + if {[$w count -$lineType $pos "$pos + 1i"] != 0} { return $pos } else { } - $w index "$pos + 1 char" + + $w index "$pos + 1i" } # ::tk::TextButton1 -- @@ -1412,33 +1495,51 @@ proc ::ntext::TextClosestGap {w x y} { proc ::ntext::TextButton1 {w x y} { variable ::tk::Priv - set Priv(selectMode) char - set Priv(mouseMoved) 0 - set Priv(pressX) $x - set anchorname [TextAnchor $w] - $w mark set insert [TextClosestGap $w $x $y] - $w mark set $anchorname insert - # Set the anchor mark's gravity depending on the click position - # relative to the gap - set bbox [$w bbox [$w index $anchorname]] - if {$x > [lindex $bbox 0]} { - $w mark gravity $anchorname right - } else { - $w mark gravity $anchorname left + # Catch the very special case with dead peers. + if {[catch {$w isdead} result] || !$result} { + set Priv(selectMode) char + set Priv(mouseMoved) 0 + set Priv(pressX) $x + + # "Wrong line" position adjustment - + # revised_text does it here, ntext does it in TextClosestGap. + $w mark set insert [TextCursorPos $w $x $y] + + set anchorname [TextAnchor $w] + $w mark set $anchorname insert +# # revised_text adjusts $anchorname (if -blockcursor) using +# # TextClosestGap. ntext does not do this. +# if {[$w cget -blockcursor]} { +# $w mark set $anchorname [TextClosestGap $w $x $y] +# } else { +# # this is already the closest gap +# $w mark set $anchorname insert +# } + + # Set the anchor mark's gravity depending on the click position + # relative to the gap. + set bbox [$w bbox $anchorname] + set gravity [expr {$x > [lindex $bbox 0] ? "right" : "left"}] + $w mark gravity $anchorname $gravity + + if {[$w cget -autoseparators]} { + $w edit separator + } } + # Allow focus in any case on Windows, because that will let the # selection be displayed even for state disabled text widgets. - if {[tk windowingsystem] eq "win32" \ - || [$w cget -state] eq "normal"} { + if {[tk windowingsystem] eq "win32" || [$w cget -state] eq "normal"} { focus $w } - if {[$w cget -autoseparators]} { - $w edit separator - } + return } -# If text.tcl is sufficiently recent to have ::tk::Priv(textanchoruid), this -# forces it to be initialized. + +# If text.tcl is sufficiently recent to have ::tk::Priv(textanchoruid), the +# code below forces it to be initialized. +# The revised_text text.tcl is even more recent, and does not use +# ::tk::Priv(textanchoruid). In that case, this initialization is harmless. catch {::tk::TextAnchor} if {[info exists ::tk::Priv(textanchoruid)]} { @@ -1449,13 +1550,28 @@ if {[info exists ::tk::Priv(textanchoruid)]} { # text.tcl may increment this variable but will not re-initialize it. } + # ::ntext::TextAnchor -- # Modified to use ::tk::Priv despite change of namespace. proc ::ntext::TextAnchor {w} { variable ::tk::Priv if {![info exists Priv(textanchor,$w)]} { - set Priv(textanchor,$w) tk::anchor[incr Priv(textanchoruid)] + if {[catch {$w mark generate} result]} { + # This is the "unrevised" text widget. + set Priv(textanchor,$w) tk::anchor[incr Priv(textanchoruid)] + } else { + # This is the revised_text text widget. + # This gives us a private mark, not visible with + # "mark names|next|previous|..". + set Priv(textanchor,$w) $result + # The Tk library still has a big weakness: it's not possible to + # bind variables to a widget, so we use a private command for this + # binding; this means that the variable will be unset automatically + # when the widget will be destroyed. This is the only proper way to + # handle unique identifiers. + $w tk_bindvar ::tk::Priv(textanchor,$w) + } } return $Priv(textanchor,$w) } @@ -1486,8 +1602,8 @@ proc ::ntext::RepelAnchor {w idx} { proc ::ntext::WordBounds {w lineType first last} { # Now find word boundaries - set first1 [$w index "$first + 1c"] - set last1 [$w index "$last - 1c"] + set first1 [$w index "$first + 1i"] + set last1 [$w index "$last - 1i"] if {[$w count -$lineType $first $first1] != 0} { set first1 [$w index $first] } else { @@ -1526,7 +1642,9 @@ proc ::ntext::WordBounds {w lineType first last} { # Note that the 'anchor' is implemented programmatically using # a text widget mark, and uses a name that will be unique for each # text widget (even when there are multiple peers). Currently the -# anchor is considered private to Tk, hence the name 'tk::anchor$i'. +# anchor is considered private to Tk, hence the name 'tk::anchor$i' in text, +# while in revised_text the name is [$w mark generate] and the anchor is not +# listed in [$w mark names]. # # Arguments: # w - The text window in which the button was pressed. @@ -1572,9 +1690,14 @@ proc ::ntext::WordBounds {w lineType first last} { proc ::ntext::TextSelectTo {w x y {extend 0}} { variable ::tk::Priv variable OldSelectMode + if {![catch {$w isdead} result] && $result} { + # revised_text + # Catch the very special case with dead peers. + return + } set anchorname [TextAnchor $w] - set cur [TextClosestGap $w $x $y] + set cur [TextCursorPos $w $x $y] if {[catch {$w index $anchorname}]} { $w mark set $anchorname $cur # Right gravity is set by default. @@ -1627,101 +1750,117 @@ proc ::ntext::TextSelectTo {w x y {extend 0}} { } } word { - # Set initial range based only on the anchor (1 char min width - - # MOD - unless this straddles a display line end) - if {[$w cget -wrap] eq "word"} { - set lineType displaylines + set start [$w index @$x,$y] + set isEmbedded [expr {[string length [$w get $start]] == 0}] + if {0 && $isEmbedded} { + # This is a revised_text feature, disabled here. It is useful + # with on an embedded item; but less helpful when + # is used to extend a selection. + # Don't extend the range if we have an embedded item at this + # position. + set first $start + set last "$first+1i" } else { - set lineType lines - } - # The gravity of the "selection anchor" mark. - # - The anchor's gravity is explicitly used only here. - # - In text.tcl the anchor mark's gravity is set by - # ::tk::TextButton1 depending on the click position relative to - # the gap. - # - In ntext.tcl, the anchor mark's gravity is also set in other - # places, to prevent inappropriate growth of the selection when - # the value is tested here. When the anchor is at an end of the - # selection, its gravity always faces the selected text. - # - The gravity of the insert mark, and of the ntext::* "recorded - # selection" marks, are never explicitly used, and their values - # are always "right". - if {[$w mark gravity $anchorname] eq "right"} { - set first $anchorname - set last "$anchorname + 1c" - if {[$w count -$lineType $first $last] != 0} { - set last $first + # Set initial range based only on the anchor (1 char min width - + # MOD - unless this straddles a display line end) + if {[$w cget -wrap] eq "word"} { + set lineType displaylines } else { + set lineType lines } - } else { - set first "$anchorname - 1c" - set last $anchorname - if {[$w count -$lineType $first $last] != 0} { + # The gravity of the "selection anchor" mark. + # - The anchor's gravity is explicitly used only here. + # - In text.tcl the anchor mark's gravity is set by + # ::tk::TextButton1 depending on the click position relative + # to the gap. + # - In ntext.tcl, the anchor mark's gravity is also set in other + # places, to prevent inappropriate growth of the selection + # when the value is tested here. When the anchor is at an end + # of the selection, its gravity always faces the selected + # text. + # - The gravity of the insert mark, and of the ntext::* + # "recorded selection" marks, are never explicitly used, and + # their values are always "right". + if {[$w mark gravity $anchorname] eq "right"} { + set first $anchorname + set last "$anchorname + 1i" + if {[$w count -$lineType $first $last] != 0} { + set last $first + } else { + } + } else { + set first "$anchorname - 1i" + set last $anchorname + if {[$w count -$lineType $first $last] != 0} { set first $last + } else { + } + } + if { [$w compare $last == $first] + && [$w compare $cur == $first] + } { + # Use $first and $last as above; further extension will + # straddle a display line. Better to have no selection than + # a bad one. + set StoreAnchors 1 } else { + set first0 $first + set last0 $last + if {$selectionExists && $OldSelectMode($w) eq "char"} { + # Do WordBounds calc but without cur. This computes the + # ntext::* anchor marks. This code is necessary if the + # user has used character selection to extend the + # selection, and then come here by using word selection. + # Compute ntext::* anchor marks on the transition from + # "char" to "word" selection. + lassign [WordBounds $w $lineType $first $last] first last + # The new selection will be a single word. + $w mark set ntext::left::$anchorname $first + $w mark set ntext::right::$anchorname $last + set OldSelectMode($w) word + set StoreAnchors 0 + } else { + set StoreAnchors 1 + } + + # Now do the conventional/text.tcl WordBounds calc with cur. + set first $first0 + set last $last0 + set extend 0 + # Extend range (if necessary) to include the current point. + if {[$w compare $cur < $first]} { + set first $cur + if { ($OldSelectMode($w) eq "line") + && [$w compare $last == "$last linestart"] + } { + # This kludge stops the selection growing by one + # word in the wrong direction. + set last "$last-1c" + set extend 1 + } else { + } + } elseif {[$w compare $cur > $last]} { + set last $cur + } + + lassign [WordBounds $w $lineType $first $last] first last + if {$extend} { + set last [$w index $last+1c] + } else { + } } - } - if {[$w compare $last == $first] && [$w compare $cur == $first]} { - # Use $first and $last as above; further extension will straddle - # a display line. Better to have no selection than a bad one. - set StoreAnchors 1 - } else { - set first0 $first - set last0 $last - if {$selectionExists && $OldSelectMode($w) eq "char"} { - # Do WordBounds calc but without cur. This computes the - # ntext::* anchor marks. This code is necessary if the user - # has used character selection to extend the selection, and - # then come here by using word selection. + if { (!$selectionExists) + && ($OldSelectMode($w) eq "char") + && $StoreAnchors + } { # Compute ntext::* anchor marks on the transition from # "char" to "word" selection. - lassign [WordBounds $w $lineType $first $last] first last # The new selection will be a single word. $w mark set ntext::left::$anchorname $first $w mark set ntext::right::$anchorname $last set OldSelectMode($w) word - set StoreAnchors 0 - } else { - set StoreAnchors 1 - } - - # Now do the conventional/text.tcl WordBounds calc with cur. - set first $first0 - set last $last0 - set extend 0 - # Extend range (if necessary) to include the current point - if {[$w compare $cur < $first]} { - set first $cur - if { ($OldSelectMode($w) eq "line") - && [$w compare $last == "$last linestart"] - } { - # This kludge stops the selection growing by one word in - # the wrong direction. - set last "$last-1c" - set extend 1 - } else { - } - } elseif {[$w compare $cur > $last]} { - set last $cur - } - - lassign [WordBounds $w $lineType $first $last] first last - if {$extend} { - set last [$w index $last+1c] - } else { } } - if { (!$selectionExists) - && ($OldSelectMode($w) eq "char") - && $StoreAnchors - } { - # Compute ntext::* anchor marks on the transition from "char" - # to "word" selection. - # The new selection will be a single word. - $w mark set ntext::left::$anchorname $first - $w mark set ntext::right::$anchorname $last - set OldSelectMode($w) word - } } line { if {$selectionExists && $OldSelectMode($w) eq "line"} { @@ -1744,15 +1883,15 @@ proc ::ntext::TextSelectTo {w x y {extend 0}} { if {[$w compare $cur < $first]} { set first "$cur linestart" } elseif {[$w compare $cur > $last]} { - set last "$cur lineend+1c" + set last "$cur lineend+1i" } set first [$w index $first] set last [$w index $last] } } if {$Priv(mouseMoved) || ($Priv(selectMode) ne "char")} { - # Set the insert mark and anchor to the ends of the selection. - # The insert mark is the end that is closest to the mouse position $cur. + # Set the insert mark and anchor to the ends of the selection. + # The insert mark is the end that is closest to the mouse position $cur. set distFirst [$w count -displaychars $first $cur] set distLast [$w count -displaychars $last $cur] if {abs($distFirst) < abs($distLast)} { @@ -1770,10 +1909,11 @@ proc ::ntext::TextSelectTo {w x y {extend 0}} { $w mark gravity $anchorname $newGrav # Rearrange operations so that selection is never full-empty-full. -# $w tag remove sel 0.0 end - $w tag add sel $first $last +# $w tag remove sel 1.0 end $w tag remove sel 1.0 $first + $w tag add sel $first $last $w tag remove sel $last end + update idletasks } return @@ -1808,6 +1948,8 @@ proc ::ntext::TextKeyExtend {w index} { if {[catch {$w index $anchorname}]} { $w mark set $anchorname $cur # Right gravity is set by default. + # revised_text sets left gravity. + # ntext sets gravity in the code below. } if {[$w compare $cur < $anchorname]} { @@ -1820,9 +1962,9 @@ proc ::ntext::TextKeyExtend {w index} { set grav right } # Rearrange operations so that selection is never full-empty-full. - # $w tag remove sel 0.0 $first + # $w tag remove sel 1.0 $first $w tag add sel $first $last - $w tag remove sel 0.0 $first + $w tag remove sel 1.0 $first $w tag remove sel $last end $w mark gravity $anchorname $grav return @@ -1840,24 +1982,13 @@ proc ::ntext::TextKeyExtend {w index} { # modified to set oldInsert and call AdjustIndentMultipleLines. proc ::ntext::TextPasteSelection {w x y} { - $w mark set insert [TextClosestGap $w $x $y] - set oldInsert [$w index insert] - if {![catch {::tk::GetSelection $w PRIMARY} sel]} { - set oldSeparator [$w cget -autoseparators] - if {$oldSeparator} { - $w configure -autoseparators 0 - $w edit separator - } - $w insert insert $sel - AdjustIndentMultipleLines $w $oldInsert insert - if {$oldSeparator} { - $w edit separator - $w configure -autoseparators 1 - } - } if {[$w cget -state] eq "normal"} { + # revised_text uses TextCursorPos instead of TextClosestGap. + $w mark set insert [TextClosestGap $w $x $y] + TextInsertSelection $w PRIMARY focus $w } + return } # ::tk::TextAutoScan -- @@ -1891,7 +2022,7 @@ proc ::ntext::TextAutoScan {w} { return } TextSelectTo $w $Priv(x) $Priv(y) - set Priv(afterId) [after 50 [list ntext::TextAutoScan $w]] + set Priv(afterId) [after 50 [list ::ntext::TextAutoScan $w]] } # ::tk::TextSetCursor @@ -1906,7 +2037,7 @@ proc ::ntext::TextAutoScan {w} { proc ::ntext::TextSetCursor {w pos} { if {[$w compare $pos == end]} { - set pos {end - 1 chars} + set pos {end - 1i} } $w mark set insert $pos $w tag remove sel 1.0 end @@ -1933,9 +2064,13 @@ proc ::ntext::TextSetCursor {w pos} { # never full, then empty, then full. proc ::ntext::TextKeySelect {w new} { - + if {![catch {$w isdead} result] && $result} { + # revised_text + # Catch the very special case with dead peers. + return + } set anchorname [TextAnchor $w] - if {[$w tag nextrange sel 1.0 end] eq ""} { + if {[llength [$w tag nextrange sel 1.0 end]] == 0} { if {[$w compare $new < insert]} { $w tag add sel $new insert $w mark set $anchorname insert @@ -1946,6 +2081,9 @@ proc ::ntext::TextKeySelect {w new} { $w mark gravity $anchorname right } } else { + if {[catch {$w index $anchorname}]} { + $w mark set $anchorname insert + } if {[$w compare $new < $anchorname]} { set first $new set last $anchorname @@ -1987,7 +2125,7 @@ proc ::ntext::TextKeySelect {w new} { # - Set the gravity of the anchor. proc ::ntext::TextResetAnchor {w index} { - if {[$w tag ranges sel] eq ""} { + if {[llength [$w tag ranges sel]] == 0} { # Don't move the anchor if there is no selection now; this # makes the widget behave "correctly" when the user clicks # once, then shift-clicks somewhere -- ie, the area between @@ -2011,7 +2149,7 @@ proc ::ntext::TextResetAnchor {w index} { scan $a "%d.%d" lineA chA scan $b "%d.%d" lineB chB scan $c "%d.%d" lineC chC - if {$lineB < $lineC+2} { + if {$lineB < $lineC + 2} { set total [string length [$w get $b $c]] if {$total <= 2} { return @@ -2025,7 +2163,7 @@ proc ::ntext::TextResetAnchor {w index} { } return } - if {($lineA-$lineB) < ($lineC-$lineA)} { + if {$lineA - $lineB < $lineC - $lineA} { $w mark set $anchorname sel.last $w mark gravity $anchorname left } else { @@ -2042,10 +2180,9 @@ proc ::ntext::TextResetAnchor {w index} { # w - The text widget whose selection is to be checked proc ::ntext::TextCursorInSelection {w} { - expr { - [llength [$w tag ranges sel]] - && [$w compare sel.first <= insert] - && [$w compare sel.last >= insert] + expr { [llength [$w tag ranges sel]] + && [$w compare sel.first <= insert] + && [$w compare sel.last >= insert] } } @@ -2063,7 +2200,7 @@ proc ::ntext::TextCursorInSelection {w} { # - call AdjustIndentOneLine proc ::ntext::TextInsert {w s} { - if {$s eq "" || [$w cget -state] eq "disabled"} { + if {[string length $s] == 0 || [$w cget -state] ne "normal"} { return } set compound 0 @@ -2074,6 +2211,8 @@ proc ::ntext::TextInsert {w s} { $w edit separator } else { } + # revised_text - ensure that this operation is triggering "watch" + $w mark set insert sel.first $w delete sel.first sel.last } elseif {$::ntext::overwrite && ($s ne "\n") && ($s ne "\t") && ([$w get insert] ne "\n")} { @@ -2103,14 +2242,15 @@ proc ::ntext::TextInsert {w s} { # maintain the original x position across repeated operations, even though # some lines that will get passed through don't have enough characters to # cover the original column. Second, don't try to scroll past the -# beginning or end of the text. +# beginning or end of the text if we don't select. # # Arguments: # w - The text window in which the cursor is to move. # n - The number of display lines to move: -1 for up one line, # +1 for down one line. +# sel Boolean value whether we are selecting text. -proc ::ntext::TextUpDownLine {w n} { +proc ::ntext::TextUpDownLine {w n {sel no}} { variable ::tk::Priv set i [$w index insert] @@ -2118,10 +2258,8 @@ proc ::ntext::TextUpDownLine {w n} { set Priv(textPosOrig) $i } set lines [$w count -displaylines $Priv(textPosOrig) $i] - set new [$w index \ - "$Priv(textPosOrig) + [expr {$lines + $n}] displaylines"] - if {[$w compare $new == end] \ - || [$w compare $new == "insert display linestart"]} { + set new [$w index "$Priv(textPosOrig) + [expr {$lines + $n}] displaylines"] + if {(!$sel) && ([$w compare $new == end] || [$w compare $new == "insert display linestart"])} { set new $i } set Priv(prevPos) $new @@ -2140,17 +2278,16 @@ proc ::ntext::TextUpDownLine {w n} { proc ::ntext::TextPrevPara {w pos} { set pos [$w index "$pos linestart"] while {1} { - if {([$w get "$pos - 1 line"] eq "\n" && ([$w get $pos] ne "\n")) \ - || $pos eq "1.0"} { - if {[regexp -indices -- {^[ \t]+(.)} \ - [$w get $pos "$pos lineend"] -> index]} { + set newPos [$w index "$pos - 1 line"] + if {([$w get $newPos] eq "\n" && ([$w get $pos] ne "\n")) || [$w compare $pos == 1.0]} { + if {[regexp -indices -- {^[ \t]+(.)} [$w get $pos "$pos lineend"] -> index]} { set pos [$w index "$pos + [lindex $index 0] chars"] } - if {[$w compare $pos != insert] || [lindex [split $pos .] 0]==1} { + if {[$w compare $pos != insert] || [$w compare [$w index "$pos linestart"] == 1.0]} { return $pos } } - set pos [$w index "$pos - 1 line"] + set pos $newPos } } @@ -2167,18 +2304,17 @@ proc ::ntext::TextNextPara {w start} { set pos [$w index "$start linestart + 1 line"] while {[$w get $pos] ne "\n"} { if {[$w compare $pos == end]} { - return [$w index "end - 1c"] + return [$w index "end - 1i"] } set pos [$w index "$pos + 1 line"] } while {[$w get $pos] eq "\n"} { set pos [$w index "$pos + 1 line"] if {[$w compare $pos == end]} { - return [$w index "end - 1c"] + return [$w index "end - 1i"] } } - if {[regexp -indices -- {^[ \t]+(.)} \ - [$w get $pos "$pos lineend"] -> index]} { + if {[regexp -indices -- {^[ \t]+(.)} [$w get $pos "$pos lineend"] -> index]} { return [$w index "$pos + [lindex $index 0] chars"] } return $pos @@ -2189,7 +2325,9 @@ proc ::ntext::TextNextPara {w start} { # pages and possibly extending the selection along the way. It scrolls # the view in the widget by the number of pages, and it returns the # index of the character that is at the same position in the new view -# as the insertion cursor used to be in the old view. +# as the insertion cursor used to be in the old view. (Or, if the insert +# cursor was not in view, it returns a weird index from somewhere in the +# first display line). # # Arguments: # w - The text window in which the cursor is to move. @@ -2209,12 +2347,12 @@ proc ::ntext::TextNextPara {w start} { # ::ntext::TextScrollPages takes a slightly different approach: # like ::tk::TextScrollPages, it returns an index (a new value for the insert # mark), and lets the calling code decide whether to move the mark. -# Unlike ::tk::TextScrollPages, when called with two arguments it does no +# Unlike ::tk::TextScrollPages (which calls "$w yview", but not "$w see"), when +# called with two arguments ::ntext::TextScrollPages does no # scrolling - it relies on the calling code to do the scrolling, which in # practice is usually when it tries to 'see' the returned index value. # -# By focussing on the insert mark, ::ntext::TextScrollPages has the -# following useful features: +# ::ntext::TextScrollPages has the following useful features: # - When the slack is less than one page, it "moves" the insert mark as far # as possible. # - When there is no slack, it "moves" the insert mark to the start/end of @@ -2223,7 +2361,8 @@ proc ::ntext::TextNextPara {w start} { # # When called with three arguments, 3rd argument = "preScroll", then, if the # new position of the insert mark is off-screen, ::ntext::TextScrollPages -# will scroll the widget, to try to make the calling code's "see" move the +# will scroll the widget (using "see", not "yview"), to try to make the calling +# code's "see" move the # returned index value to the middle, not the edge, of the widget. This # feature is most useful in widgets with only a few visible lines, where it # prevents successive calls from moving the insert mark between the middle and @@ -2232,36 +2371,65 @@ proc ::ntext::TextNextPara {w start} { proc ::ntext::TextScrollPages {w count {help ""}} { set spareLines 1 ;# adjustable + # Cf. revised_text - when scrolling is already at its limit or within a + # fractional display line of it, behave as if spareLines is 0, i.e. jump + # to the limit. + if {$count > 0} { + if {[llength [$w dlineinfo end-1c]]} { + # Last display line of last line is partially or fully visible. + set localSpareLines 0 + } else { + set localSpareLines $spareLines + } + } else { + if {[llength [$w dlineinfo 1.0]]} { + # First display line of first line is partially or fully visible. + set localSpareLines 0 + } else { + set localSpareLines $spareLines + } + } + set oldInsert [$w index insert] set count [expr {int($count)}] if {$count == 0} { return $oldInsert } set visibleLines [$w count -displaylines @0,0 @0,20000] - if {$visibleLines > $spareLines} { - set pageLines [expr {$visibleLines - $spareLines}] + if {$visibleLines > $localSpareLines} { + set pageLines [expr {$visibleLines - $localSpareLines}] } else { set pageLines 1 } set newInsert [TextUpDownLine $w [expr {$pageLines * $count}]] if {[$w compare $oldInsert != $newInsert]} { - set finalInsert $newInsert + set newPos $newInsert } elseif {$count < 0} { - set finalInsert 1.0 + set newPos 1.0 } else { - set finalInsert [$w index "end -1 char"] + set newPos [$w index "end -1 char"] } - if {($help eq "preScroll") && ([$w bbox $finalInsert] eq "")} { - # If $finalInsert is offscreen, try to put it in the middle - if { [$w count -displaylines 1.0 $finalInsert] > \ - [$w count -displaylines $finalInsert end]} { + if {($help eq "preScroll") && ([$w bbox $newPos] eq "")} { + # If $newPos is offscreen, try to put it in the middle + if { [$w count -displaylines 1.0 $newPos] + > [$w count -displaylines $newPos end] + } { $w see 1.0 } else { $w see end } - $w see $finalInsert + $w see $newPos + } + + + # From revised_text - to permit scrolling in this corner case. + if {[$w compare insert == $newPos]} { + # This may happen if a character is spanning the entire view, + # ensure that at least one line will change. + set newPos [$w index "[expr {$count > 0 ? "insert +1" : "insert -1"}] displayline"] } - return $finalInsert + + return $newPos } # ::tk::TextTranspose -- @@ -2279,22 +2447,30 @@ proc ::ntext::TextScrollPages {w count {help ""}} { # - renames local variable autosep to oldSeparator, as in other procs proc ::ntext::TextTranspose w { - set pos insert - if {[$w compare $pos != "$pos lineend"]} { - set pos [$w index "$pos + 1 char"] - } - set new [$w get "$pos - 1 char"][$w get "$pos - 2 char"] - if {[$w compare "$pos - 1 char" == 1.0]} { + if {[$w cget -state] ne "normal" || [$w compare insert == 1.0]} { return } + + set pos insert + if {[$w compare insert != "insert lineend"]} { + append pos +1i + } + set pos [$w index $pos] + # ensure this is seen as an atomic op to undo set oldSeparator [$w cget -autoseparators] if {$oldSeparator} { $w configure -autoseparators 0 $w edit separator } - $w delete "$pos - 2 char" $pos + + # for revised_text, ensure that this operation is triggering "watch" + set insPos [$w index insert] + $w mark set insert ${pos}-2c + set new [$w get insert+1i][$w get insert] + $w delete insert $pos $w insert insert $new + $w mark set insert $insPos if {[$w compare insert == "insert linestart"]} { AdjustIndentOneLine $w "insert - 1 line" @@ -2302,10 +2478,12 @@ proc ::ntext::TextTranspose w { AdjustIndentOneLine $w insert $w see insert + if {$oldSeparator} { $w edit separator $w configure -autoseparators 1 } + return } # ::tk_textCopy -- @@ -2338,21 +2516,33 @@ proc ::ntext::new_textCopy w { proc ::ntext::new_textCut w { if {![catch {set data [$w get sel.first sel.last]}]} { - # make <> an atomic operation on the Undo stack, - # i.e. separate it from other delete operations on either side - set oldSeparator [$w cget -autoseparators] - if {$oldSeparator} { - $w configure -autoseparators 0 - $w edit separator - } - set LocalOldFirst [$w index sel.first] clipboard clear -displayof $w clipboard append -displayof $w $data - $w delete sel.first sel.last - AdjustIndentOneLine $w $LocalOldFirst - if {$oldSeparator} { - $w edit separator - $w configure -autoseparators 1 + + if {([$w cget -state] eq "normal")} { + # make <> an atomic operation on the Undo stack, + # i.e. separate it from other delete operations on either side + # (For older Tk? Check.) disable -autoseparators for the operation. + set oldSeparator [$w cget -autoseparators] + if {$oldSeparator} { + $w configure -autoseparators 0 + $w edit separator + } + + set LocalOldFirst [$w index sel.first] + TextDelete $w sel.first sel.last + AdjustIndentOneLine $w $LocalOldFirst + + if {$oldSeparator} { + $w edit separator + $w configure -autoseparators 1 + } + + if {$::ntext::GenerateSelect} { + # The PRIMARY selection has changed but the widget does + # not generate this event. + event generate $w <> + } } } return @@ -2372,30 +2562,8 @@ proc ::ntext::new_textCut w { # - overwrite the selection (if it exists), even if the insert mark is elsewhere proc ::ntext::new_textPaste w { - set oldInsert [$w index insert] - if {![catch {::tk::GetSelection $w CLIPBOARD} sel]} { - set oldSeparator [$w cget -autoseparators] - if {$oldSeparator} { - $w configure -autoseparators 0 - $w edit separator - } - if {([tk windowingsystem] ne "x11TheOldFashionedWay") && \ - ([$w tag nextrange sel 1.0 end] ne "")} { - set LocalOldFirst [$w index sel.first] - $w mark set ntextIndentMark sel.last - # right gravity mark, survives deletion - - $w delete sel.first sel.last - $w insert $LocalOldFirst $sel - AdjustIndentMultipleLines $w $LocalOldFirst ntextIndentMark - } else { - $w insert insert $sel - AdjustIndentMultipleLines $w $oldInsert insert - } - if {$oldSeparator} { - $w edit separator - $w configure -autoseparators 1 - } + if {[$w cget -state] eq "normal"} { + ::ntext::TextInsertSelection $w CLIPBOARD } return } @@ -2431,12 +2599,13 @@ proc ::ntext::TextNextPos {w start op} { set text "" set cur $start while {[$w compare $cur < end]} { - set text $text[$w get -displaychars $cur "$cur lineend + 1c"] + set end [$w index "$cur lineend + 1i"] + append text [$w get -displaychars $cur $end] set pos [$op $text 0] if {$pos >= 0} { return [$w index "$start + $pos display chars"] } - set cur [$w index "$cur lineend +1c"] + set cur $end } return end } @@ -2451,17 +2620,19 @@ proc ::ntext::TextNextPos {w start op} { # op - Function to use to find next position. proc ::ntext::TextPrevPos {w start op} { - set text "" + set succ "" set cur $start - while {[$w compare $cur > 0.0]} { - set text [$w get -displaychars "$cur linestart - 1c" $cur]$text + while {[$w compare $cur > 1.0]} { + set text "" + append text [$w get -displaychars "$cur linestart - 1i" $cur] $succ set pos [$op $text end] if {$pos >= 0} { - return [$w index "$cur linestart - 1c + $pos display chars"] + return [$w index "$cur linestart - 1i + $pos display chars"] } - set cur [$w index "$cur linestart - 1c"] + set cur [$w index "$cur linestart - 1i"] + set succ $text } - return 0.0 + return 1.0 } # ::tk::TextScanMark -- @@ -2508,6 +2679,118 @@ proc ::ntext::TextScanDrag {w x y} { } } +# ::tk::TextDelete -- +# +# Delete the characters in given range. +# Ensure that "watch" will be triggered, and consider +# that "insert" may be involved in the given range. +# This implementation avoids unnecessary mappings of indices. + +proc ::ntext::TextDelete {w start end} { + if {[catch {set testPos [$w mark generate]}]} { + # This is the "unrevised" text widget. + $w delete $start $end + } else { + # This is the revised_text text widget. + # Remember old positions, use temporary marks ('mark generate'), + # take into account that $end may refer "insert" mark. + $w mark set [set insPos [$w mark generate]] insert + $w mark set [set endPos [$w mark generate]] $end + $w mark set insert $start + $w delete insert $endPos + $w mark set insert $insPos + $w mark unset $insPos + $w mark unset $endPos + $w mark unset $testPos + } + return +} + +# ::tk::TextInsertSelection -- +# This procedure inserts the selection. +# +# Arguments: +# w - The text window. +# selection atom name of the selection (usually CLIPBOARD or PRIMARY) + +# Extracted from ::ntext::new_textPaste and ::ntext::TextPasteSelection, and +# corresponds to revised_text's tk::TextInsertSelection. + +proc ::ntext::TextInsertSelection {w selection} { + if {[catch {::tk::GetSelection $w $selection} sel]} { + return + } + set oldInsert [$w index insert] + set oldSeparator [$w cget -autoseparators] + if {$oldSeparator} { + $w configure -autoseparators 0 + $w edit separator + } + + if {([$w tag nextrange sel 1.0 end] ne "")} { + set oldSel [list [$w index sel.first] [$w index sel.last]] + } else { + set oldSel {} + } + + if { ($selection eq "CLIPBOARD") + && ([tk windowingsystem] ne "x11TheOldFashionedWay") + && ([$w tag nextrange sel 1.0 end] ne "") + } { + set LocalOldFirst [$w index sel.first] + $w mark set ntextIndentMark sel.last + # right gravity mark, survives deletion + + TextDelete $w sel.first sel.last + $w insert $LocalOldFirst $sel + AdjustIndentMultipleLines $w $LocalOldFirst ntextIndentMark + } else { + $w insert insert $sel + AdjustIndentMultipleLines $w $oldInsert insert + } + if {$oldSeparator} { + $w edit separator + $w configure -autoseparators 1 + } + + # The PRIMARY selection has changed but the widget does + # not generate this event. + if { ($selection eq "PRIMARY") + && [TextCursorInSelection $w] + && $::ntext::GenerateSelect + } { + event generate $w <> + } + + # The PRIMARY selection has changed but the widget does + # not generate this event. + # The operation doesn't change the value without changing the range, + # so it is enough to consider the range. + # The operation does not mark a selection if none existed before. + if { ($selection eq "CLIPBOARD") + && ($oldSel ne {}) + && $::ntext::GenerateSelect + && ( ([$w tag nextrange sel 1.0 end] eq "") + || ([list [$w index sel.first] [$w index sel.last]] ne $oldSel) + ) + } { + event generate $w <> + } + + return +} + + +# revised_text text.tcl has new commands in the global namespace: +# ::tk_textInsert +# ::tk_textReplace +# ::tk_textRebindMouseWheel +# ::tk_mergeRange +# These commands are loaded from text.tcl and are self-contained: they are not +# used by any bindings or commands in text.tcl, and do not call any other +# commands in text.tcl. Therefore ntext does not need to provide replacements. + + ##### END OF CODE THAT IS MODIFIED from the file text.tcl. ##### THE CODE ABOVE ALSO USES THE PROCS DEFINED BELOW. @@ -2628,6 +2911,31 @@ proc ::ntext::EndIndex {w index} { return $end } +# ::ntext::DefineCursor -- +# Set the cursor depending on insert/overwrite mode and +# ::ntext::useBlockCursor. + +proc ::ntext::DefineCursor {w} { + variable overwrite + variable useBlockCursor + variable OldInsertBackground + + if {$useBlockCursor} { + $w configure -blockcursor $overwrite + } else { + if {$overwrite} { + set OldInsertBackground($w) [$w cget -insertbackground] + $w configure -insertbackground red + } elseif {[info exists OldInsertBackground($w)]} { + $w configure -insertbackground $OldInsertBackground($w) + } else { + # Somehow the old value was not recorded. Improvise. + $w configure -insertbackground [$w cget -fg] + } + } + return +} + # Extra procs for macOS/Aqua: @@ -3102,11 +3410,14 @@ proc ::ntext::AdjustIndentOneLine {textWidget index} { proc ::ntext::AddIndent {textWidget index pix} { # Add a tag with properties "-lmargin2 $pix" to the entire logical line variable lm2IndentDebug + variable indentColor set lineStart [$textWidget index "$index linestart"] set nextLineStart [$textWidget index "$lineStart + 1 line"] set tagName ntextAlignLM2Indent=${pix} $textWidget tag add $tagName $lineStart $nextLineStart $textWidget tag configure $tagName -lmargin2 ${pix} + # Older versions of Tk do not support -lmargincolor. + catch {$textWidget tag configure $tagName -lmargincolor $indentColor} if {$lm2IndentDebug} { $textWidget tag configure $tagName -background [IntToColor $pix 100] } @@ -3262,6 +3573,25 @@ proc ::ntext::IntToColor {pix range} { return $color } +# ::ntext::syncIndentColor -- +# +# Synchronize text widget indent coloring with indentColor. +# Call only if indentColor is changed after widgets with text have been +# defined. +# +# Arguments: +# w - Tk window path of a text widget + +proc ::ntext::syncIndentColor {w} { + variable indentColor + foreach tag [$w tag names] { + if {[string match ntextAlignLM2Indent=* $tag]} { + catch {$w tag configure $tag -lmargincolor $indentColor} + } + } + return +} + ##### END OF CODE TO HANDLE (OPTIONAL) INDENTATION USING -lmargin2 ##### End of procs. @@ -3270,4 +3600,4 @@ proc ::ntext::IntToColor {pix range} { ::ntext::initializeMatchPatterns -package provide ntext 1.0b1 +package provide ntext 1.0b3 diff --git a/modules/ntext/ntextBindings.man b/modules/ntext/ntextBindings.man index 9cb019cd..925c48b1 100644 --- a/modules/ntext/ntextBindings.man +++ b/modules/ntext/ntextBindings.man @@ -83,6 +83,16 @@ The behaviour of [emph Ntext] may be configured application-wide by setting the [item] [const 1] - selects classic [emph Text] behaviour [list_end] + +[para] +[var ::ntext::classicParagraphs] +[list_begin itemized] +[item] + [const 0] - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit. The bindings involve vertical scrolling of the screen and are . +[item] + [const 1] - on macOS Aqua, certain keyboard bindings are made to behave in the same way as for the Windows and X11 windowing systems and the classic [emph Text], ignoring the conventions of Aqua. The bindings involve vertical scrolling of the screen and are . +[list_end] + [para] [var ::ntext::classicSelection] [list_begin itemized] @@ -101,16 +111,18 @@ The behaviour of [emph Ntext] may be configured application-wide by setting the [item] The value is toggled by the [emph Insert] key. [list_end] + [para] -[var ::ntext::classicParagraphs] +[var ::ntext::useBlockCursor] [list_begin itemized] [item] - [const 0] - (default value) on macOS Aqua, certain keyboard bindings are made to behave in the same way as the Mac application TextEdit. The bindings involve vertical scrolling of the screen and are . + [const 0] - the block cursor will not be used. When the widget is in [emph overwrite] mode (see [const ::ntext::overwrite]), the ordinary cursor will change color instead. [item] - [const 1] - on macOS Aqua, certain keyboard bindings are made to behave in the same way as for the Windows and X11 windowing systems and the classic [emph Text], ignoring the conventions of Aqua. The bindings involve vertical scrolling of the screen and are . + [const 1] - the block cursor will be used when the widget is in [emph overwrite] mode (see [const ::ntext::overwrite]). +[item] + The default value depends on the version of [const Tk]. In versions of [const Tk] earlier than [const 8.5.12], the sizing of the block cursor had a bug, and [var ::ntext::useBlockCursor] defaults to [const 0]. From [const 8.5.12] onwards the bug is fixed, and [var ::ntext::useBlockCursor] defaults to [const 1]. [list_end] - [section INTERNALS] In order to remain independent of the version of [package Tk] (8.5 or 8.6), [package ntext] defines its own virtual events. These new virtual events are used only in the [emph Ntext] binding tag, and therefore do not interfere with the real or virtual events used in other code. diff --git a/modules/ntext/ntextIndent.man b/modules/ntext/ntextIndent.man index 3d69e38f..0dc81773 100644 --- a/modules/ntext/ntextIndent.man +++ b/modules/ntext/ntextIndent.man @@ -27,11 +27,15 @@ Replacement for ::tk_textCopy. [call [cmd ::ntext::new_textCut] [arg pathName]] -Replacement for ::tk_textCut that also maintains [emph Ntext] indentation (see [term ntextIndent]). +Replacement for ::tk_textCut that also maintains [emph Ntext] indentation. [call [cmd ::ntext::new_textPaste] [arg pathName]] -Replacement for ::tk_textPaste that also maintains [emph Ntext] indentation (see [term ntextIndent]). +Replacement for ::tk_textPaste that also maintains [emph Ntext] indentation. + +[call [cmd ::ntext::syncIndentColor] [arg pathName]] + +Command to apply the current value of the variable [var ::ntext::indentColor] to existing lines in a text widget. This command is useful if a text widget has been created, text has been inserted in the widget, [emph {and then}] the value of [var ::ntext::indentColor] is changed. [list_end] @@ -43,11 +47,23 @@ The behavior of [emph Ntext] may be configured application-wide by setting the v [var ::ntext::classicWrap] [list_begin itemized] [item] - 0 - selects [emph Ntext] behaviour, i.e. display lines are indented to match the initial whitespace of the first display line of a logical line. + [const 0] - selects [emph Ntext] behaviour, i.e. display lines are indented to match the initial whitespace of the first display line of a logical line. [para] No other action is required if this option, and the text widget's [arg -wrap] option, are set before any text is entered in the widget, and if text is entered and edited only by the mouse and keyboard. If, instead, text is manipulated by the script, or if the text widget's [arg -wrap] option or the value of [var ::ntext::classicWrap] are changed while the widget holds text, then calls to [emph ntext] functions are needed to alter the indentation. See the section [sectref {INDENTING DISPLAY LINES}] for detailed instructions. [item] - 1 - (default value) selects classic [emph Text] behaviour, i.e. no indentation. + [const 1] - (default value) selects classic [emph Text] behaviour, i.e. no indentation. +[list_end] + +[var ::ntext::indentColor] +[list_begin itemized] +[item] + [const {{}}] - if the value is the empty string, then the indent of wrapped display lines has the same color as the widget background. +[item] + [emph color] - a valid Tk color to use for the indent of wrapped display lines (default value [emph #d9d9d9]). +[para] + Coloring is implemented with the text widget tag option [arg -lmargincolor], which is available from [package Tk] 8.6.6 onwards. [emph Ntext] indent coloring has no effect in earlier versions of [package Tk]. +[para] + The value of [var ::ntext::indentColor] will often be set at startup. If the value is changed when text widgets already exist and contain text, those widgets can be updated by calling command [cmd ::ntext::syncIndentColor]. [list_end] [emph {Advanced Use}] @@ -120,11 +136,31 @@ This version of [package ntext] is intended to be compatible with all releases o [section EXAMPLES] -To switch on [emph Ntext] 's indentation and use it in widget .t: +To switch on [emph Ntext] 's indentation and use it in widget .t, using the default indent color [emph #d9d9d9]: + +[example { +package require ntext +set ::ntext::classicWrap 0 +text .t -wrap word +bindtags .t {.t Ntext . all} +}] + +To switch on [emph Ntext] 's indentation and use it in widget .t, without colored indents: [example { package require ntext set ::ntext::classicWrap 0 +set ::ntext::indentColor {} +text .t -wrap word +bindtags .t {.t Ntext . all} +}] + +To switch on [emph Ntext] 's indentation and use it in widget .t, coloring the indents black: + +[example { +package require ntext +set ::ntext::classicWrap 0 +set ::ntext::indentColor black text .t -wrap word bindtags .t {.t Ntext . all} }] @@ -151,6 +187,13 @@ set foo [.t index end] ::ntext::wrapIndent .t $foo end }] +To change the indentation color when a widget .t already holds text: + +[example { +set ::ntext::indentColor black +::ntext::syncIndentColor .t +}] + To switch to [arg -wrap] [arg char] mode: [example { @@ -160,7 +203,6 @@ To switch to [arg -wrap] [arg char] mode: - [see_also ntext] [see_also text bindtags regexp re_syntax] [keywords text bindtags regexp re_syntax] diff --git a/modules/ntext/pkgIndex.tcl b/modules/ntext/pkgIndex.tcl index 86815b56..61665919 100644 --- a/modules/ntext/pkgIndex.tcl +++ b/modules/ntext/pkgIndex.tcl @@ -1 +1 @@ -package ifneeded ntext 1.0b1 [list source [file join $dir ntext.tcl]] +package ifneeded ntext 1.0b3 [list source [file join $dir ntext.tcl]] diff --git a/modules/persistentSelection/PersistentSelection.odt b/modules/persistentSelection/PersistentSelection.odt new file mode 100644 index 00000000..05a45b7b Binary files /dev/null and b/modules/persistentSelection/PersistentSelection.odt differ diff --git a/modules/persistentSelection/PersistentSelection.pdf b/modules/persistentSelection/PersistentSelection.pdf new file mode 100644 index 00000000..4b2ded8b Binary files /dev/null and b/modules/persistentSelection/PersistentSelection.pdf differ diff --git a/modules/persistentSelection/persistentSelection.man b/modules/persistentSelection/persistentSelection.man new file mode 100644 index 00000000..de03333a --- /dev/null +++ b/modules/persistentSelection/persistentSelection.man @@ -0,0 +1,209 @@ +[comment {-*- tcl -*- persistentSelection manpage}] +[manpage_begin persistentSelection n 1.0] +[moddesc {Enhanced PRIMARY selection}] +[titledesc {Enhanced PRIMARY selection}] +[require Tcl 8.5] +[require Tk 8.5] +[require persistentSelection [opt 1.0]] +[description] + +Consider a [package Tk] widget that sets its [option -exportselection] option to boolean [const true], thereby exporting its selection. When the selection in the widget is canceled, by default [package Tk] also cancels the [const PRIMARY] selection. In this situation, an attempt to read the [const PRIMARY] selection, e.g. by a [const <>] event, will fail. + +[para] +The [package persistentSelection] package offers more convenient behavior. It will sustain as the [const PRIMARY] selection the last non-empty value set by any [package Tk] widget that it monitors, as long as the [const PRIMARY] selection is not claimed by another process, or by a widget that it does not monitor. + +[para] +The [package persistentSelection] package works by binding to the [const <>] event on the widgets of interest, and using this binding to monitor any change of the selection in the widget. Its commands are confined to the namespace [namespace ::persistentSelection]. + +[section COMMANDS] + +[list_begin definitions] + + +[call [cmd persistentSelection::fixText]] + +Call this command once to resolve problems with [syscmd [widget text]] widgets that use the default [const Text] bindtag (rather than [const Ntext]). See [sectref {Text widgets}] for an explanation. + +[para] +The command adjusts some [const Text] bindings to generate [const <>] events; and it re-orders calls to the [syscmd [widget text]] widget [cmd tag] command in the private command [cmd ::tk::TextSelectTo], so that this command cooperates better with [package persistentSelection]. + +[para] +These adjustments are needed only to older versions of [package Tk]. The command [cmd persistentSelection::fixText] has no effect on sufficiently recent releases. It can safely be called for any version of [package Tk]. + +[call [cmd persistentSelection::getClassicPrimarySel] [opt [arg displayOf]] [opt [arg withOthers]]] + +[list_begin itemized] +[item] [arg displayOf] - a [package Tk] window path on the display to be interrogated (optional, default {[const .]}) +[item] [arg withOthers] - whether to return the [const PRIMARY] selection if it is owned by another process or interpreter (optional, boolean, default [const false]) +[list_end] + +A command to return the classic (non-persistent) form of the [const PRIMARY] selection. If the selection does not exist, or is sustained only by [package persistentSelection], the command returns the empty string. + + +[call [cmd persistentSelection::getPrimarySel] [opt [arg displayOf]]] +[list_begin itemized] +[item] [arg displayOf] - a [package Tk] window on the display to be interrogated (optional, default {[const .]}) +[list_end] + +A command to return the value of the [const PRIMARY] selection. If the selection does not exist, the command returns the empty string. The usual [package Tk] commands are perfectly valid, but they raise an error if the selection does not exist. + +[call [cmd persistentSelection::report] [arg type] [arg pathName]] + +[list_begin itemized] +[item] [arg type] - (value [const text] or [const entry]) classification of the widget whose selection has changed +[item] [arg pathName] - the [package Tk] window path of the widget whose selection has changed +[list_end] + +To make package [package persistentSelection] monitor a widget, this command must be bound to the [const <>] event on that widget. The command records changes in the widget's selection, and uses the information to sustain a non-empty [const PRIMARY] selection on each display. + +[list_end] + + +[section USAGE] +[subsection {Script requirements}] + +For each widget that will be monitored by [package persistentSelection], the command [cmd persistentSelection::report] must be bound to event [const <>] in one of the widget's binding tags. + +[para] +For example, the developer may wish to use [package persistentSelection] with every [syscmd [widget text]] and [syscmd [widget entryPlus]] widget in an application: this can be achieved by adding the [const <>] binding to the [const Text] and [const EntryPlus] bindtags. See [sectref EXAMPLES]. + +[para] +If [package persistentSelection] is not required for all widgets of a particular class, the binding can be added to per-widget bindtags. See [sectref EXAMPLES]. + +[subsection {Widget requirements}] +To be capable of being monitored by [package persistentSelection], a widget must satisfy three conditions: +[list_begin itemized] + +[item] It must have an [option -exportselection] option that allows it to export its selection to the [const PRIMARY] selection. + +[item] It must generate a [const <>] event whenever its selection changes. + +[item] its bindings to other events should be suitable - specifically, in versions of [package Tk] older than [const 8.6.6], a GUI event that extends or reduces the selection from one non-empty value to another should not use an intermediate state that has an empty selection, because this confuses [package persistentStore]. + +[list_end] + +[para] +The [package Tk] and [const Ttk] widgets that can export their selection are [syscmd [widget text]], [syscmd [widget entry]], [syscmd [widget listbox]], [syscmd [widget spinbox]], [syscmd [widget ttk::entry]], [syscmd [widget ttk::spinbox]], and [syscmd [widget ttk::combobox]]. + +[subsection {Text widgets}] +In versions of [package Tk] older than [const 8.6.9], the [syscmd [widget text]] widget does not generate [const <>] events in a few "corner cases" in which its selection changes. These omissions can be corrected by changes to the [const Text] bindings, in order to satisfy the second condition of [sectref {Widget requirements}]. + +[para] +In addition, versions of [package Tk] older than [const 8.6.6] process selection events slightly differently from newer versions, and in combination with the [const Text] bindings this confuses [package persistentStore]. If an upgrade to the current version of [const Tcl/Tk] is not feasible, this problem can be resolved by making a slight modification to the widget bindings, in order to satisfy the third condition of [sectref {Widget requirements}]. + +[para] +Either the script should call the command [cmd persistentSelection::fixText] to adjust the [const Text] bindings and the commands that they call; or the widget can use the [const Ntext] binding tag (for [package ntext] version 1.0 or above) instead of the default [const Text] bindtag. + +[para] +In either case, the argument [arg type] supplied to command [cmd persistentSelection::report] should have the value [const text]. + +[subsection {Entry, spinbox, ttk::entry, ttk::spinbox, and ttk::combobox widgets}] +The [syscmd [widget entry]], [syscmd [widget spinbox]], [syscmd [widget ttk::entry]], [syscmd [widget ttk::spinbox]], and [syscmd [widget ttk::combobox]] widgets do not generate a [const <>] event when their selection changes, and therefore require modification. + +[para] +The package [package widgetPlus] provides [package snit] wrappers [syscmd [widget widgetPlus::entryPlus]], [syscmd [widget widgetPlus::spinboxPlus]], [syscmd [widget widgetPlus::ttkEntryPlus]], [syscmd [widget widgetPlus::ttkSpinboxPlus]], and [syscmd [widget widgetPlus::ttkComboboxPlus]] respectively. Each [package widgetPlus] widget generates the required [const <>] events. + +[para] +In all these cases, the argument [arg type] supplied to command [cmd persistentSelection::report] should have the value [const entry]. This argument determines how [package persistentSelection] will inspect the widget's selection, and the commands that do so are the same for all these widgets. + +[subsection {Listbox widgets}] +A similar wrapper has not been created for the [syscmd [widget listbox]] widget, which has the complication of permitting multiple selections. + +[section {TO DO}] + +[list_begin itemized] + +[item] Test on a system with multiple displays. + +[list_end] + +[section BUGS] + +This version of [package persistentSelection] is intended to be compatible with all releases of [package Tk] 8.5 and 8.6, and with the branches [emph core-8-5-branch], [emph core-8-6-branch], [emph revised_text], and [emph trunk] in the source code repository for [package Tk]. Any incompatibility with any of these versions, for any [package Tk] windowing system, should be reported as a bug. Please report such in the category [emph persistentSelection] of the [uri http://core.tcl.tk/tklib/reportlist {Tklib Trackers}]. + +[section EXAMPLES] + +Each example uses [package persistentSelection] to retain the last non-empty value of the selection in certain widgets. Each example also includes the creation of sample widgets. + +[para] + +Monitor all [syscmd [widget entryPlus]] widgets. + +[example { +package require widgetPlus +widgetPlus::entryPlus .ep +pack .ep + +package require persistentSelection +bind EntryPlus <> {::persistentSelection::report entry %W} +}] + + +Monitor all [syscmd [widget text]] widgets that use the default [const Text] bindings. + +[example { +text .t +pack .t + +package require persistentSelection +::persistentSelection::fixText +bind Text <> {::persistentSelection::report text %W} +}] + + +Monitor all [syscmd [widget text]] widgets that use the default [const Text] bindings, and all [syscmd [widget entryPlus]] widgets. + +[example { +text .t +pack .t + +package require widgetPlus +widgetPlus::entryPlus .ep +pack .ep + +package require persistentSelection +::persistentSelection::fixText +bind Text <> {::persistentSelection::report text %W} +bind EntryPlus <> {::persistentSelection::report entry %W} +}] + + +Monitor all [syscmd [widget text]] widgets that use [const Ntext] bindings. + +[example { +text .t +pack .t + +package require ntext +bindtags .t {.t Ntext . all} + +package require persistentSelection +bind Ntext <> {::persistentSelection::report text %W} +}] + + +Monitor a single [syscmd [widget entryPlus]] widget [const .ep] + +[example { +package require widgetPlus +widgetPlus::entryPlus .ep +pack .ep + +package require persistentSelection +bind .ep <> {::persistentSelection::report entry %W} +}] + + +Monitor a single [syscmd [widget text]] widget [const .t] + +[example { +text .t +pack .t + +package require persistentSelection +bind .t <> {::persistentSelection::report text %W} +}] + + +[see_also widgetPlus text ntext bindtags] +[manpage_end] diff --git a/modules/persistentSelection/persistentSelection.tcl b/modules/persistentSelection/persistentSelection.tcl new file mode 100644 index 00000000..e9396588 --- /dev/null +++ b/modules/persistentSelection/persistentSelection.tcl @@ -0,0 +1,904 @@ +# ------------------------------------------------------------------------------ +# FILE: +# persistentSelection.tcl +# +# DESCRIPTION: +# Module to preserve the PRIMARY selection exported by a widget, after +# the user has cancelled the selection (so the widget's sel tag is empty). +# +# LICENCE: +# Copyright (C) 2017-2018 Keith Nash. +# This file is part of Tklib and may be used subject to the terms in +# file license.terms; please note in particular the terms repeated here: +# +# IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY +# FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +# ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY +# DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE +# IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE +# NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +# MODIFICATIONS. +# +# ------------------------------------------------------------------------------ +# 80 columns +# Conventional use of namespace/package names. + +# ------------------------------------------------------------------------------ +# Module persistentSelection +# ------------------------------------------------------------------------------ +# Module to retain a non-empty PRIMARY selection. +# The same persistent store is shared by all windows on the same display. +# A state diagram is provided in an OpenOffice document. +# A manual page exists. +# +# --------------- +# Text widget +# --------------- +# Use with text windows that are bound EITHER to Ntext 1.0b3 or above, +# OR to Text if the command persistentSelection::fixText has been run. +# +# Usage: Bind the persistentSelection::report command to <> +# on text widgets, and supply %W as the 2nd argument. For example: +# +# package require persistentSelection +# bind SomeTag <> {::persistentSelection::report text %W} +# +# --------------- +# Entry widget +# --------------- +# Use only with entryPlus (package widgetPlus) or another suitable wrapper for +# the entry widget. +# - the Tk entry and ttk::entry widgets do not generate the <> events +# that this module needs. +# +# Usage: Bind the persistentSelection::report command to <> +# on entryPlus widgets, and supply %W as the 2nd argument. For example: +# +# package require persistentSelection +# bind SomeTag <> {::persistentSelection::report entry %W} +# +# FIXME - not tested for multiple displays. +# The code uses a separate persistent store for each display. +# ------------------------------------------------------------------------------ + +namespace eval ::persistentSelection { + variable PreviousSelection + variable Stores + variable Active + variable toplevelCount 0 + variable oldTime {} + variable logCount 0 + + # If these values are inconvenient, the caller may change them at any + # time before it uses the selection. + variable toplevelPrefix ._for_persistent_selection + variable textPath ._hidden_persistent_selection + + namespace export fixText getClassicPrimarySel getPrimarySel report +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::CreateStoreFor +# ------------------------------------------------------------------------------ +# Command to create a store for a persistent PRIMARY selection for a display. +# +# Arguments: +# displayOf Tk window path of any window on the display. +# destroyOld (boolean) whether or not to destroy the store (if any) +# previously associated with the display. +# +# Return Value: none +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::CreateStoreFor {displayOf {destroyOld 0}} { + variable PreviousSelection + variable Stores + variable Active + variable toplevelCount + + set screenName [winfo screen $displayOf] + set PreviousSelection($screenName) {} + set Active($screenName) 0 + + if {$screenName eq [winfo screen .]} { + DefineStore ._hidden_persistent_selection . $destroyOld + } else { + # First create and withdraw a toplevel $tl on this display: + set tl ._for_persistent_selection[incr toplevelCount] + if {$destroyOld && [info exists Stores($screenName)]} { + destroy [winfo parent $Stores($screenName)] + } else { + } + toplevel $tl -screen $screenName + wm withdraw $tl + DefineStore $tl._hidden_persistent_selection $displayOf + } + Show + return +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::DefineStore +# ------------------------------------------------------------------------------ +# Command to change the location of the store in the unlikely case that the +# existing value is not acceptable. +# +# There is no need to map the store, or give it any bindtags. +# +# Arguments: +# w Tk window path for the window to be created. +# displayOf Tk window path of any window on the same display. +# destroyOld (boolean) whether or not to destroy the store (if any) +# previously associated with the display. +# +# Return Value: none +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::DefineStore {w {displayOf .} {destroyOld 0}} { + variable Stores + + set screenName [winfo screen $displayOf] + + if {![info exists Stores($screenName)]} { + set Stores($screenName) UNDEFINED + } + + if {$destroyOld} { + destroy $Stores($screenName) + } + + set Stores($screenName) $w + text $Stores($screenName) -bg yellow -fg red + bindtags $Stores($screenName) {} + return +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::GetEntrySelection +# ------------------------------------------------------------------------------ +# Command to get the selection from an entry or ttk::entry widget +# +# Analogous to text widget's "$w get sel.first sel.last" - will return with +# error status if the selection does not exixt. +# +# Arguments: +# w Tk window path of an entry or ttk::entry window +# +# Return Value: the selected text in $w, or error if none +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::GetEntrySelection {w} { + set contents [$w get] + set start [$w index sel.first] + set end [$w index sel.last] + string range $contents $start $end-1 + # N.B. Implicit Return +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::report +# ------------------------------------------------------------------------------ +# Command to retain a non-empty PRIMARY selection. +# The same persistent store is shared by all windows w on the same display. +# +# Usage: Bind this command to <> on text or entryPlus widgets, and +# supply %W as the 2nd argument. +# ------------------------------------------------------------------------------ +# Nothing happens if bound to <> on entry, ttk::entry, because these +# widgets do not support the <> event. +# +# Called (in Kerlin) from KWE/quilt.tcl where it is bound to <> in a +# revision to binding tag Ntext. +# ------------------------------------------------------------------------------ + + +# ------------------------------------------------------------------------------ +# When does the event <> fire on text widget $w? +# When persistentSelection is in use, the events can be: +# ------------------------------------------------------------------------------ +# +# ===== ================ =================== =========== +# Label Tag sel has been Selection ownership Response is +# changed in $w has moved +# ===== ================ =================== =========== +# (1) from non-empty no change ($w) Y1 +# to non-empty +# +# (2) from non-empty no change ($w) N2 +# to empty +# +# (3) from empty no change (not $w) Y2 +# to non-empty +# +# (4a) from non-empty from $w to other AE +# to empty (in this interp) +# +# (4b) from non-empty from $w to other N1 +# to empty (not in this interp) +# +# (5) no change to $w Y1 +# +# (6) no change from $w to the AE +# persistent store +# ===== ================ =================== =========== + +# "Response" is recorded in logs, and is defined by the branch taken in +# proc report. + +# AE - no response because "Another Event is is active" +# Events (4a) and (4b) each report changes similar to those of events +# (2) and (6) combined. +# In (4a) and (4b), ownership of selection has moved from $w, AND as a result +# the sel tag has been changed in $w from non-empty to empty. + +# Notes: +# When persistentSelection is in use, $w never has non-transient ownership of +# the selection when its sel tag is empty, and so does not own the selection in +# event (3). + +proc ::persistentSelection::report {type w} { + variable PreviousSelection + variable Stores + variable Active + variable logCount + + if {![$w cget -exportselection]} { + return + } + + set screenName [winfo screen $w] + + if {![info exists Stores($screenName)]} { + CreateStoreFor $w + } + + # If $w has a selection, set selDat to its value; otherwise set selDat to {} + set selDat {} + if {$type eq "text"} { + catch {set selDat [$w get sel.first sel.last]} + } elseif {$type eq "entry"} { + catch {set selDat [GetEntrySelection $w]} + } else { + } + + set selOwner [selection own -displayof $w] + + set i [incr logCount] + Log "$i Start <> $w with sel {$selDat} and owner {$selOwner}" + + if {$Active($screenName)} { + # In 8.5, <> events are not handled one at a time; all the + # superposed events are unwanted. + Log "$i AE another event is active, ignore event on $w" + } elseif {$::tk_version ne {8.5} && $selOwner eq $Stores($screenName)} { + # In 8.6+, <> events are handled one at a time; the unwanted + # events are distinguished here ... + Log "$i XX PS owns the selection, ignore event on $w" + } elseif {$::tk_version ne {8.5} && $selOwner ne $w} { + # ... and here. + Log "$i YY $w does not own the selection, ignore event on $w" + } else { + set Active($screenName) 1 + # FIXME report errors + catch { + if {$selDat ne {}} { + # Window $w has a selection. + if {$selOwner eq $w} { + Log "$i Y1 $w -- {$selDat} -- {$selOwner}" + # Do not execute "selection own" - $w already owns the + # selection, and executing "selection own" again makes $w + # lose (and therefore clear) and then regain the selection. + } else { + Log "$i Y2 $w -- {$selDat} -- {$selOwner}" + # This clears the selection in the window that has lost + # ownership. Any -command defined here in "selection own" is + # never executed. + selection own $w + } + set PreviousSelection($screenName) $selDat + + # Now cases with empty $selDat + } elseif {$selOwner eq {}} { + # The selection is owned by another process/interpreter. + Log "$i N1 $w -- {$selDat} -- {$selOwner}" + Log "$i Do not set hidden store" + set PreviousSelection($screenName) {} + } else { + # The selection is still owned by this process/interpreter. + + # These operations move ownership of the selection to the + # persistent store for this display, where it stays until + # another selection is made on this display, in any process. + Log "$i N2 $w -- {$selDat} -- {$selOwner}" + Log "$i Set hidden store to $PreviousSelection($screenName)" + Log "$i $Stores($screenName) gained PRIMARY Selection\ + from $selOwner" + + $Stores($screenName) delete 1.0 end + $Stores($screenName) insert end $PreviousSelection($screenName) + $Stores($screenName) tag add sel 1.0 end-1c + selection own -command [list ::persistentSelection::Clear \ + $Stores($screenName)] $Stores($screenName) + set PreviousSelection($screenName) {} + + Show + } + } + set Active($screenName) 0 + } + + Log "$i End <> $w" + return +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::getClassicPrimarySel +# ------------------------------------------------------------------------------ +# Command to return the classic (non-persistent) form of the PRIMARY selection. +# No error if selection does not exist. +# +# Arguments: +# w - (optional) Tk window path - used only for -displayof +# withOthers - (optional, boolean, default false) whether to return the +# selection if it is owned by another process/interpreter. +# +# Return Value: the PRIMARY selection on the display of $w, or {} if none +# ------------------------------------------------------------------------------ +# Now (with revised getPrimarySel) allows out-of-process PRIMARY selection; the +# default is not to do so. +# +# Called (in Kerlin) by KWE/worksheet.tcl in the "Search" operation - to show +# selected text in the search box. +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::getClassicPrimarySel {{w .} {withOthers 0}} { + variable Stores + set screenName [winfo screen $w] + + if {![info exists Stores($screenName)]} { + CreateStoreFor $w + } + + lappend forbidden $Stores($screenName) + if {!$withOthers} { + lappend forbidden {} + } + + if {[selection own -displayof $w] in $forbidden} { + return {} + } else { + return [getPrimarySel $w] + } + # N.B. Multiple Return. +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::getPrimarySel +# ------------------------------------------------------------------------------ +# Command to return the PRIMARY selection. +# No error if selection does not exist. +# +# The Tk command is perfectly valid (and its equivalent is called here), but it +# is designed to raise an error if the selection does not exist. This command +# catches the error and returns the empty string. +# +# Arguments: +# displayOf - (optional) Tk window path - used only for -displayof +# +# Return Value: the PRIMARY selection on the display of $displayOf, +# or {} if none +# ------------------------------------------------------------------------------ +# Previously returned a value only if the selection was owned by this +# interpreter - found by testing ([selection own -displayof $displayOf] ne {}). +# +# Called (in Kerlin) from panels::textbox typemethod RawInsertAfter; if the +# result is non-empty, a new textbox will be created and a <> +# event will be generated there. +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::getPrimarySel {{displayOf .}} { + if {(![catch {GetSelection $displayOf PRIMARY} selectedText]) + } { + # Selection has been copied into selectedText + } else { + set selectedText {} + } + return $selectedText +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::Clear +# ------------------------------------------------------------------------------ +# Command executed when the persistent store $storeValue loses ownership of the +# PRIMARY selection. Deletes the selection in the persistent store. +# +# Movement of ownership is lazy: it will not happen when another window has +# focus, it waits until a selection is made. +# +# Arguments: +# storeValue - Tk window path of the persistent store +# +# Return Value: none +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::Clear {storeValue} { + set selOwner [selection own -displayof $storeValue] + $storeValue delete 1.0 end + + Log "xx $storeValue lost PRIMARY Selection to $selOwner" + Log "xx Set hidden store to {}" + Show + + return +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::GetSelection +# ------------------------------------------------------------------------------ +# This private Tk command ::tk::GetSelection is copied to avoid breakage if Tk +# evolves. +# It is copied without changes except its namespace, and removal from the error +# return of arguments -errorcode {TK SELECTION NONE} +# +# ::tk::GetSelection -- +# This tries to obtain the default selection. On Unix, we first try +# and get a UTF8_STRING, a type supported by modern Unix apps for +# passing Unicode data safely. We fall back on the default STRING +# type otherwise. On Windows, only the STRING type is necessary. +# Arguments: +# w The widget for which the selection will be retrieved. +# Important for the -displayof property. +# sel The source of the selection (PRIMARY or CLIPBOARD) +# Results: +# Returns the selection, or an error if none could be found +# ------------------------------------------------------------------------------ + +if {[tk windowingsystem] ne "win32"} { + proc ::persistentSelection::GetSelection {w {sel PRIMARY}} { + if {[catch { + selection get -displayof $w -selection $sel -type UTF8_STRING + } txt] && [catch { + selection get -displayof $w -selection $sel + } txt]} then { + return -code error \ + "could not find default selection" + } else { + return $txt + } + } +} else { + proc ::persistentSelection::GetSelection {w {sel PRIMARY}} { + if {[catch { + selection get -displayof $w -selection $sel + } txt]} then { + return -code error \ + "could not find default selection" + } else { + return $txt + } + } +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::Log +# ------------------------------------------------------------------------------ +# Command for use in debugging, to log events handled by this module. +# +# If required, this dummy command should be replaced with one that does +# something - see e.g. ::persistentSelection::LogExample +# +# Arguments: +# msg - text to be reported +# +# Return Value: none +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::Log msg { +} + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::Show +# ------------------------------------------------------------------------------ +# Command for use in debugging, to display the contents of the persistent +# storage. +# +# If required, this dummy command should be replaced with one that does +# something - see e.g. ::persistentSelection::ShowExample +# +# Arguments: none +# Return Value: none +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::Show {} { +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::fixText +# ------------------------------------------------------------------------------ +# Command to replace the command ::tk::TextSelectTo with one that is compatible +# with persistentStorage. +# +# First checks that the command is loaded, then examines the end of the +# procedure body and replaces it if possible. If it is not possible, it +# replaces the entire procedure body with a suitable one. +# +# Arguments: none +# Return Value: none +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::fixText {} { +#indent-4 + +# -------------------------------------------------- +# (0) Ensure text.tcl has been sourced. +# -------------------------------------------------- + +catch ::tk::TextSelectTo + +# -------------------------------------------------- +# (1) Fix Bindings: add extra <> events, +# omitted by the widget, to Tk versions < 8.6.9. +# -------------------------------------------------- + +if {![package vsatisfies [package require Tk] 8.6.9-]} { +#indent-4 + +bind Text { + if {[%W cget -state] eq "normal"} { + if {[tk::TextCursorInSelection %W]} { + # When deleting the selection, make this an atomic operation on the Undo + # stack, i.e. separate it from other delete operations on either side. + if {[%W cget -autoseparators]} { + %W edit separator + } else { + } + %W delete sel.first sel.last + if {[%W cget -autoseparators]} { + %W edit separator + } else { + } + # The PRIMARY selection has changed but the widget does + # not generate this event. + event generate %W <> + } elseif {[%W compare end != insert+1i]} { + %W delete insert + } + %W see insert + } +} + +bind Text <> { + if {$tk_strictMotif || ![info exists tk::Priv(mouseMoved)] + || !$tk::Priv(mouseMoved)} { + tk::TextPasteSelection %W %x %y + } +} + +# Add this command for early Tk that do not have it. +proc ::tk::TextCursorInSelection {w} { + expr { + [llength [$w tag ranges sel]] + && [$w compare sel.first <= insert] + && [$w compare sel.last >= insert] + } +} + +proc ::tk::TextPasteSelection {w x y} { + if {[$w cget -state] eq "normal"} { + $w mark set insert [TextClosestGap $w $x $y] + TextInsertSelection $w PRIMARY + focus $w + } + return +} + +proc ::tk_textCut w { + if {![catch {set data [$w get sel.first sel.last]}]} { + clipboard clear -displayof $w + clipboard append -displayof $w $data + + if {([$w cget -state] eq "normal")} { + # make <> an atomic operation on the Undo stack, + # i.e. separate it from other delete operations on either side + # (For older Tk? Check.) disable -autoseparators for the operation. + set oldSeparator [$w cget -autoseparators] + if {$oldSeparator} { + $w configure -autoseparators 0 + $w edit separator + } + + $w delete sel.first sel.last + + if {$oldSeparator} { + $w edit separator + $w configure -autoseparators 1 + } + + # The PRIMARY selection has changed but the widget does + # not generate this event. + event generate $w <> + } + } + return +} + +proc ::tk_textPaste w { + if {[$w cget -state] eq "normal"} { + ::tk::TextInsertSelection $w CLIPBOARD + } + return +} + +proc ::tk::TextInsertSelection {w selection} { + if {[catch {::tk::GetSelection $w $selection} sel]} { + return + } + set oldSeparator [$w cget -autoseparators] + if {$oldSeparator} { + $w configure -autoseparators 0 + $w edit separator + } + + if {([$w tag nextrange sel 1.0 end] ne "")} { + set oldSel [list [$w index sel.first] [$w index sel.last]] + } else { + set oldSel {} + } + + set pos insert + if { ($selection eq "CLIPBOARD") + && ([tk windowingsystem] ne "x11") + && ([$w tag nextrange sel 1.0 end] ne "") + } { + set pos [$w index sel.first] + $w delete sel.first sel.last + } + $w insert $pos $sel + if {$oldSeparator} { + $w edit separator + $w configure -autoseparators 1 + } + + # The PRIMARY selection has changed but the widget does + # not generate this event. + if { ($selection eq "PRIMARY") + && [TextCursorInSelection $w] + } { + event generate $w <> + } + + # The PRIMARY selection has changed but the widget does + # not generate this event. + # The operation doesn't change the value without changing the range, + # so it is enough to consider the range. + # The operation does not mark a selection if none existed before. + if { ($selection eq "CLIPBOARD") + && ($oldSel ne {}) + && ( ([$w tag nextrange sel 1.0 end] eq "") + || ([list [$w index sel.first] [$w index sel.last]] ne $oldSel) + ) + } { + event generate $w <> + } + + return +} + +#indent+4 +} + + +# -------------------------------------------------- +# (2) Rewrite Proc ::tk::TextSelectTo. +# -------------------------------------------------- + +if {![package vsatisfies [package require Tk] 8.6.6-]} { +#indent-4 + + +set replace {if {$Priv(mouseMoved) || ($Priv(selectMode) ne "char")} { + $w mark set insert $cur + $w tag remove sel 1.0 $first + $w tag add sel $first $last + $w tag remove sel $last end + update idletasks + }} + +set needle {if {$Priv(mouseMoved) || ($Priv(selectMode) ne "char")} { + $w tag remove sel 0.0 end + $w mark set insert $cur + $w tag add sel $first $last + $w tag remove sel $last end + update idletasks + }} + +set haystack [info body ::tk::TextSelectTo] + +set srch [string last $needle $haystack] + +if {$srch != -1} { + # There's a match. Now check it is followed only by whitespace, + # and preceded by whitespace that includes a newline. + set last [expr {$srch + [string length $needle] - 1}] + set ndle [string range $haystack $srch $last] + set post [string trim [string range $haystack $last+1 end]] + set pre [string range $haystack 0 $srch-1] + set pres [string trimright $pre] + set diff [string range $pre [string length $pres] end] + if {[string trim $diff] eq {} && [string first \n $diff] != -1} { + # All conditions met. Redefine the function. + set newBody $pre$replace\n\n + proc ::tk::TextSelectTo {w x y {extend 0}} $newBody + return + } +} + +# We're still here. So define a standard proc (from Tk 8.6.8 with the +# code at the end replaced), and forgo any changes made to the proc it +# is replacing. + +proc ::tk::TextSelectTo {w x y {extend 0}} { + variable ::tk::Priv + + set anchorname [tk::TextAnchor $w] + set cur [TextClosestGap $w $x $y] + if {[catch {$w index $anchorname}]} { + $w mark set $anchorname $cur + } + set anchor [$w index $anchorname] + if {[$w compare $cur != $anchor] || (abs($Priv(pressX) - $x) >= 3)} { + set Priv(mouseMoved) 1 + } + switch -- $Priv(selectMode) { + char { + if {[$w compare $cur < $anchorname]} { + set first $cur + set last $anchorname + } else { + set first $anchorname + set last $cur + } + } + word { + # Set initial range based only on the anchor (1 char min width) + if {[$w mark gravity $anchorname] eq "right"} { + set first $anchorname + set last "$anchorname + 1c" + } else { + set first "$anchorname - 1c" + set last $anchorname + } + # Extend range (if necessary) based on the current point + if {[$w compare $cur < $first]} { + set first $cur + } elseif {[$w compare $cur > $last]} { + set last $cur + } + + # Now find word boundaries + set first [TextPrevPos $w "$first + 1c" tcl_wordBreakBefore] + set last [TextNextPos $w "$last - 1c" tcl_wordBreakAfter] + } + line { + # Set initial range based only on the anchor + set first "$anchorname linestart" + set last "$anchorname lineend" + + # Extend range (if necessary) based on the current point + if {[$w compare $cur < $first]} { + set first "$cur linestart" + } elseif {[$w compare $cur > $last]} { + set last "$cur lineend" + } + set first [$w index $first] + set last [$w index "$last + 1c"] + } + } +# if {$Priv(mouseMoved) || ($Priv(selectMode) ne "char")} { +# $w tag remove sel 0.0 end +# $w mark set insert $cur +# $w tag add sel $first $last +# $w tag remove sel $last end +# update idletasks +# } + if {$Priv(mouseMoved) || ($Priv(selectMode) ne "char")} { + $w mark set insert $cur + $w tag remove sel 1.0 $first + $w tag add sel $first $last + $w tag remove sel $last end + update idletasks + } +} + +#indent+4 +} + +return + +#indent+4 +} + + +# These commands are not called by anything, but are examples that the developer +# can call from ::persistentSelection::Log, ::persistentSelection::Show +# for debugging purposes. + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::LogExample +# ------------------------------------------------------------------------------ +# Example logging command. See ::persistentSelection::Log for specs. +# +# If debugging is required, define ::persistentSelection::Log to wrap a command +# like this one. This example requires a text widget $w. +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::LogExample {w level msg} { + variable oldTime + set pattern {^([0-9]*) Start( <> .*$)} + if {$level > 0} { + set newTime [clock milliseconds] + if {$oldTime eq {}} { + set oldTime $newTime + } + + if {$newTime - $oldTime > 200} { + $w insert end \n + } + + $w insert end $msg + $w insert end \n + $w see end-1c + + set oldTime $newTime + } elseif {[regexp -- $pattern $msg all part1 part2]} { + $w insert end $part1$part2 + $w insert end \n + $w see end-1c + } + return +} + + +# ------------------------------------------------------------------------------ +# Proc ::persistentSelection::ShowExample +# ------------------------------------------------------------------------------ +# Example command to show the contents of the persistent storage. +# See ::persistentSelection::Show for specs. +# +# If debugging is required, define ::persistentSelection::Show to wrap a command +# like this one. This example requires a label widget $w. +# ------------------------------------------------------------------------------ + +proc ::persistentSelection::ShowExample {w} { + variable Stores + set msg {} + foreach path [lsort [array names Stores]] { + append msg "Persistent Store for display {$path} holds" + append msg " {[$Stores($path) get 1.0 end-1c]}\n" + } + set msg [string range $msg 0 end-1] + if {$msg eq {}} { + set msg {Persistent Store is empty} + } + $w configure -text $msg + return +} + + +# Older versions of Tk need this to be set in the file. +package provide persistentSelection 1.0b1 diff --git a/modules/persistentSelection/pkgIndex.tcl b/modules/persistentSelection/pkgIndex.tcl new file mode 100644 index 00000000..c18f475f --- /dev/null +++ b/modules/persistentSelection/pkgIndex.tcl @@ -0,0 +1 @@ +package ifneeded persistentSelection 1.0b1 [list source [file join $dir persistentSelection.tcl]] diff --git a/modules/plotchart/ChangeLog b/modules/plotchart/ChangeLog index 5a98d654..aa2129f4 100644 --- a/modules/plotchart/ChangeLog +++ b/modules/plotchart/ChangeLog @@ -1,3 +1,12 @@ +2018-12-27 Arjen Markus + * plotchart.tcl: Add missing method definitions for binding events to log(x)-y, x-log(y) and log(x)-log(y) plots, + as reported by Alexandru + * plotbind.tcl: Apply the patch provided by Alexandru + +2017-09-16 Arjen Markus + * plotchart.man: Added description of the normal plot and associated commands. The implementation was + already available, so no change in version number. + 2017-03-30 Arjen Markus * plotannot.tcl: Correct handling of the -textcolour option for plaintext (reported by Nick Matthews) diff --git a/modules/plotchart/plotbind.tcl b/modules/plotchart/plotbind.tcl index f06e71a9..d6310f8a 100755 --- a/modules/plotchart/plotbind.tcl +++ b/modules/plotchart/plotbind.tcl @@ -20,6 +20,10 @@ proc ::Plotchart::BindPlot {w event cmd} { variable scaling + if {![info exists scaling($w,eventobj)]} { + set scaling($w,eventobj) "" + } + if { $scaling($w,eventobj) == "" } { set pxmin $scaling($w,pxmin) diff --git a/modules/plotchart/plotchart.man b/modules/plotchart/plotchart.man index 99646669..64eec26e 100755 --- a/modules/plotchart/plotchart.man +++ b/modules/plotchart/plotchart.man @@ -294,6 +294,7 @@ Zero or more options - see the XY-plot for more information. [list_end] [para] + [call [cmd ::Plotchart::createPolarPlot] [arg w] [arg radius_data] [arg args]] Create a new polar plot (configuration type: polarplot). @@ -788,6 +789,36 @@ to influence the number of labels along the three sides. [para] +[call [cmd ::Plotchart::createNormalPlot] [arg w] [arg xscale] [arg args]] + +Create a command to draw a normal plot - useful to investigate whether a data set is normally +distributed or not. In that case the data will fall on or near the diagonal. As such, it is a +specialised plotting procedure. +[para] +The details of the plotting procedure have been adopted from the [term qqnorm] in the "R" [term stats] +package and described on Wikipedia. +[para] +As the implementation of this plot type relies on the [term math::statistics] package, it is only +available if that package can be loaded. + +[list_begin arguments] +[arg_def widget w in] +Name of the canvas widget to hold the normal plot. + +[arg_def list xscale in] +A 3-element list containing minimum, maximum and stepsize for the x-axis +in this order. The scaling of the y-axis is determined from that. [emph Important:] the scale +is to be given in terms of the normalised data, that is: 0 represents the mean of the data, +1 one standard deviation away from the mean etc. + +[arg_def list args in] +Zero or more option-value pairs to influence the position and the appearance of the +plot - see the XY-plot for more details. + +[list_end] +[para] + + [call [cmd ::Plotchart::createStatusTimeline] [arg w] [arg xaxis] [arg ylabel] [arg args]] Create a command to draw a so-called status timeline. Its layout is similar to a horizontal @@ -1344,6 +1375,36 @@ Y-coordinate of the new point. [list_end] [para] +For [emph {normal plots}]: + +[list_begin definitions] +[call [cmd \$normalplot] plot [arg series] [arg mean] [arg stdev] [arg data]] + +Plot the data set using the given mean and stanard deviation. +[para] +As you give the mean and standard deviation separately, the plot can be used for several data series +or for adding to an existing data series. + +[list_begin arguments] +[arg_def string series in] +Name of the data series - used to determine the appearance + +[arg_def float mean in] +Assumed mean of the data set. + +[arg_def float stdev in] +Assumed standard deviation of the data set. + +[arg_def list data in] +List of the data comprising the data set +[list_end] + +[call [cmd \$normalplot] diagonal] + +Draw a diagonal line, indicating the ideal normally distributed data set. +[list_end] +[para] + For [emph "xy, x-log y, log-x-y, log-x-log-y plots"] there is the additional command [emph plotlist], which is useful for plotting a large amount of data: diff --git a/modules/plotchart/plotchart.tcl b/modules/plotchart/plotchart.tcl index c9d3c256..5cd26a9d 100755 --- a/modules/plotchart/plotchart.tcl +++ b/modules/plotchart/plotchart.tcl @@ -131,6 +131,8 @@ namespace eval ::Plotchart { set methodProc(xlogyplot,plaintextconfig) ConfigPlainText set methodProc(xlogyplot,canvas) GetCanvas set methodProc(xlogyplot,deletedata) DeleteData + set methodProc(xlogyplot,bindplot) BindPlot + set methodProc(xlogyplot,bindlast) BindLast set methodProc(logxyplot,title) DrawTitle set methodProc(logxyplot,subtitle) DrawSubtitle set methodProc(logxyplot,xtext) DrawXtext @@ -164,6 +166,8 @@ namespace eval ::Plotchart { set methodProc(logxyplot,plaintextconfig) ConfigPlainText set methodProc(logxyplot,canvas) GetCanvas set methodProc(logxyplot,deletedata) DeleteData + set methodProc(logxyplot,bindplot) BindPlot + set methodProc(logxyplot,bindlast) BindLast set methodProc(logxlogyplot,title) DrawTitle set methodProc(logxlogyplot,subtitle) DrawSubtitle set methodProc(logxlogyplot,xtext) DrawXtext @@ -197,6 +201,8 @@ namespace eval ::Plotchart { set methodProc(logxlogyplot,plaintextconfig) ConfigPlainText set methodProc(logxlogyplot,canvas) GetCanvas set methodProc(logxlogyplot,deletedata) DeleteData + set methodProc(logxlogyplot,bindplot) BindPlot + set methodProc(logxlogyplot,bindlast) BindLast set methodProc(piechart,title) DrawTitle set methodProc(piechart,subtitle) DrawSubtitle set methodProc(piechart,plot) DrawPie diff --git a/modules/scrollutil/CHANGES.txt b/modules/scrollutil/CHANGES.txt new file mode 100644 index 00000000..193d1687 --- /dev/null +++ b/modules/scrollutil/CHANGES.txt @@ -0,0 +1,30 @@ +What is new in Scrollutil 1.1? +------------------------------ + +1. Added the scrollsync widget, designed for scrolling several widgets + simultaneously (thanks to Paul Obermeier for his proposal and + testing). + +2. Added two demo scripts for the new scrollsync widget. + +3. The scrollarea widget now supports the "-takefocus" standard option + (thanks to Harald Oehlmann for his proposal). + +4. The scrollarea "setwidget" subcommand now returns the path name of + the previously embedded widget. + +5. The mouse wheel event handling now restricts the search for the + registered scrollable widget container that is an ascendant of the + widget under the pointer to the widget containers within the same + toplevel (thanks to Harald Oehlmann for his valuable feedback). + +6. Several further improvements in the code, demo scripts, and + documentation. + +What was new in Scrollutil 1.0? +------------------------------- + +This is the first release. Thanks to Michael Niehren for discussions on +mouse wheel event handling in scrollable widget containers, as well as +to Paul Obermeier and Thomas Grausgruber for testing the scrollarea +widget. diff --git a/modules/scrollutil/COPYRIGHT.txt b/modules/scrollutil/COPYRIGHT.txt new file mode 100644 index 00000000..6a00e574 --- /dev/null +++ b/modules/scrollutil/COPYRIGHT.txt @@ -0,0 +1,10 @@ +Scrolling utilities package Scrollutil 1.1 +Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) + +This library is free software; you can use, modify, and redistribute it +for any purpose, provided that existing copyright notices are retained +in all copies and that this notice is included verbatim in any +distributions. + +This software is distributed WITHOUT ANY WARRANTY; without even the +implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/modules/scrollutil/ChangeLog b/modules/scrollutil/ChangeLog new file mode 100644 index 00000000..71793d11 --- /dev/null +++ b/modules/scrollutil/ChangeLog @@ -0,0 +1,14 @@ +2019-09-03 Csaba Nemethi + + * doc/scrollutil.html Slightly extended. + +2019-08-31 Csaba Nemethi + + * ../../examples/scrollutil/SyncListboxes.tcl Minor improvements. + + * doc/SyncListboxes.png Updated. + * doc/scrollutil.html + +2019-08-29 Csaba Nemethi + + * Added scrollutil to tklib. diff --git a/modules/scrollutil/README.txt b/modules/scrollutil/README.txt new file mode 100644 index 00000000..3c07df6d --- /dev/null +++ b/modules/scrollutil/README.txt @@ -0,0 +1,105 @@ + The Scrolling Utilities Package Scrollutil + + by + + Csaba Nemethi + + csaba.nemethi@t-online.de + + +What Is Scrollutil? +------------------- + +Scrollutil is a library package for Tcl/Tk versions 8.0 or higher, +written in pure Tcl/Tk code. It contains: + + - the implementation of the "scrollarea" and "scrollsync" mega- + widgets, including a general utility module for mega-widgets; + - commands for user-friendly mouse wheel event handling in scrollable + widget containers like BWidget ScrollableFrame and + iwidgets::scrolledframe. These commands require Tcl/Tk versions 8.4 + or higher on X11 and Mac OS X and Tk 8.6b2 or later on Windows; + - demo scripts illustrating the use of the Scrollutil package in + connection with various scrollable widgets and the above-mentioned + scrollable widget containers; + - a tutorial in HTML format; + - reference pages in HTML format. + +The reason for requiring at least Tk version 8.6b2 on Windows for the +above-mentioned commands for mouse wheel event handling is that in +earlier Tk versions on this platform the mouse wheel events were sent to +the widget having the focus rather than to the one under the pointer. + +How to Get It? +-------------- + +Scrollutil is available for free download from the Web page + + http://www.nemethi.de + +The distribution file is "scrollutil1.1.tar.gz" for UNIX and +"scrollutil1_1.zip" for Windows. These files contain the same +information, except for the additional carriage return character +preceding the linefeed at the end of each line in the text files for +Windows. + +Scrollutil is also included in tklib, which has the address + + http://core.tcl.tk/tklib + +How to Install It? +------------------ + +Install the package as a subdirectory of one of the directories given +by the "auto_path" variable. For example, you can install it as a +directory at the same level as the Tcl and Tk script libraries. The +locations of these library directories are given by the "tcl_library" +and "tk_library" variables, respectively. + +To install Scrollutil on UNIX, "cd" to the desired directory and unpack +the distribution file "scrollutil1.1.tar.gz": + + gunzip -c scrollutil1.1.tar.gz | tar -xf - + +On most UNIX systems this can be replaced with + + tar -zxf scrollutil1.1.tar.gz + +Both commands will create a directory named "scrollutil1.1", with the +subdirectories "demos", "doc", and "scripts". + +On Windows, use WinZip or some other program capable of unpacking the +distribution file "scrollutil1_1.zip" into the directory +"scrollutil1.1", with the subdirectories "demos", "doc", and "scripts". + +How to Use It? +-------------- + +The Scrollutil distribution provides two packages, called Scrollutil and +Scrollutil_tile. The main difference between the two is that +Scrollutil_tile enables the tile-based, theme-specific appearance of +scrollarea widgets; this package requires Tcl/Tk 8.4 or higher and tile +0.6 or higher. It is not possible to use both packages in one and the +same application, because both are implemented in the same "scrollutil" +namespace and provide identical commands. + +To be able to use the commands and variables implemented in the package +Scrollutil, your scripts must contain one of the lines + + package require scrollutil ?version? + package require Scrollutil ?version? + +Likewise, to be able to use the commands and variables implemented in +the package Scrollutil_tile, your scripts must contain one of the lines + + package require scrollutil_tile ?version? + package require Scrollutil_tile ?version? + +Since the packages Scrollutil and Scrollutil_tile are implemented in the +"scrollutil" namespace, you must either import the procedures you need, +or use qualified names like "scrollutil::scrollarea". + +For a detailed description of the commands and variables provided by +Scrollutil and of the examples contained in the "demos" directory, see +the tutorial "scrollutil.html" and the reference pages, all located in +the "doc" directory. diff --git a/modules/scrollutil/doc/ScrollableFrmDemo1.png b/modules/scrollutil/doc/ScrollableFrmDemo1.png new file mode 100644 index 00000000..236c5a1b Binary files /dev/null and b/modules/scrollutil/doc/ScrollableFrmDemo1.png differ diff --git a/modules/scrollutil/doc/ScrollableFrmDemo2.png b/modules/scrollutil/doc/ScrollableFrmDemo2.png new file mode 100644 index 00000000..4480e1a7 Binary files /dev/null and b/modules/scrollutil/doc/ScrollableFrmDemo2.png differ diff --git a/modules/scrollutil/doc/ScrolledTablelist.png b/modules/scrollutil/doc/ScrolledTablelist.png new file mode 100644 index 00000000..f728ff44 Binary files /dev/null and b/modules/scrollutil/doc/ScrolledTablelist.png differ diff --git a/modules/scrollutil/doc/SyncListboxes.png b/modules/scrollutil/doc/SyncListboxes.png new file mode 100644 index 00000000..bea4aef5 Binary files /dev/null and b/modules/scrollutil/doc/SyncListboxes.png differ diff --git a/modules/scrollutil/doc/SyncTablelists.png b/modules/scrollutil/doc/SyncTablelists.png new file mode 100644 index 00000000..1eeae1b9 Binary files /dev/null and b/modules/scrollutil/doc/SyncTablelists.png differ diff --git a/modules/scrollutil/doc/TablelistConfig.png b/modules/scrollutil/doc/TablelistConfig.png new file mode 100644 index 00000000..738534f3 Binary files /dev/null and b/modules/scrollutil/doc/TablelistConfig.png differ diff --git a/modules/scrollutil/doc/index.html b/modules/scrollutil/doc/index.html new file mode 100644 index 00000000..83eaf9cf --- /dev/null +++ b/modules/scrollutil/doc/index.html @@ -0,0 +1,36 @@ + + + The Scrolling Utilities Package Scrollutil 1.1 + + + + + + +
      +

      The Scrolling Utilities Package Scrollutil 1.1

      + +

      by

      + +

      Csaba Nemethi

      + +
      + csaba.nemethi@t-online.de +
      +
      + +
      + +

      Contents

      + +

      Scrollutil Programmer's Guide

      + +

      The scrollutil::scrollarea Command

      + +

      The scrollutil::scrollsync Command

      + +

      Commands for Mouse Wheel Event Handling in + Scrollable Widget Containers

      + + diff --git a/modules/scrollutil/doc/scrollarea.html b/modules/scrollutil/doc/scrollarea.html new file mode 100644 index 00000000..c9d4d7b2 --- /dev/null +++ b/modules/scrollutil/doc/scrollarea.html @@ -0,0 +1,562 @@ + + + The scrollutil::scrollarea Command + + + + + + + + +
      +

      The scrollutil::scrollarea Command

      + +

      For Scrollutil Version 1.1

      + +

      by

      + +

      Csaba Nemethi

      + +
      + csaba.nemethi@t-online.de +
      +
      +
      + +

      Contents

      + + + + +
      + +

      Quick Reference

      + +
      +
      NAME
      + +
      scrollutil::scrollarea – Create and manipulate + scrollarea widgets
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::scrollarea pathName ?options?
      +
      +
      + +
      STANDARD OPTIONS
      + +
      +
      +-background   -highlightbackground  -relief
      +-borderwidth  -highlightcolor
      +-cursor       -highlightthickness
      +
      +
      + +
      WIDGET-SPECIFIC OPTIONS
      + +
      -lockinterval + milliseconds
      + +
      -respectheader + boolean
      + +
      -respecttitlecolumns + boolean
      + +
      -takefocus + 0|1|""|command
      + +
      -xscrollbarmode + static|dynamic|none
      + +
      -yscrollbarmode + static|dynamic|none
      + +
      DESCRIPTION
      + +
      WIDGET COMMAND
      + +
      pathName cget + option
      + +
      pathName configure + ?option? ?value option value ...?
      + +
      pathName setwidget + widget
      + +
      pathName widget
      + +
      BINDINGS
      + +
      KEYWORDS
      + +
      scrollarea, widget, scrollbar
      +
      + +
      +

      Contents     Start page

      +
      +
      + +

      Detailed Reference

      + +
      +
      NAME
      + +
      scrollutil::scrollarea – Create and manipulate + scrollarea widgets
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::scrollarea pathName ?options?
      +
      +
      + +
      STANDARD OPTIONS
      + +
      +
      +-background   -highlightbackground  -relief
      +-borderwidth  -highlightcolor
      +-cursor       -highlightthickness
      +
      +
      + +
      See the options manual entry for details on the standard Tk + widget options.  The -background, + -highlightbackground, + -highlightcolor, and + -highlightthickness options are only supported by the + Scrollutil package, but not by Scrollutil_tile.  They have the same + default values as the options of the same names for Tk frame + widgets.  The default values of the remaining standard options + are:
      + +
      +
      +-borderwidth 1 -cursor "" -relief sunken
      +
      +
      + +
      REMARK:  When configuring the + -borderwidth or -relief option, if + as a result of this action the scrollarea has a positive + -borderwidth value (e.g., the default 1) + and a -relief value other than flat + (e.g., the default sunken), then the + -borderwidth option of the widget embedded into the + scrollarea via the setwidget + subcommand of the associated Tcl command will automatically be set to + 0, provided that the embedded widget supports this + option.
      + +
      WIDGET-SPECIFIC OPTIONS
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -lockinterval
      Database Name: lockInterval
      Database Class: LockInterval
      + +
      +

      Specifies the time interval in milliseconds for which the scrollbars + having the display mode dynamic (see the + -xscrollbarmode and + -yscrollbarmode + options) will be protected from being unmapped after being mapped, in + order to avoid any shimmering effects.  Without this locking + mechanism, under some rare circumstances a dynamic scrollbar could get + mapped and unmapped in an endless loop, thus giving rise to an annoying + and often dangerous flickering effect.  The same problem can arise + due to a too small -lockinterval value.  The + default is 1, which works as expected in the vast majority + of cases.  Should you experience any shimmering in one of your + scrollarea widgets, just set this option for that scrollarea to a + sufficiently large value (e.g., 100).

      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -respectheader
      Database Name: respectHeader
      Database Class: RespectHeader
      + +
      +

      This option is only relevant if the widget embedded into the + scrollarea with the aid of the setwidget subcommand of the associated Tcl + command is a tablelist + and the Tablelist version being used is 6.5 or later.  Its value + must be a boolean specifying whether the vertical scrollbar should + appear below the tablelist widget's header, thus respecting the native + look & feel on Mac OS X Aqua and on many modern Linux systems.  + The default is 1 on the windowing systems + aqua and x11, and + 0 on win32.

      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -respecttitlecolumns
      Database Name: respectTitleColumns
      Database Class: RespectTitleColumns
      + +
      +

      This option is only relevant if the widget embedded into the + scrollarea with the aid of the setwidget subcommand of the associated Tcl + command is a tablelist + and the Tablelist version being used is 6.5 or later.  Its value + must be a boolean specifying whether the horizontal scrollbar should + start to the right of the tablelist widget's non-scrollable title + column area if the value of the -titlecolumns + tablelist option is positive.  The default is 1.

      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -takefocus
      Database Name: takeFocus
      Database Class: TakeFocus
      + +
      +

      This option determines whether the scrollarea 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 scrollarea itself + but the widget embedded into it via the setwidget subcommand of the associated Tcl + command will receive the focus during keyboard traversal with the + standard keys (Tab and Shift-Tab).  The + default is 0, being that a scrollarea is esentially a + frame containing the above-mentioned widget and two scrollbars.

      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -xscrollbarmode
      Database Name: xScrollbarMode
      Database Class: ScrollbarMode
      + +
      +

      Specifies the display mode to be used for the horizontal + scrollbar.  The allowed values are static, + dynamic, and none.  In + static mode the scrollbar is displayed at all + times.  In dynamic mode (which is the default) + the scrollbar is mapped and unmapped as needed.  The display mode + none disables the scrollbar display.

      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -yscrollbarmode
      Database Name: yScrollbarMode
      Database Class: ScrollbarMode
      + +
      +

      Specifies the display mode to be used for the vertical + scrollbar.  The allowed values are static, + dynamic, and none.  In + static mode the scrollbar is displayed at all + times.  In dynamic mode (which is the default) + the scrollbar is mapped and unmapped as needed.  The display mode + none disables the scrollbar display.

      +
      +
      + +
      DESCRIPTION
      + +
      The scrollutil::scrollarea command creates a new + window named pathName and of the class + Scrollarea, and makes it into a scrollarea + widget.  Additional options, described above, may be specified on the + command line or in the option database to configure aspects of the + scrollarea such as its borderwidth, relief, and display mode to be used for + the scrollbars.  The scrollutil::scrollarea + 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.
      + +
      A scrollarea is a mega-widget consisting of a scrollable + widget specified with the aid of the setwidget subcommand of the associated Tcl + command as well as two scrollbars connected with that widget.  These + components are managed within the scrollarea using + grid.  The scrollbars, named + hsb (with  -orient + horizontal)  and vsb (with  + -orient vertical)  are direct children of the + scrollarea.  The display mode of each scrollbar can be + static, dynamic, or + none (see the -xscrollbarmode and -yscrollbarmode configuration + options).  The -takefocus option of both + scrollbars is set to 0.  In the Scrollutil_tile package + the scrollbars are created as tk::scrollbar widgets, except on Mac OS X, + where the native ttk::scrollbar widget of the aqua + theme doesn't look as expected.
      + +
      If the widget embedded into the scrollarea via + setwidget is a tablelist and Tablelist version 6.5 + or later is being used then the scrollarea can also contain siblings of the + tablelist widget above the vertical scrollbar and/or to the left of the + horizontal one, causing the vertical scrollbar to be displayed below the + tablelist's header and/or the horizontal scrollbar to appear to the right + of the tablelist's title column area, depending on the values of the + -respectheader and -respecttitlecolumns configuration + options.
      + +
      WIDGET COMMAND
      + +
      + The scrollutil::scrollarea 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 args determine + the exact behavior of the command.  The following commands are + possible for scrollarea widgets:
      + +
      +
      +
      pathName cget + option
      + +
      Returns the current value of the configuration option given by + option, which may have any of the values accepted + by the scrollutil::scrollarea command.
      + +
      pathName configure + ?option? ?value option value + ...?
      + +
      Queries or modifies the configuration options of the widget.  + If no option is specified, the command returns a + list describing all of the available options for + pathName (see Tk_ConfigureInfo + for information on the format of this list).  If + option is specified with no + value, then the command returns a list describing + the one named option (this list will be identical to the corresponding + sublist of the value returned if no option is + specified).  If one or more + option-value pairs are + specified, then the command modifies the given widget option(s) to have + the given value(s); in this case the return value is an empty + string.  option may have any of the values + accepted by the scrollutil::scrollarea + command.
      + +
      pathName setwidget + widget
      + +
      The widget argument must be the path name of an + existing widget or an empty string.  In the first case, the + command manages the widget to fill the top-left part of the scrollarea + and connects it with the scrollbars by setting its + -xscrollcommand and + -yscrollcommand options to appropriate wrappers for + the set command of the two scrollbars and setting + the -command option of the scrollbars to  + [list widget xview]  and  + [list widget yview],  + respectively.  If widget is an empty string + then the widget passed to the most recent setwidget + invocation (if any) is unmanaged and unconnected from the + scrollbars.  The return value is the argument passed to the + previous successful invocation of this subcommand, or an empty string + if there was no successful setwidget invocation + before.
      + +
      REMARK 1:  If widget is + nonempty and the value of the -xscrollbarmode option is different + from none then widget must be a + horizontally scrollable widget, meaning that it must support the + -xscrollcommand configuration option and the + associated Tcl command must have the xview + subcommand.  Similarly, if widget is nonempty + and the value of the -yscrollbarmode option is different + from none then widget must be a + vertically scrollable widget, meaning that it must support the + -yscrollcommand configuration option and the + associated Tcl command must have the yview + subcommand.  Consequently, if widget is an + entry or ttk::entry then this subcommand will only be successful if the + -yscrollbarmode option was previously set to + none.
      + +
      REMARK 2:  The widget identified by the + widget argument must be a child of the scrollarea + or of one of the latter's ascendants.  This minor restriction is + imposed by the grid geometry manager.
      + +
      REMARK 3:  When the widget whose path name + was passed to setwidget gets destroyed, this + subcommand is automatically invoked with an empty string as + argument.
      + +
      REMARK 4:  This subcommand sets the + -highlightthickness option of + widget to 0 if + widget supports this configuration option.  In + addition, if the scrollarea has a positive + -borderwidth value (e.g., the default + 1) and a -relief value other than + flat (e.g., the default sunken) + then this subcommand sets the -borderwidth option + of widget to 0, provided that + widget supports this option.
      + +
      pathName + widget
      + +
      Returns the argument passed to the most recent successful + invocation of the setwidget subcommand, or an empty string if + there was no successful invocation of that subcommand yet.
      +
      +
      + +
      BINDINGS
      + +
      When a new scrollarea is created, it has no default event bindings: + scrollareas are not intended to be interactive.
      + +
      KEYWORDS
      + +
      scrollarea, widget, scrollbar
      +
      + +
      +

      Contents     Start page

      +
      + + diff --git a/modules/scrollutil/doc/scrollsync.html b/modules/scrollutil/doc/scrollsync.html new file mode 100644 index 00000000..43b9f685 --- /dev/null +++ b/modules/scrollutil/doc/scrollsync.html @@ -0,0 +1,400 @@ + + + The scrollutil::scrollsync Command + + + + + + + + +
      +

      The scrollutil::scrollsync Command

      + +

      For Scrollutil Version 1.1

      + +

      by

      + +

      Csaba Nemethi

      + +
      + csaba.nemethi@t-online.de +
      +
      +
      + +

      Contents

      + + + + +
      + +

      Quick Reference

      + +
      +
      NAME
      + +
      scrollutil::scrollsync – Create and manipulate + scrollsync widgets
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::scrollsync pathName ?options?
      +
      +
      + +
      STANDARD OPTIONS
      + +
      +
      +-background   -highlightbackground  -relief
      +-borderwidth  -highlightcolor       -xscrollcommand
      +-cursor       -highlightthickness   -yscrollcommand
      +
      +
      + +
      WIDGET-SPECIFIC OPTIONS
      + +
      -takefocus + 0|1|""|command
      + +
      DESCRIPTION
      + +
      WIDGET COMMAND
      + +
      pathName cget + option
      + +
      pathName configure + ?option? ?value option value ...?
      + +
      pathName setwidgets + widgetList
      + +
      pathName widgets
      + +
      + pathName xview + ?args? + +
      +
      pathName xview
      + +
      pathName xview moveto + fraction
      + +
      pathName xview scroll number + units|pages
      +
      +
      + +
      + pathName yview + ?args? + +
      +
      pathName yview
      + +
      pathName yview moveto + fraction
      + +
      pathName yview scroll number + units|pages
      +
      +
      + +
      BINDINGS
      + +
      KEYWORDS
      + +
      scrollsync, widget, scrolling
      +
      + +
      +

      Contents     Start page

      +
      +
      + +

      Detailed Reference

      + +
      +
      NAME
      + +
      scrollutil::scrollsync – Create and manipulate + scrollsync widgets
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::scrollsync pathName ?options?
      +
      +
      + +
      STANDARD OPTIONS
      + +
      +
      +-background   -highlightbackground  -relief
      +-borderwidth  -highlightcolor       -xscrollcommand
      +-cursor       -highlightthickness   -yscrollcommand
      +
      +
      + +
      See the options manual entry for details on the standard Tk + widget options.  The -background, + -highlightbackground, + -highlightcolor, and + -highlightthickness options are only supported by the + Scrollutil package, but not by Scrollutil_tile.  They have the same + default values as the options of the same names for Tk frame + widgets.  The default values of the remaining standard options + are:
      + +
      +
      +-borderwidth 0 -cursor "" -relief flat -xscrollcommand "" -yscrollcommand ""
      +
      +
      + +
      WIDGET-SPECIFIC OPTIONS
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -takefocus
      Database Name: takeFocus
      Database Class: TakeFocus
      + +
      +

      This option determines whether the scrollsync 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 scrollsync + widget itself but the first element of the widget list passed to the + setwidgets subcommand of + the associated Tcl command will receive the focus during keyboard + traversal with the standard keys (Tab and + Shift-Tab).  The default is 0, being + that a scrollsync widget is esentially a frame containing the + above-mentioned widgets.

      +
      +
      + +
      DESCRIPTION
      + +
      The scrollutil::scrollsync command creates a new + window named pathName and of the class + Scrollsync, and makes it into a scrollsync + widget.  Additional options, described above, may be specified on the + command line or in the option database to configure aspects of the + scrollsync widget such as its borderwidth and relief.  The + scrollutil::scrollsync 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.
      + +
      A scrollsync is a mega-widget, designed for scrolling + several widgets simultaneously.  It is both horizontally and + vertically scrollable, meaning that it supports the + -xscrollcommand and -yscrollcommand + configuration options and the associated Tcl command has the + xview and yview subcommands.  Whenever the + horizontal/vertical position of the view in the window of one of the + horizontally/vertically scrollable widgets contained in the list passed to + the setwidgets subcommand of + the associated Tcl command changes, the view in the windows of all the + other horizontally/vertically scrollable elements of that list is + automatically adjusted accordingly, thus making sure that the view's + position in these windows is kept in sync.
      + +
      + A scrollsync widget is typically created within a scrollarea, like in the following example: + +
      +
      +set sa [scrollutil::scrollarea ...]
      +set ss [scrollutil::scrollsync $sa.ss]
      +$sa setwidget $ss
      +
      +set lb1 [listbox $ss.lb1 ...]
      +set lb2 [listbox $ss.lb2 ...]
      +$ss setwidgets [list $lb1 $lb2]
      +
      +grid $lb1 $lb2 -sticky news -padx {0 2}
      +grid rowconfigure    $ss 0   -weight 1
      +grid columnconfigure $ss all -weight 1
      +
      +pack $sa -expand yes -fill both
      +
      +
      +
      + +
      WIDGET COMMAND
      + +
      + The scrollutil::scrollsync 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 args determine + the exact behavior of the command.  The following commands are + possible for scrollsync widgets:
      + +
      +
      +
      pathName cget + option
      + +
      Returns the current value of the configuration option given by + option, which may have any of the values accepted + by the scrollutil::scrollsync command.
      + +
      pathName configure + ?option? ?value option value + ...?
      + +
      Queries or modifies the configuration options of the widget.  + If no option is specified, the command returns a + list describing all of the available options for + pathName (see Tk_ConfigureInfo + for information on the format of this list).  If + option is specified with no + value, then the command returns a list describing + the one named option (this list will be identical to the corresponding + sublist of the value returned if no option is + specified).  If one or more + option-value pairs are + specified, then the command modifies the given widget option(s) to have + the given value(s); in this case the return value is an empty + string.  option may have any of the values + accepted by the scrollutil::scrollsync + command.
      + +
      pathName setwidgets + widgetList
      + +
      Sets the widgets in whose windows the view's position is to be kept + in sync.  The widgetList argument must be a + valid list consisting of path names of existing widgets.  Whenever + the horizontal/vertical position of the view in the window of one of + the horizontally/vertically scrollable widgets contained in this list + changes, the view in the windows of all the other + horizontally/vertically scrollable elements of the list will be + automatically adjusted accordingly, thus making sure that the view's + position in these windows is kept in sync.  The return value is + the argument passed to the previous successful invocation of this + subcommand, or an empty list if there was no successful + setwidgets invocation before.
      + +
      REMARK:  When one of the widgets whose path + name is contained in widgetList gets destroyed, + that widget is automatically removed from the internal list of widgets + in whose windows the view's position is kept in sync.
      + +
      pathName + widgets
      + +
      Returns the argument passed to the most recent successful + invocation of the setwidgets subcommand, or an empty list if + there was no successful invocation of that subcommand yet.
      + +
      pathName xview + ?args?
      + +
      pathName xview
      + +
      pathName xview moveto + fraction
      + +
      pathName xview scroll number + units|pages
      + +
      This command passes its arguments to the + xview command of the current master widget for + the x axis and returns the result of that command invocation.  + The master widget for the x axis is the element of the widget list + passed to the setwidgets + subcommand having the smallest relative view width among the + horizontally scrollable widgets in that list, i.e., the least + difference between the last and first elements of the two-element list + returned by its xview command.  This master + widget can vary during program execution (in case of text widgets it + can even change depending on the current vertical view position).
      + +
      pathName yview + ?args?
      + +
      pathName yview
      + +
      pathName yview moveto + fraction
      + +
      pathName yview scroll number + units|pages
      + +
      This command passes its arguments to the + yview command of the current master widget for + the y axis and returns the result of that command invocation.  + The master widget for the y axis is the element of the widget list + passed to the setwidgets + subcommand having the smallest relative view height among the + vertically scrollable widgets in that list, i.e., the least difference + between the last and first elements of the two-element list returned by + its yview command.  This master widget can + vary during program execution.
      +
      +
      + +
      BINDINGS
      + +
      When a new scrollsync widget is created, it has no default event + bindings: scrollsync widgets are not intended to be interactive.
      + +
      KEYWORDS
      + +
      scrollsync, widget, scrolling
      +
      + +
      +

      Contents     Start page

      +
      + + diff --git a/modules/scrollutil/doc/scrollutil.html b/modules/scrollutil/doc/scrollutil.html new file mode 100644 index 00000000..e8f08701 --- /dev/null +++ b/modules/scrollutil/doc/scrollutil.html @@ -0,0 +1,1017 @@ + + + Scrollutil Programmer's Guide + + + + + + + + +
      +

      Scrollutil Programmer's Guide

      + +

      For Scrollutil Version 1.1

      + +

      by

      + +

      Csaba Nemethi

      + +
      + csaba.nemethi@t-online.de +
      +
      +
      + +

      Contents

      + +

      Overview

      + + + +

      Examples

      + + + + +
      + +

      Overview

      + +

      What Is Scrollutil?

      + +

      Scrollutil is a library package for Tcl/Tk versions 8.0 or higher, written + in pure Tcl/Tk code.  It contains:

      + +
        +
      • the implementation of the scrollarea and scrollsync mega-widgets, including a general + utility module for mega-widgets;
      • + +
      • commands for user-friendly mouse wheel event handling in + scrollable widget containers like BWidget ScrollableFrame and + iwidgets::scrolledframe.  These commands require Tcl/Tk versions 8.4 + or higher on X11 and Mac OS X and Tk 8.6b2 or later on Windows;
      • + +
      • demo scripts illustrating the use of the Scrollutil package in + connection with various scrollable widgets and the above-mentioned + scrollable widget containers;
      • + +
      • this tutorial;
      • + +
      • reference pages in HTML format.
      • +
      + +

      The scrollutil::scrollarea mega-widget greatly simplifies the + creation of arbitrary scrolled widgets.  It consists of a scrollable + widget and two scrollbars connected with that widget.  The display mode + of each scrollbar can be static, dynamic, or + none.  This scrolled window implementation also supports + the widgets that are scrollable in one direction only (e.g., entry and + ttk::entry) and respects the header component and title columns of tablelist widgets (this is freely + configurable).

      + +

      The scrollutil::scrollarea widget is similar to BWidget ScrolledWindow and + its snit-based equivalent widget::scrolledwindow, contributed by Jeffrey + Hobbs and contained in tklib.  The snit-based scrodget package by + Aldo Buratti and its TclOO-based equivalent scrolledwidget + contributed by Johann Oberdorfer are further scrolled window implementations. + However, full tablelist support is only provided by the scrollarea + widget, which is free from external dependencies like BWidget, snit, or (for + Tcl 8.5) TclOO.  It is also free from the shimmering + problem in connection with text widgets, which the above-mentioned + scrolled window implementations either share with the autoscroll package + (contained in tklib) or circumvent in a suboptimal way.

      + +

      The scrollutil::scrollsync mega-widget is designed for scrolling + several widgets simultaneously.  Whenever the horizontal/vertical + position of the view in the window of one of its widgets changes, the view in + the windows of all the other widgets is automatically adjusted accordingly, + thus making sure that the view's position in these windows is kept in + sync.  This mega-widget is horizontally and vertically scrollable, hence + it can be embedded into a scrollutil::scrollarea widget.

      + +

      From the point of view of the commands for mouse wheel event + handling provided by the Scrollutil package, the scrollability of a + widget container window means that the associated Tcl command supports + the  xview scroll number units  and  + yview scroll number units  subcommands.  The + reason for requiring at least Tk version 8.6b2 on Windows for these commands + is that in earlier Tk versions on this platform the mouse wheel events were + sent to the widget having the focus rather than to the one under the + pointer.

      + +

      To make use of the user-friendly mouse wheel event handling via the + Scrollutil package, follow the steps below:

      + +
        +
      • Create mouse wheel event bindings for the binding tag + "all" or for the toplevel widgets (including ".") + having scrollable widget containers, by invoking the scrollutil::createWheelEventBindings + command.  In addition, register your scrollable widget containers for + scrolling via these bindings with the aid of the scrollutil::enableScrollingByWheel + command.  The above-mentioned bindings handle the mouse wheel events + by scrolling the registered scrollable widget container that is an + ascendant of the widget under the pointer and is contained in the latter's + toplevel.
      • + +
      • Invoke the scrollutil::adaptWheelEventHandling + command for those widgets contained in registered scrollable widget + containers that have mouse wheel event (class) bindings.  This step + eliminates the annoying and often dangerous double-handling effect, by + modifying the mouse wheel event handling as follows:  If the focus is + on the widget under the pointer then the mouse wheel events will be handled + by the (class bindings of the) widget only, otherwise by the bindings + created with the scrollutil::createWheelEventBindings + command.  Without this step the mouse wheel events would scroll both + the listbox, text, ttk::treeview, or tablelist widget under the pointer + and the widget container to whose descendants the latter belongs, or + they would select the next/previous value in the ttk::combobox or + ttk::spinbox under the pointer in addition to scrolling the widget + container.
      • + +
      • For some widgets it can be desirable to make the focus check + within this modified event handling less restrictive.  For example, if + the widget under the pointer is an entry component of a mentry of type "Date", + "Time", "DateTime", "IPAddr", or + "IPv6Addr" and the focus is on any of its siblings, then the + mouse wheel events sent to this entry should be handled by the mentry + widget rather than scrolling the widget container that is an ascendant of + the mentry.  The scrollutil::setFocusCheckWindow + command covers exactly cases like this.
      • +
      + +

      The mouse wheel event handling with the aid of the Scrollutil package was + also tested to work with the scrolledframe::scrolledframe + command of the Scrolledframe package by Maurice Bredelet (ulis) and its + optimized and enhanced version contributed by Keith Nash, as well as with the + sframe command implemented by Paul Walton.  For details on + these commands see the wiki page

      + +
      +
      + https://wiki.tcl-lang.org/page/A+scrolled+frame +
      +
      + +

      These commands provide further implementations of scrollable widget + containers.

      + +

      How to Get It?

      + +

      Scrollutil is available for free download from the Web page

      + +
      +
      + http://www.nemethi.de +
      +
      + +

      The distribution file is scrollutil1.1.tar.gz for UNIX and + scrollutil1_1.zip for Windows.  These files contain the + same information, except for the additional carriage return character + preceding the linefeed at the end of each line in the text files for + Windows.

      + +

      Scrollutil is also included in tklib, which has the address

      + +
      +
      + http://core.tcl.tk/tklib +
      +
      + +

      How to Install It?

      + +

      Install the package as a subdirectory of one of the directories given by + the auto_path variable.  For example, you can install it as + a directory at the same level as the Tcl and Tk script libraries.  The + locations of these library directories are given by the + tcl_library and tk_library variables, + respectively.

      + +

      To install Scrollutil on UNIX, cd to the desired + directory and unpack the distribution file + scrollutil1.1.tar.gz:

      + +
      +
      +gunzip -c scrollutil1.1.tar.gz | tar -xf -
      +
      +
      + +

      On most UNIX systems this can be replaced with

      + +
      +
      +tar -zxf scrollutil1.1.tar.gz
      +
      +
      + +

      Both commands will create a directory named scrollutil1.1, + with the subdirectories demos, doc, and + scripts.

      + +

      On Windows, use WinZip or some other program capable of unpacking + the distribution file scrollutil1_1.zip into the directory + scrollutil1.1, with the subdirectories demos, + doc, and scripts.

      + +

      Notice that in tklib the Scrollutil demos directory is + replaced with the subdirectory scrollutil of the + examples directory.  Please take this into account when + reading the examples below.

      + +

      How to Use It?

      + +

      The Scrollutil distribution provides two packages, called + Scrollutil and Scrollutil_tile.  The main difference + between the two is that Scrollutil_tile enables the tile-based, + theme-specific appearance of scrollarea widgets; this package requires Tcl/Tk + 8.4 or higher and tile 0.6 or higher.  It is not possible to use both + packages in one and the same application, because both are implemented in the + same scrollutil namespace and provide identical commands.

      + +

      To be able to access the commands and variables defined in the package + Scrollutil, your scripts must contain one of the lines

      + +
      +
      +package require scrollutil ?version?
      +package require Scrollutil ?version?
      +
      +
      + +

      You can use either one of the two statements above because the file + scrollutil.tcl contains both lines

      + +
      +
      +package provide scrollutil ...
      +package provide Scrollutil ...
      +
      +
      + +

      Likewise, to be able to access the commands and variables defined in the + package Scrollutil_tile, your scripts must contain one of the lines

      + +
      +
      +package require scrollutil_tile ?version?
      +package require Scrollutil_tile ?version?
      +
      +
      + +

      Again, you can use either one of the two statements above because the file + scrollutil_tile.tcl contains both lines

      + +
      +
      +package provide scrollutil_tile ...
      +package provide Scrollutil_tile ...
      +
      +
      + +

      You are free to remove one of these two lines from + scrollutil.tcl and scrollutil_tile.tcl, + respectively, if you want to prevent the corresponding packages from making + themselves known under two different names each.  Of course, by doing so + you restrict the argument of  package require  to a + single name.

      + +

      Since the packages Scrollutil and Scrollutil_tile are implemented in the + scrollutil namespace, you must either invoke the

      + +
      +
      +namespace import scrollutil::pattern ?scrollutil::pattern ...?
      +
      +
      + +

      command to import the procedures you need, or use qualified names + like scrollutil::scrollarea.  In the examples below we have chosen the latter approach.

      + +

      To access Scrollutil variables, you must use qualified + names.  There are only three Scrollutil variables that are designed to + be accessed outside the namespace scrollutil:

      + +
        +
      • The variable scrollutil::version holds the current version + number of the Scrollutil package.
      • + +
      • The variable scrollutil::library holds the location of the + Scrollutil installation directory.
      • + +
      • The read-only variable scrollutil::usingTile has the value + 0 in the package Scrollutil and the value 1 in + Scrollutil_tile.
      • +
      + +

      The Scrollutil_tile package checks whether the required Tk and tile + versions are present, by executing the commands

      + +
      +
      +package require Tk 8.4
      +if {$::tk_version < 8.5 || [regexp {^8\.5a[1-5]$} $::tk_patchLevel]} {
      +    package require tile 0.6
      +}
      +
      +
      + +

      The second command above reflects the fact that, beginning with Tk 8.5a6, + tile is integrated into the Tk core and therefore it should only be loaded + explicitly when using an earlier Tk version.

      + +
      +

      Contents     Start page

      +
      +
      + +

      Examples

      + +

      A Scrolled tablelist Widget

      + +

      This example shows how you can greatly simplify the creation of a scrolled + tablelist by using a scrollarea widget.

      + +

      The file ScrolledTablelist1.tcl in the demos + directory creates a horizontally and vertically scrolled tablelist widget + having two header rows and one title column, and manages the two scrollbars + in such a way that the vertical scrollbar appears below the tablelist's + header and the horizontal one starts to the right of the widget's title + column area:

      + +
      + ScrolledTablelist +
      + +

      The script achieves these requirements using traditional scrollbar + management, which is shown below in red color:

      + +
      +
      +package require tablelist_tile 6.3
      +
      +wm title . "Scrolled Tablelist"
      +
      +#
      +# Create the tablelist and the scrollbars as children
      +# of a frame having -borderwidth 1 and -relief sunken
      +#
      +set f   [ttk::frame .f]
      +set frm [ttk::frame $f.frm -borderwidth 1 -relief sunken]
      +set tbl $frm.tbl
      +set vsb $frm.vsb
      +set hsb $frm.hsb
      +tablelist::tablelist $tbl ... -borderwidth 0 \
      +    -xscrollcommand [list $hsb set] -yscrollcommand [list $vsb set]
      +. . .
      +ttk::scrollbar $vsb -orient vertical   -command [list $tbl yview]
      +ttk::scrollbar $hsb -orient horizontal -command [list $tbl xview]
      +
      +. . .
      +
      +#
      +# Manage the widgets within the frame
      +#
      +grid $tbl -row 0 -rowspan 2 -column 0 -columnspan 2 -sticky news
      +if {[tk windowingsystem] eq "win32"} {
      +    grid $vsb -row 0 -rowspan 2 -column 2 -sticky ns
      +} else {
      +    grid [$tbl cornerpath] -row 0 -column 2 -sticky ew
      +    grid $vsb              -row 1 -column 2 -sticky ns
      +}
      +grid [$tbl cornerpath -sw] -row 2 -column 0 -sticky ns
      +grid $hsb                  -row 2 -column 1 -sticky ew
      +grid rowconfigure    $frm 1 -weight 1
      +grid columnconfigure $frm 1 -weight 1
      +
      +#
      +# Manage the frame
      +#
      +pack $frm -expand yes -fill both -padx 10 -pady 10
      +
      +. . .
      +
      +
      + +

      The file ScrolledTablelist2.tcl in the demos + directory replaces the rather technical code above with just a few lines + (shown below in red color), by embedding the tablelist into a + scrollarea widget.  It requires Tablelist version 6.5, which is needed + so the -respectheader and + -respecttitlecolumns + scrollarea options can work as expected (for earlier Tablelist versions these + options are silently ignored).  As a further benefit, the scrollbars + created with this method will have the default display mode + dynamic.

      + +
      +
      +package require tablelist_tile 6.5
      +package require scrollutil_tile
      +
      +wm title . "Scrolled Tablelist"
      +
      +#
      +# Create the tablelist within a scrollarea
      +#
      +set f  [ttk::frame .f]
      +set sa [scrollutil::scrollarea $f.sa]
      +set tbl $sa.tbl
      +tablelist::tablelist $tbl ...
      +. . .
      +$sa setwidget $tbl
      +
      +. . .
      +
      +#
      +# Manage the scrollarea
      +#
      +pack $sa -expand yes -fill both -padx 10 -pady 10
      +
      +. . .
      +
      +
      + +

      Synchronizing Two listbox Widgets

      + +

      The file SyncListboxes.tcl in the demos + directory creates two listboxes within a scrollsync widget, which in turn is embedded into a + scrollarea.

      + +
      + SyncListboxes +
      + +

      Here is the relevant code, in which the lines related to the scrollarea + and scrollsync widgets are shown in red color:

      + +
      +
      +package require scrollutil_tile
      +
      +wm title . "European Countries"
      +
      +. . .
      +
      +set f  [ttk::frame .f]
      +
      +. . .
      +
      +#
      +# Create a scrollsync widget within a scrollarea
      +#
      +set sa [scrollutil::scrollarea $f.sa]
      +set ss [scrollutil::scrollsync $sa.ss]
      +$sa setwidget $ss
      +
      +#
      +# Populate the scrollsync widget with two listboxes
      +#
      +
      +. . .
      +
      +set lb1 [listbox $ss.lb1 -activestyle none -highlightthickness 0 -width 16]
      +set lb2 [listbox $ss.lb2 -activestyle none -highlightthickness 0 -width 16]
      +$ss setwidgets [list $lb1 $lb2]
      +
      +. . .
      +
      +grid $lb1 $lb2 -sticky news -padx {0 2}
      +grid rowconfigure    $ss 0   -weight 1
      +grid columnconfigure $ss all -weight 1
      +
      +. . .
      +
      +pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10}
      +
      +. . .
      +
      +
      + +

      Synchronizing Three tablelist Widgets

      + +

      The file SyncTablelists.tcl in the demos + directory creates three tablelists within a scrollsync widget, which in turn is embedded into a + scrollarea.

      + +
      + SyncTablelists +
      + +

      The relevant code is similar to the one shown in the previous example:

      + +
      +
      +package require tablelist_tile
      +package require scrollutil_tile
      +
      +wm title . "Synchronized Tablelists"
      +
      +. . .
      +
      +set f  [ttk::frame .f]
      +
      +. . .
      +
      +#
      +# Create a scrollsync widget within a scrollarea
      +#
      +set sa [scrollutil::scrollarea $f.sa]
      +set ss [scrollutil::scrollsync $sa.ss]
      +$sa setwidget $ss
      +
      +#
      +# Populate the scrollsync widget with three tablelists
      +#
      +
      +option add *Tablelist.stripeBackground  #f0f0f0
      +
      +for {set n 1; set colWidth 40} {$n <= 3} {incr n; incr colWidth 20} {
      +    set tbl [tablelist::tablelist $ss.tbl$n \
      +             -columns [list 0 "Column 0" left  $colWidth "Column 1" left]]
      +    set tbl$n $tbl
      +
      +    for {set i 0} {$i < 40} {incr i} {
      +        $tbl insert end [list "cell $i,0" "cell $i,1"]
      +    }
      +}
      +$ss setwidgets [list $tbl1 $tbl2 $tbl3]
      +
      +grid $tbl1 $tbl2 $tbl3 -sticky news -padx {0 2}
      +grid rowconfigure    $ss 0   -weight 1
      +grid columnconfigure $ss all -weight 1
      +
      +. . .
      +
      +pack $sa -side top -expand yes -fill both -padx 10 -pady {2 10}
      +
      +. . .
      +
      +
      + +

      Notice that column #1 of the three tablelist widgets is 40, 60, and 80 + characters wide, respectively.  For this reason, when scrolling + horizontally to the right, the left table's view will reach its horizontal + end position first, then that of the midde table, and as last one the view of + the right table.

      + +

      A Script Using a BWidget ScrollableFrame + Widget

      + +

      The file ScrollableFrmDemo1.tcl in the demos + directory creates a BWidget ScrollableFrame embedded into a scrollarea widget, creates mouse wheel event bindings + for the binding tag "all" with the aid of the scrollutil::createWheelEventBindings + command, and invokes the scrollutil::enableScrollingByWheel + command for this ScrollableFrame, thus registering the latter for scrolling + by these bindings.  After that it populates the ScrollableFrame with + ttk::label widgets displaying the names of the European countries, + ttk::combobox widgets for selecting the corresponding capital cities, and + ttk::button widgets of style Toolbutton for the less patient + users, displaying the text "Resolve".

      + +
      + ScrollableFrmDemo1 +
      + +

      Here is the relevant code:

      + +
      +
      +package require Tk 8.5
      +package require BWidget
      +Widget::theme yes
      +package require scrollutil_tile
      +
      +wm title . "European Capitals Quiz"
      +
      +#
      +# Create a ScrollableFrame within a scrollarea
      +#
      +set f  [ttk::frame .f]
      +set sa [scrollutil::scrollarea $f.sa]
      +set sf [ScrollableFrame $sa.sf]
      +$sa setwidget $sf
      +
      +. . .
      +
      +#
      +# Create mouse wheel event bindings for the binding tag "all" and
      +# register the ScrollableFrame for scrolling by these bindings
      +#
      +scrollutil::createWheelEventBindings all
      +scrollutil::enableScrollingByWheel $sf
      +
      +#
      +# Get the content frame and populate it
      +#
      +
      +set cf [$sf getframe]
      +
      +set countryList {
      +    Albania Andorra Austria Belarus Belgium "Bosnia and Herzegovina" Bulgaria
      +    . . .
      +}
      +set capitalList {
      +    Tirana "Andorra la Vella" Vienna Minsk Brussels Sarajevo Sofia
      +    . . .
      +}
      +
      +. . .
      +
      +set capitalList [lsort $capitalList]
      +
      +. . .
      +
      +set row 0
      +foreach country $countryList {
      +    . . .
      +
      +    set w [ttk::combobox $cf.cb$row -state readonly -width 14 \
      +           -values $capitalList]
      +    . . .
      +
      +    #
      +    # Adapt the handling of the mouse wheel events for the ttk::combobox widget
      +    #
      +    scrollutil::adaptWheelEventHandling $w
      +
      +    . . .
      +
      +    incr row
      +}
      +
      +. . .
      +
      +
      + +

      We invoke the scrollutil::adaptWheelEventHandling + command for every ttk::combobox widget, which is needed for a user-friendly + event handling, being that this widget has built-in bindings for the mouse + wheel events.

      + +

      A Script Using an iwidgets::scrolledframe + Widget

      + +

      The file ScrolledFrmDemo1.tcl in the demos + directory creates an iwidgets::scrolledframe widget, creates mouse wheel + event bindings for the binding tag "all" with the aid of the scrollutil::createWheelEventBindings + command, and invokes the scrollutil::enableScrollingByWheel + command for this scrolledframe, thus registering the latter for scrolling by + these bindings.  After that it populates the scrolledframe with the same + widgets as ScrollableFrmDemo1.tcl in the previous example.

      + +

      Here is the relevant code:

      + +
      +
      +package require Tk 8.5
      +if {[catch {package require iwidgets} result1] != 0 &&
      +    [catch {package require Iwidgets} result2] != 0} {
      +    error "$result1; $result2"
      +}
      +source scrolledwidgetPatch.itk                  ;# adds ttk::scrollbar widgets
      +package require scrollutil
      +
      +wm title . "European Capitals Quiz"
      +
      +. . .
      +
      +#
      +# Create a scrolledframe
      +#
      +set f  [ttk::frame .f]
      +set sf [iwidgets::scrolledframe $f.sf -borderwidth 1 -relief sunken \
      +        -scrollmargin 0]
      +. . .
      +
      +#
      +# Create mouse wheel event bindings for the binding tag "all"
      +# and register the scrolledframe for scrolling by these bindings
      +#
      +scrollutil::createWheelEventBindings all
      +scrollutil::enableScrollingByWheel $sf
      +
      +#
      +# Get the content frame and populate it
      +#
      +
      +set cf [$sf childsite]
      +. . .
      +
      +<exactly as in the previous example>
      +
      +. . .
      +
      +
      + +

      A Script Using Two BWidget ScrollableFrame + Widgets

      + +

      The script ScrollableFrmDemo2.tcl in the demos + directory creates a BWidget ScrollableFrame embedded into a scrollarea widget and then sources the + script ScrollableFrmContent.tcl, which populates the + ScrollableFrame with the following widgets:

      + +
        +
      • a series of ttk::label widgets;
      • +
      • a scrolled text widget $txt within a scrollarea;
      • +
      • a scrolled listbox widget $lb within a scrollarea;
      • +
      • a ttk::combobox widget $cb;
      • +
      • a ttk::spinbox widget $sb;
      • +
      • a ttk::entry widget;
      • +
      • a ttk::separator widget;
      • +
      • a mentry widget $me of type "Date";
      • +
      • a scrolled tablelist widget $tbl within a scrollarea;
      • +
      • a scrolled ttk::treeview widget $tv within a + scrollarea.
      • +
      + +

      With the exception of ttk::label, ttk::entry, and ttk::separator, all + these widgets have bult-in mouse wheel event bindings.

      + +
      + ScrollableFrmDemo2 +
      + +

      Here is the relevant code:

      + +
      +
      +package require Tk 8.5.9                        ;# for ttk::spinbox
      +package require BWidget
      +Widget::theme yes
      +package require mentry_tile 3.2                 ;# for mouse wheel support
      +package require tablelist_tile 6.5              ;# for -(x|y)mousewheelwindow
      +                                                ;# and scrollutil::scrollarea
      +package require scrollutil_tile
      +
      +wm title . "Scrollutil Demo"
      +
      +#
      +# Create a ScrollableFrame within a scrollarea
      +#
      +set tf [ttk::frame .tf]
      +set sa [scrollutil::scrollarea $tf.sa]
      +set sf [ScrollableFrame $sa.sf]
      +$sa setwidget $sf
      +
      +. . .
      +
      +#
      +# Get the content frame and populate it
      +#
      +set cf [$sf getframe]
      +source ScrollableFrmContent.tcl
      +
      +
      + +

      And here is the additional stuff related to the mouse wheel events, using + the Scrollutil commands described in the What Is + Scrollutil? section:

      + +
      +
      +#
      +# Create mouse wheel event bindings for the binding tag "all" and
      +# register the ScrollableFrame for scrolling by these bindings
      +#
      +scrollutil::createWheelEventBindings all
      +scrollutil::enableScrollingByWheel $sf
      +
      +#
      +# Adapt the handling of the mouse wheel events for the text, listbox,
      +# ttk::combobox, ttk::spinbox, tablelist, and ttk::treeview widgets, as
      +# well as for the entry components of the mentry widget of type "Date"
      +#
      +set entryList [$me entries]
      +scrollutil::adaptWheelEventHandling $txt $lb $cb $sb $tbl $tv {*}$entryList
      +
      +#
      +# For the entry components of the mentry widget
      +# set the "focus check window" to the mentry
      +#
      +scrollutil::setFocusCheckWindow {*}$entryList $me
      +
      +
      + +

      Notice that we have passed, among others, the tablelist widget to the + scrollutil::adaptWheelEventHandling + command.  This will only work for Tablelist versions 6.4 and later, + because the command handles tablelist widgets by setting their + -xmousewheelwindow and -ymousewheelwindow options + to the path name of the containing toplevel window, and these options were + introduced in Tablelist version 6.4.  (For earlier Tablelist versions + the command silently ignores any tablelist widget passed to it as + argument.)

      + +

      As already mentioned, in the file ScrollableFrmContent.tcl + the scrolled text, listbox, tablelist, and ttk::treeview widgets are created + within scrollarea widgets:

      + +
      +
      +set _sa [scrollutil::scrollarea ...]
      +set txt [text $_sa.txt -font TkFixedFont -width 73]
      +$_sa setwidget $txt
      +grid $_sa ...
      +
      +. . .
      +
      +set _sa [scrollutil::scrollarea ...]
      +set lb [listbox $_sa.lb -width 0]
      +$_sa setwidget $lb
      +grid $_sa ...
      +
      +. . .
      +
      +set _sa [scrollutil::scrollarea ...]
      +set tbl [tablelist::tablelist $_sa.tbl ...]
      +. . .
      +$_sa setwidget $tbl
      +grid $_sa ...
      +
      +. . .
      +
      +set _sa [scrollutil::scrollarea ... -borderwidth 0]
      +set tv [ttk::treeview $_sa.tv ...]
      +. . .
      +$_sa setwidget $tv
      +grid $_sa ...
      +
      +
      + +

      In the case of the text, listbox, and tablelist widgets we use scrollarea + widgets with their default  -borderwidth 1 -relief + sunken  settings, which will cause the setwidget subcommand of the associated + Tcl commands to set the -borderwidth option of the text, + listbox, and tablelist widgets to 0.  On the other hand, + for the ttk::treeview we use a scrollarea widget with  + -borderwidth 0,  because the ttk::treeview has a border of + width 1 and doesn't support the -borderwidth + configuration option.

      + +

      The file ScrollableFrmContent.tcl contains also the + implementation of the procedure configTablelist, associated with + the "Configure Tablelist Widget" button as the value of its + -command option.  This procedure opens a toplevel window + that contains a BWidget ScrollableFrame embedded into a scrollarea widget and invokes the + scrollutil::enableScrollingByWheel + command for this ScrollableFrame, thus registering the latter for scrolling + by the already created mouse wheel event bindings for the binding tag + "all".  After that it populates the ScrollableFrame with + ttk::label, ttk::combobox, ttk::spinbox, ttk::entry, and ttk::checkbutton + widgets used to display and edit the configuration options of the tablelist + widget.  Whenever a ttk::combobox or ttk::spinbox is created, the + scrollutil::adaptWheelEventHandling command is invoked for it, + being that these widgets have built-in bindings for the mouse wheel + events.

      + +
      + TablelistConfig +
      + +

      A Script Using Two iwidgets::scrolledframe + Widgets

      + +

      The script ScrolledFrmDemo2.tcl in the demos + directory creates an iwidgets::scrolledframe widget and then + sources the file ScrolledFrmContent.tcl, which + populates the scrolledframe with the same widgets as + ScrollableFrmContent.tcl in the previous example.

      + +

      Here is the relevant code:

      + +
      +
      +package require Tk 8.5.9                        ;# for ttk::spinbox
      +if {[catch {package require iwidgets} result1] != 0 &&
      +    [catch {package require Iwidgets} result2] != 0} {
      +    error "$result1; $result2"
      +}
      +source scrolledwidgetPatch.itk                  ;# adds ttk::scrollbar widgets
      +package require mentry_tile 3.2                 ;# for mouse wheel support
      +package require tablelist_tile 6.5              ;# for -(x|y)mousewheelwindow
      +                                                ;# and scrollutil::scrollarea
      +package require scrollutil_tile
      +
      +wm title . "Scrollutil Demo"
      +
      +. . .
      +
      +#
      +# Create a scrolledframe
      +#
      +set tf [ttk::frame .tf]
      +set sf [iwidgets::scrolledframe $tf.sf -borderwidth 1 -relief sunken \
      +        -scrollmargin 0]
      +. . .
      +
      +#
      +# Get the content frame and populate it
      +#
      +set cf [$sf childsite]
      +. . .
      +source ScrolledFrmContent.tcl
      +
      +
      + +

      The additional stuff related to the mouse wheel events contains exactly + the same Scrollutil command invocations as the one in the previous + example.

      + +

      The file ScrolledFrmContent.tcl contains also the + implementation of the procedure configTablelist, associated with + the "Configure Tablelist Widget" button as the value of its + -command option.  This procedure opens a toplevel window + that contains an iwidgets::scrolledframe widget and invokes the + scrollutil::enableScrollingByWheel + command for this scrolledframe, thus registering the latter for scrolling by + the already created mouse wheel event bindings for the binding tag + "all".  After that it populates the scrolledframe with + ttk::label, ttk::combobox, ttk::spinbox, ttk::entry, and ttk::checkbutton + widgets used to display and edit the configuration options of the tablelist + widget.  Whenever a ttk::combobox or ttk::spinbox is created, the + scrollutil::adaptWheelEventHandling + command is invoked for it, being that these widgets have built-in bindings + for the mouse wheel events.

      + +

      Again, all this is nearly identical to what we did in the previous + example.

      + +
      +

      Contents     Start page

      +
      + + diff --git a/modules/scrollutil/doc/stylesheet.css b/modules/scrollutil/doc/stylesheet.css new file mode 100644 index 00000000..cb29e28c --- /dev/null +++ b/modules/scrollutil/doc/stylesheet.css @@ -0,0 +1,8 @@ +/* generic class defining a top margin whose height equals the font size */ +.tm {margin-top: 1em} + +/* background and border for the
       tag */
      +pre {background: #F7F7F7; border: silver solid 1px}
      +
      +/* color for the  tag */
      +span {color: #E00000}
      diff --git a/modules/scrollutil/doc/wheelEvent.html b/modules/scrollutil/doc/wheelEvent.html
      new file mode 100644
      index 00000000..9783010e
      --- /dev/null
      +++ b/modules/scrollutil/doc/wheelEvent.html
      @@ -0,0 +1,421 @@
      +
      +
      +  Commands for Mouse Wheel Event Handling in Scrollable Widget
      +  Containers
      +
      +  
      +  
      +
      +  
      +
      +
      +
      +  
      +

      Commands for Mouse Wheel Event Handling
      + in Scrollable Widget Containers

      + +

      For Scrollutil Version 1.1

      + +

      by

      + +

      Csaba Nemethi

      + +
      + csaba.nemethi@t-online.de +
      +
      +
      + +

      Contents

      + + + + +
      + +

      The scrollutil::createWheelEventBindings + Command

      + +
      +
      NAME
      + +
      scrollutil::createWheelEventBindings – Create mouse + wheel event bindings
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::createWheelEventBindings ?tag tag ...?
      +
      +
      + +
      DESCRIPTION
      + +
      Creates mouse wheel event bindings for the specified binding tags such + that if the widget under the pointer is (a descendant of) one of the + scrollable widget containers having the same toplevel as the widget and + registered via scrollutil::enableScrollingByWheel then these + events will trigger a scrolling of that widget container.  Each + tag argument must be all or the + path name of an existing toplevel widget (including ".").
      + +
      REMARK 1:  The reason for restricting the + tag arguments to all and path names + of existing toplevel widgets rather than supporting also tags like + "BwScrollableFrame" (for BWidget ScrollableFrame) or + "Scrolledframe" (for iwidgets::scrolledframe) is that the + mouse wheel events should trigger a scrolling of the widget container under + the pointer not only if the widget under the pointer is the widget + container itself but also if it is a descendant of the latter (remember + that for each window, the path name of its nearest toplevel ancestor and + the tag all are contained in the window's default list + of binding tags).
      + +
      REMARK 2:  The mouse wheel events along the + vertical axis are <MouseWheel> on Windows, + <MouseWheel> and + <Option-MouseWheel> on Mac OS X, and + <MouseWheel>, + <Button-4> and + <Button-5> on X11 (where + <MouseWheel> is not triggered by the X server, + but can be produced using  event generate).  + The mouse wheel events along the horizontal axis are + <Shift-MouseWheel> on Windows, + <Shift-MouseWheel> and + <Shift-Option-MouseWheel> on Mac OS X, and + <Shift-MouseWheel>, + <Shift-Button-4> and + <Shift-Button-5> on X11 (where + <Shift-MouseWheel> is not triggered by the X + server, but can be produced using  event + generate).
      + +
      KEYWORDS
      + +
      mouse wheel event, binding, scrolling, scrollable widget container
      +
      + +
      +

      Contents     Start page

      +
      +
      + +

      The scrollutil::enableScrollingByWheel + Command

      + +
      +
      NAME
      + +
      scrollutil::enableScrollingByWheel – Register + scrollable widget containers for scrolling by the mouse wheel
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::enableScrollingByWheel ?scrollableWidgetContainer scrollableWidgetContainer ...?
      +
      +
      + +
      DESCRIPTION
      + +
      Adds the specified scrollable widget containers to the internal list of + widget containers that are registered for scrolling by the mouse wheel + event bindings created by the scrollutil::createWheelEventBindings command.
      + +
      REMARK:  When a scrollable widget container + whose path name was passed to this command gets destroyed, it is + automatically removed from the above-mentioned internal list of registered + widget containers.
      + +
      KEYWORDS
      + +
      mouse wheel event, binding, scrolling, scrollable widget container
      +
      + +
      +

      Contents     Start page

      +
      +
      + +

      The scrollutil::adaptWheelEventHandling + Command

      + +
      +
      NAME
      + +
      scrollutil::adaptWheelEventHandling – Adapt mouse + wheel event handling
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::adaptWheelEventHandling ?widget widget ...?
      +
      +
      + +
      DESCRIPTION
      + +
      For each widget argument, the command performs the + following actions:
      + +
      +
        +
      • + If widget is the path name of a tablelist widget then it sets + the latter's -xmousewheelwindow and + -ymousewheelwindow options to the path name of + the containing toplevel window, provided that the Tablelist version + is 6.4 or later (for earlier Tablelist versions the command silently + ignores any tablelist widget passed to it as argument).  As a + result, a mouse wheel event over the tablelist's body or edit window + (more precisely, a mouse wheel event sent to any component of the + tablelist having the binding tag TablelistBody or + TablelistEdit) will be handled as follows: + +
          +
        • If the focus is inside the tablelist widget then the event will + scroll the tablelist or its edit window and no further processing + of the event will take place.
        • + +
        • If the focus is outside the tablelist widget then no + scrolling of the tablelist's body or edit window will happen.  + Instead, the event will be redirected to the containing toplevel + window via  event generate.  This in + turn will trigger a scrolling of the widget container that is an + ancestor of widget (if any), provided that the + path name of the containing toplevel widget or the binding tag + all was passed to the scrollutil::createWheelEventBindings + command and this widget container was registered for scrolling via + scrollutil::enableScrollingByWheel.
        • +
        +
      • + +
      • + Otherwise it locates the (first) binding tag that has mouse wheel + event bindings and is different from both the path name of the + containing toplevel window and all.  If the + search for this tag was successful then the command modifies the + widget's list of binding tags by prepending the tag + WheeleventRedir and appending the tag + WheeleventBreak to this binding tag.  As a + result, a mouse wheel event sent to this widget will be handled as + follows: + +
          +
        • If the focus is on or inside the window  + [focusCheckWindow + widget]  then the event will be handled by the + binding script associated with this tag and no further processing + of the event will take place.
        • + +
        • If the focus is outside the window  + [focusCheckWindow widget]  then the + event will be redirected to the containing toplevel window + via  event generate  rather than + being handled by the binding script associated with the + above-mentioned tag.  This in turn will trigger a scrolling of + the widget container that is an ancestor of + widget (if any), provided that the path name of + the containing toplevel widget or the binding tag + all was passed to the scrollutil::createWheelEventBindings + command and this widget container was registered for scrolling via + scrollutil::enableScrollingByWheel.
        • +
        +
      • +
      +
      + +
      REMARK 1:  This command is designed to be + invoked for widgets that have mouse wheel event bindings and are + descendants of a scrollable widget container (although it does no harm if + it is called for other widgets, too).  The Tk and tile widgets having + class bindings for mouse wheel events are: listbox, scrollbar (but not + ttk::scrollbar), text, ttk::combobox, ttk::spinbox, and + ttk::treeview.  Examples of widgets with binding tags other than their + class names that have mouse wheel event bindings are tablelist widgets as + well as the entry components of mentry widgets of type + "Date", "Time", "DateTime", + "IPAddr", and "IPv6Addr" (for Mentry versions 3.2 + and above).
      + +
      REMARK 2:  Invoking this command for widgets + that have mouse wheel event bindings and are descendants of a scrollable + widget container is essential for a user-friendly mouse wheel event + handling in scrollable widget containers.  Without this step the mouse + wheel events would scroll both the listbox, text, ttk::treeview, or + tablelist widget under the pointer and the widget container to whose + descendants the latter belongs, or they would select the next/previous + value in the ttk::combobox or ttk::spinbox under the pointer in addition + to scrolling the widget container.  After invoking this command, + e.g, for a listbox within a scrollable widget container, the mouse wheel + events over this widget will only scroll the listbox if it has the + focus.  Likewise, after invoking the command for a ttk::combobox or + ttk::spinbox within a scrollable widget container, the mouse wheel events + over this widget will only select its next/previous value if it has the + focus.  In both examples, if the focus is outside the widget in + question then the mouse wheel events will scroll the widget container + instead.
      + +
      KEYWORDS
      + +
      mouse wheel event, binding, event handling, scrolling, scrollable + widget container, focus
      +
      + +
      +

      Contents     Start page

      +
      +
      + +

      The + scrollutil::setFocusCheckWindow Command

      + +
      +
      NAME
      + +
      scrollutil::setFocusCheckWindow – Set the "focus + check window"
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::setFocusCheckWindow widget ?widget ...? otherWidget
      +
      +
      + +
      DESCRIPTION
      + +
      For each widget argument, the command sets the + associated "focus check window" to otherWidget.  + This is the window to be used in the binding scripts for the tag + WheeleventRedir instead of the + widget when checking whether the focus is on/inside or outside that + window.  For each widget argument, + otherWidget must be an ancestor of or identical to + widget.
      + +
      REMARK 1:  When a widget whose path name was + passed to this command as one of its widget arguments + gets destroyed, the association between the widget and its "focus check + window" is automatically removed.
      + +
      REMARK 2:  This command comes in handy if for + some widgets you want to make the focus check within the binding scripts + for the tag WheeleventRedir less restrictive.  For + example, if the widget under the pointer is an entry component of a + mentry me + of type "Date", "Time", "DateTime", + "IPAddr", or "IPv6Addr" and the focus is on any + of its siblings, then the mouse wheel events sent to this entry should be + handled by the mentry widget rather than scrolling the widget container + that is an ascendant of the mentry.  You can achieve this by + invoking
      + +
      +
      +
      +set entryList [$me entries]
      +eval scrollutil::adaptWheelEventHandling  $entryList
      +eval scrollutil::setFocusCheckWindow      $entryList [list $me]
      +
      +
      +
      + +
      With Tcl/Tk 8.5 or above, you can use the more compact form
      + +
      +
      +
      +set entryList [$me entries]
      +scrollutil::adaptWheelEventHandling  {*}$entryList
      +scrollutil::setFocusCheckWindow      {*}$entryList $me
      +
      +
      +
      + +
      KEYWORDS
      + +
      binding, focus, "focus check window"
      +
      + +
      +

      Contents     Start page

      +
      +
      + +

      The scrollutil::focusCheckWindow + Command

      + +
      +
      NAME
      + +
      scrollutil::focusCheckWindow – Query the "focus + check window"
      + +
      SYNOPSIS
      + +
      +
      +scrollutil::focusCheckWindow widget
      +
      +
      + +
      DESCRIPTION
      + +
      Returns the path name of the "focus check window" associated with the + widget argument.  This is the window that is used + in the binding scripts for the tag WheeleventRedir instead of the widget when checking + whether the focus is on/inside or outside that window.  If the command + scrollutil::setFocusCheckWindow was not + invoked for widget then the return value is + widget itself.
      + +
      KEYWORDS
      + +
      binding, focus, "focus check window"
      +
      + +
      +

      Contents     Start page

      +
      +
      + + diff --git a/modules/scrollutil/pkgIndex.tcl b/modules/scrollutil/pkgIndex.tcl new file mode 100644 index 00000000..8529d3e5 --- /dev/null +++ b/modules/scrollutil/pkgIndex.tcl @@ -0,0 +1,27 @@ +#============================================================================== +# Scrollutil and Scrollutil_tile package index file. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +# +# Regular packages: +# +package ifneeded scrollutil 1.1 \ + [list source [file join $dir scrollutil.tcl]] +package ifneeded scrollutil_tile 1.1 \ + [list source [file join $dir scrollutil_tile.tcl]] + +# +# Aliases: +# +package ifneeded Scrollutil 1.1 \ + [list package require -exact scrollutil 1.1] +package ifneeded Scrollutil_tile 1.1 \ + [list package require -exact scrollutil_tile 1.1] + +# +# Code common to all packages: +# +package ifneeded scrollutil::common 1.1 \ + [list source [file join $dir scrollutilCommon.tcl]] diff --git a/modules/scrollutil/scripts/mwutil.tcl b/modules/scrollutil/scripts/mwutil.tcl new file mode 100644 index 00000000..5a9d682a --- /dev/null +++ b/modules/scrollutil/scripts/mwutil.tcl @@ -0,0 +1,604 @@ +#============================================================================== +# Contains utility procedures for mega-widgets. +# +# Structure of the module: +# - Namespace initialization +# - Public utility procedures +# +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require Tk 8 + +# +# Namespace initialization +# ======================== +# + +namespace eval mwutil { + # + # Public variables: + # + variable version 2.14 + variable library + if {$::tcl_version >= 8.4} { + set library [file dirname [file normalize [info script]]] + } else { + set library [file dirname [info script]] ;# no "file normalize" yet + } + + # + # Public procedures: + # + namespace export wrongNumArgs getAncestorByClass convEventFields \ + defineKeyNav processTraversal focusNext focusPrev \ + configureWidget fullConfigOpt fullOpt enumOpts \ + configureSubCmd attribSubCmd hasattribSubCmd \ + unsetattribSubCmd getScrollInfo isScrollable hasFocus \ + genMouseWheelEvent windowingSystem currentTheme + + # + # Make modified versions of the procedures tk_focusNext and + # tk_focusPrev, to be invoked in the processTraversal command + # + proc makeFocusProcs {} { + # + # Enforce the evaluation of the Tk library file "focus.tcl" + # + tk_focusNext . + + # + # Build the procedures focusNext and focusPrev + # + foreach dir {Next Prev} { + set procBody [info body tk_focus$dir] + regsub -all {winfo children} $procBody {getChildren $class} procBody + proc focus$dir {w class} $procBody + } + } + makeFocusProcs + + # + # Invoked in the procedures focusNext and focusPrev defined above: + # + proc getChildren {class w} { + if {[string compare [winfo class $w] $class] == 0} { + return {} + } else { + return [winfo children $w] + } + } +} + +# +# Public utility procedures +# ========================= +# + +#------------------------------------------------------------------------------ +# mwutil::wrongNumArgs +# +# Generates a "wrong # args" error message. +#------------------------------------------------------------------------------ +proc mwutil::wrongNumArgs args { + set optList {} + foreach arg $args { + lappend optList \"$arg\" + } + return -code error "wrong # args: should be [enumOpts $optList]" +} + +#------------------------------------------------------------------------------ +# mwutil::getAncestorByClass +# +# Gets the path name of the widget of the specified class from the path name w +# of one of its descendants. It is assumed that all of the ancestors of w +# exist (but w itself needn't exist). +#------------------------------------------------------------------------------ +proc mwutil::getAncestorByClass {w class} { + regexp {^(\..+)\..+$} $w dummy win + while {[string compare [winfo class $win] $class] != 0} { + set win [winfo parent $win] + } + + return $win +} + +#------------------------------------------------------------------------------ +# mwutil::convEventFields +# +# Gets the path name of the widget of the specified class and the x and y +# coordinates relative to the latter from the path name w of one of its +# descendants and from the x and y coordinates relative to the latter. +#------------------------------------------------------------------------------ +proc mwutil::convEventFields {w x y class} { + set win [getAncestorByClass $w $class] + set _x [expr {$x + [winfo rootx $w] - [winfo rootx $win]}] + set _y [expr {$y + [winfo rooty $w] - [winfo rooty $win]}] + + return [list $win $_x $_y] +} + +#------------------------------------------------------------------------------ +# mwutil::defineKeyNav +# +# For a given mega-widget class, the procedure defines the binding tag +# ${class}KeyNav as a partial replacement for "all", by substituting the +# scripts bound to the events , , and <> with new +# ones which propagate these events to the mega-widget of the given class +# containing the widget to which the event was reported. (The event +# was replaced with <> in Tk 8.3.0.) This tag is +# designed to be inserted before "all" in the list of binding tags of a +# descendant of a mega-widget of the specified class. +#------------------------------------------------------------------------------ +proc mwutil::defineKeyNav class { + foreach event { <>} { + bind ${class}KeyNav $event \ + [list mwutil::processTraversal %W $class $event] + } + + bind Entry <> { %W selection range 0 end; %W icursor end } + bind Spinbox <> { %W selection range 0 end; %W icursor end } +} + +#------------------------------------------------------------------------------ +# mwutil::processTraversal +# +# Processes the given traversal event for the mega-widget of the specified +# class containing the widget w if that mega-widget is not the only widget +# receiving the focus during keyboard traversal within its toplevel widget. +#------------------------------------------------------------------------------ +proc mwutil::processTraversal {w class event} { + set win [getAncestorByClass $w $class] + + if {[string compare $event ""] == 0} { + set target [focusNext $win $class] + } else { + set target [focusPrev $win $class] + } + + if {[string compare $target $win] != 0} { + set focusWin [focus -displayof $win] + if {[string length $focusWin] != 0} { + event generate $focusWin <> + } + + focus $target + event generate $target <> + } + + return -code break "" +} + +#------------------------------------------------------------------------------ +# mwutil::configureWidget +# +# Configures the widget win by processing the command-line arguments specified +# in optValPairs and, if the value of initialize is true, also those database +# options that don't match any command-line arguments. +#------------------------------------------------------------------------------ +proc mwutil::configureWidget {win configSpecsName configCmd cgetCmd \ + optValPairs initialize} { + upvar $configSpecsName configSpecs + + # + # Process the command-line arguments + # + set cmdLineOpts {} + set savedOptValPairs {} + set failed 0 + set count [llength $optValPairs] + foreach {opt val} $optValPairs { + if {[catch {fullConfigOpt $opt configSpecs} result] != 0} { + set failed 1 + break + } + if {$count == 1} { + set result "value for \"$opt\" missing" + set failed 1 + break + } + set opt $result + lappend cmdLineOpts $opt + lappend savedOptValPairs $opt [eval $cgetCmd [list $win $opt]] + if {[catch {eval $configCmd [list $win $opt $val]} result] != 0} { + set failed 1 + break + } + incr count -2 + } + + if {$failed} { + # + # Restore the saved values + # + foreach {opt val} $savedOptValPairs { + eval $configCmd [list $win $opt $val] + } + + return -code error $result + } + + if {$initialize} { + # + # Process those configuration options that were not + # given as command-line arguments; use the corresponding + # values from the option database if available + # + foreach opt [lsort [array names configSpecs]] { + if {[llength $configSpecs($opt)] == 1 || + [lsearch -exact $cmdLineOpts $opt] >= 0} { + continue + } + set dbName [lindex $configSpecs($opt) 0] + set dbClass [lindex $configSpecs($opt) 1] + set dbValue [option get $win $dbName $dbClass] + if {[string length $dbValue] == 0} { + set default [lindex $configSpecs($opt) 3] + eval $configCmd [list $win $opt $default] + } else { + if {[catch { + eval $configCmd [list $win $opt $dbValue] + } result] != 0} { + return -code error $result + } + } + } + } + + return "" +} + +#------------------------------------------------------------------------------ +# mwutil::fullConfigOpt +# +# Returns the full configuration option corresponding to the possibly +# abbreviated option opt. +#------------------------------------------------------------------------------ +proc mwutil::fullConfigOpt {opt configSpecsName} { + upvar $configSpecsName configSpecs + + if {[info exists configSpecs($opt)]} { + if {[llength $configSpecs($opt)] == 1} { + return $configSpecs($opt) + } else { + return $opt + } + } + + set optList [lsort [array names configSpecs]] + set count 0 + foreach elem $optList { + if {[string first $opt $elem] == 0} { + incr count + if {$count == 1} { + set option $elem + } else { + break + } + } + } + + if {$count == 1} { + if {[llength $configSpecs($option)] == 1} { + return $configSpecs($option) + } else { + return $option + } + } elseif {$count == 0} { + ### return -code error "unknown option \"$opt\"" + return -code error \ + "bad option \"$opt\": must be [enumOpts $optList]" + } else { + ### return -code error "unknown option \"$opt\"" + return -code error \ + "ambiguous option \"$opt\": must be [enumOpts $optList]" + } +} + +#------------------------------------------------------------------------------ +# mwutil::fullOpt +# +# Returns the full option corresponding to the possibly abbreviated option opt. +#------------------------------------------------------------------------------ +proc mwutil::fullOpt {kind opt optList} { + if {[lsearch -exact $optList $opt] >= 0} { + return $opt + } + + set count 0 + foreach elem $optList { + if {[string first $opt $elem] == 0} { + incr count + if {$count == 1} { + set option $elem + } else { + break + } + } + } + + if {$count == 1} { + return $option + } elseif {$count == 0} { + return -code error \ + "bad $kind \"$opt\": must be [enumOpts $optList]" + } else { + return -code error \ + "ambiguous $kind \"$opt\": must be [enumOpts $optList]" + } +} + +#------------------------------------------------------------------------------ +# mwutil::enumOpts +# +# Returns a string consisting of the elements of the given list, separated by +# commas and spaces. +#------------------------------------------------------------------------------ +proc mwutil::enumOpts optList { + set optCount [llength $optList] + set n 1 + foreach opt $optList { + if {$n == 1} { + set str $opt + } elseif {$n < $optCount} { + append str ", $opt" + } else { + if {$optCount > 2} { + append str "," + } + append str " or $opt" + } + + incr n + } + + return $str +} + +#------------------------------------------------------------------------------ +# mwutil::configureSubCmd +# +# This procedure is invoked to process configuration subcommands. +#------------------------------------------------------------------------------ +proc mwutil::configureSubCmd {win configSpecsName configCmd cgetCmd argList} { + upvar $configSpecsName configSpecs + + set argCount [llength $argList] + if {$argCount > 1} { + # + # Set the specified configuration options to the given values + # + return [configureWidget $win configSpecs $configCmd $cgetCmd $argList 0] + } elseif {$argCount == 1} { + # + # Return the description of the specified configuration option + # + set opt [fullConfigOpt [lindex $argList 0] configSpecs] + set dbName [lindex $configSpecs($opt) 0] + set dbClass [lindex $configSpecs($opt) 1] + set default [lindex $configSpecs($opt) 3] + return [list $opt $dbName $dbClass $default \ + [eval $cgetCmd [list $win $opt]]] + } else { + # + # Return a list describing all available configuration options + # + foreach opt [lsort [array names configSpecs]] { + if {[llength $configSpecs($opt)] == 1} { + set alias $configSpecs($opt) + if {$::tk_version >= 8.1} { + lappend result [list $opt $alias] + } else { + set dbName [lindex $configSpecs($alias) 0] + lappend result [list $opt $dbName] + } + } else { + set dbName [lindex $configSpecs($opt) 0] + set dbClass [lindex $configSpecs($opt) 1] + set default [lindex $configSpecs($opt) 3] + lappend result [list $opt $dbName $dbClass $default \ + [eval $cgetCmd [list $win $opt]]] + } + } + return $result + } +} + +#------------------------------------------------------------------------------ +# mwutil::attribSubCmd +# +# This procedure is invoked to process *attrib subcommands. +#------------------------------------------------------------------------------ +proc mwutil::attribSubCmd {win prefix argList} { + set classNs [string tolower [winfo class $win]] + upvar ::${classNs}::ns${win}::attribs attribs + + set argCount [llength $argList] + if {$argCount > 1} { + # + # Set the specified attributes to the given values + # + if {$argCount % 2 != 0} { + return -code error "value for \"[lindex $argList end]\" missing" + } + foreach {attr val} $argList { + set attribs($prefix-$attr) $val + } + return "" + } elseif {$argCount == 1} { + # + # Return the value of the specified attribute + # + set attr [lindex $argList 0] + set name $prefix-$attr + if {[info exists attribs($name)]} { + return $attribs($name) + } else { + return "" + } + } else { + # + # Return the current list of attribute names and values + # + set len [string length "$prefix-"] + set result {} + foreach name [lsort [array names attribs "$prefix-*"]] { + set attr [string range $name $len end] + lappend result [list $attr $attribs($name)] + } + return $result + } +} + +#------------------------------------------------------------------------------ +# mwutil::hasattribSubCmd +# +# This procedure is invoked to process has*attrib subcommands. +#------------------------------------------------------------------------------ +proc mwutil::hasattribSubCmd {win prefix attr} { + set classNs [string tolower [winfo class $win]] + upvar ::${classNs}::ns${win}::attribs attribs + + return [info exists attribs($prefix-$attr)] +} + +#------------------------------------------------------------------------------ +# mwutil::unsetattribSubCmd +# +# This procedure is invoked to process unset*attrib subcommands. +#------------------------------------------------------------------------------ +proc mwutil::unsetattribSubCmd {win prefix attr} { + set classNs [string tolower [winfo class $win]] + upvar ::${classNs}::ns${win}::attribs attribs + + set name $prefix-$attr + if {[info exists attribs($name)]} { + unset attribs($name) + } + + return "" +} + +#------------------------------------------------------------------------------ +# mwutil::getScrollInfo +# +# Parses a list of arguments of the form "moveto " or "scroll +# units|pages" and returns the corresponding list consisting of two or +# three properly formatted elements. +#------------------------------------------------------------------------------ +proc mwutil::getScrollInfo argList { + set argCount [llength $argList] + set opt [lindex $argList 0] + + if {[string first $opt "moveto"] == 0} { + if {$argCount != 2} { + wrongNumArgs "moveto fraction" + } + + set fraction [lindex $argList 1] + format "%f" $fraction ;# floating-point number check with error message + return [list moveto $fraction] + } elseif {[string first $opt "scroll"] == 0} { + if {$argCount != 3} { + wrongNumArgs "scroll number units|pages" + } + + set number [format "%d" [lindex $argList 1]] + set what [lindex $argList 2] + if {[string first $what "units"] == 0} { + return [list scroll $number units] + } elseif {[string first $what "pages"] == 0} { + return [list scroll $number pages] + } else { + return -code error "bad argument \"$what\": must be units or pages" + } + } else { + return -code error "unknown option \"$opt\": must be moveto or scroll" + } +} + +#------------------------------------------------------------------------------ +# mwutil::isScrollable +# +# Returns a boolean value indicating whether the widget w is scrollable along a +# given axis (x or y). +#------------------------------------------------------------------------------ +proc mwutil::isScrollable {w axis} { + set viewCmd ${axis}view + return [expr { + [catch {$w cget -${axis}scrollcommand}] == 0 && + [catch {$w $viewCmd} view] == 0 && + [catch {$w $viewCmd moveto [lindex $view 0]}] == 0 && + [catch {$w $viewCmd scroll 0 units}] == 0 && + [catch {$w $viewCmd scroll 0 pages}] == 0 + }] +} + +#------------------------------------------------------------------------------ +# mwutil::hasFocus +# +# Returns a boolean value indicating whether the focus window is (a descendant +# of) the widget w and has the same toplevel. +#------------------------------------------------------------------------------ +proc mwutil::hasFocus w { + set focusWin [focus -displayof $w] + return [expr { + [string first $w. $focusWin.] == 0 && + [string compare [winfo toplevel $w] [winfo toplevel $focusWin]] == 0 + }] +} + +#------------------------------------------------------------------------------ +# mwutil::genMouseWheelEvent +# +# Generates a mouse wheel event with the given root coordinates and delta on +# the widget w. +#------------------------------------------------------------------------------ +proc mwutil::genMouseWheelEvent {w event rootX rootY delta} { + set needsFocus [expr {[package vcompare $::tk_patchLevel "8.6b2"] < 0 && + [string compare $::tcl_platform(platform) "windows"] == 0}] + + if {$needsFocus} { + set focusWin [focus -displayof $w] + focus $w + } + + event generate $w $event -rootx $rootX -rooty $rootY -delta $delta + + if {$needsFocus} { + focus $focusWin + } +} + +#------------------------------------------------------------------------------ +# mwutil::windowingSystem +# +# Returns the current windowing system ("x11", "win32", "classic", or "aqua"). +#------------------------------------------------------------------------------ +proc mwutil::windowingSystem {} { + if {[catch {tk windowingsystem} winSys] != 0} { + switch $::tcl_platform(platform) { + unix { set winSys x11 } + windows { set winSys win32 } + macintosh { set winSys classic } + } + } + + return $winSys +} + +#------------------------------------------------------------------------------ +# mwutil::currentTheme +# +# Returns the current tile theme. +#------------------------------------------------------------------------------ +proc mwutil::currentTheme {} { + if {[info exists ::ttk::currentTheme]} { + return $::ttk::currentTheme + } elseif {[info exists ::tile::currentTheme]} { + return $::tile::currentTheme + } else { + return "" + } +} diff --git a/modules/scrollutil/scripts/scrollarea.tcl b/modules/scrollutil/scripts/scrollarea.tcl new file mode 100644 index 00000000..871a78ec --- /dev/null +++ b/modules/scrollutil/scripts/scrollarea.tcl @@ -0,0 +1,871 @@ +#============================================================================== +# Contains the implementation of the scrollarea widget. +# +# Structure of the module: +# - Namespace initialization +# - Private procedure creating the default bindings +# - Public procedure creating a new scrollarea widget +# - Private configuration procedures +# - Private procedures implementing the scrollarea widget command +# - Private callback procedures +# - Private procedures used in bindings +# - Private utility procedures +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +# +# Namespace initialization +# ======================== +# + +namespace eval scrollutil::sa { + # + # Get the current windowing system ("x11", "win32", "classic", or "aqua") + # + variable winSys [mwutil::windowingSystem] + + # + # The array configSpecs is used to handle configuration options. The names + # of its elements are the configuration options for the Scrollarea class. + # The value of an array element is either an alias name or a list + # containing the database name and class as well as an indicator specifying + # the widget to which the option applies: f stands for the frame and w for + # the scrollarea widget itself. + # + # Command-Line Name {Database Name Database Class W} + # ------------------------------------------------------------------------ + # + variable configSpecs + array set configSpecs { + -background {background Background f} + -bg -background + -borderwidth {borderWidth BorderWidth f} + -bd -borderwidth + -cursor {cursor Cursor f} + -highlightbackground {highlightBackground HighlightBackground f} + -highlightcolor {highlightColor HighlightColor f} + -highlightthickness {highlightThickness HighlightThickness f} + -lockinterval {lockInterval LockInterval w} + -relief {relief Relief f} + -respectheader {respectHeader RespectHeader w} + -respecttitlecolumns {respectTitleColumns RespectTitleColumns w} + -takefocus {takeFocus TakeFocus f} + -xscrollbarmode {xScrollbarMode ScrollbarMode w} + -yscrollbarmode {yScrollbarMode ScrollbarMode w} + } + + # + # Extend the elements of the array configSpecs + # + proc extendConfigSpecs {} { + variable ::scrollutil::usingTile + variable configSpecs + variable winSys + + if {$usingTile} { + foreach opt {-background -bg -highlightbackground -highlightcolor + -highlightthickness} { + unset configSpecs($opt) + } + } else { + set helpFrm .__helpFrm + for {set n 2} {[winfo exists $helpFrm]} {incr n} { + set helpFrm .__helpFrm$n + } + tk::frame $helpFrm + foreach opt {-background -highlightbackground -highlightcolor + -highlightthickness} { + set configSet [$helpFrm configure $opt] + lappend configSpecs($opt) [lindex $configSet 3] + } + destroy $helpFrm + } + + lappend configSpecs(-borderwidth) 1 + lappend configSpecs(-cursor) "" + lappend configSpecs(-lockinterval) 1 + lappend configSpecs(-relief) sunken + lappend configSpecs(-respectheader) \ + [expr {[string compare $winSys "win32"] != 0}] + lappend configSpecs(-respecttitlecolumns) 1 + lappend configSpecs(-takefocus) 0 + lappend configSpecs(-xscrollbarmode) dynamic + lappend configSpecs(-yscrollbarmode) dynamic + } + extendConfigSpecs + + variable configOpts [lsort [array names configSpecs]] + + # + # Use a list to facilitate the handling of the command options + # + variable cmdOpts [list cget configure setwidget widget] + + # + # Use a list to facilitate the handling of the + # -xscrollbarmode and -yscrollbarmode options + # + variable scrollbarModes [list static dynamic none] +} + +# +# Private procedure creating the default bindings +# =============================================== +# + +#------------------------------------------------------------------------------ +# scrollutil::sa::createBindings +# +# Creates the default bindings for the binding tags Scrollarea and +# WidgetOfScrollarea. +#------------------------------------------------------------------------------ +proc scrollutil::sa::createBindings {} { + bind Scrollarea continue + bind Scrollarea { + if {[string compare [focus -lastfor %W] %W] == 0} { + focus [%W widget] + } + } + bind Scrollarea { scrollutil::sa::onScrollareaConfigure %W } + bind Scrollarea { scrollutil::sa::onScrollareaDestroy %W } + bind DynamicHScrollbar { scrollutil::sa::onDynamicHScrollbarMap %W } + + bind WidgetOfScrollarea { + scrollutil::sa::onWidgetOfScrollareaDestroy %W + } +} + +# +# Public procedure creating a new scrollarea widget +# ================================================= +# + +#------------------------------------------------------------------------------ +# scrollutil::scrollarea +# +# Creates a new scrollarea widget whose name is specified as the first command- +# line argument, and configures it according to the options and their values +# given on the command line. Returns the name of the newly created widget. +#------------------------------------------------------------------------------ +proc scrollutil::scrollarea args { + variable usingTile + variable sa::configSpecs + variable sa::configOpts + variable sa::winSys + + if {[llength $args] == 0} { + mwutil::wrongNumArgs "scrollarea pathName ?options?" + } + + # + # Create a frame of the class Scrollarea + # + set win [lindex $args 0] + if {[catch { + if {$usingTile} { + ttk::frame $win -class Scrollarea -padding 0 + } else { + tk::frame $win -class Scrollarea -container 0 + catch {$win configure -padx 0 -pady 0} + } + $win configure -height 0 -width 0 + } result] != 0} { + return -code error $result + } + + # + # Create a namespace within the current one to hold the data of the widget + # + namespace eval ns$win { + # + # The folowing array holds various data for this widget + # + variable data + array set data { + hsbManaged 0 + vsbManaged 0 + hsbLocked 0 + vsbLocked 0 + widget "" + cf-ne "" + cf-sw "" + cf-ne_height 1 + cf-sw_width 1 + } + } + + # + # Initialize some further components of data + # + upvar ::scrollutil::ns${win}::data data + foreach opt $configOpts { + set data($opt) [lindex $configSpecs($opt) 3] + } + + # + # Create two scrollbars as children of the frame + # + set hsb $win.hsb + set vsb $win.vsb + if {$usingTile && [string compare $winSys "aqua"] != 0} { + ttk::scrollbar $hsb -orient horizontal + ttk::scrollbar $vsb -orient vertical + } else { + tk::scrollbar $hsb -orient horizontal -highlightthickness 0 + tk::scrollbar $vsb -orient vertical -highlightthickness 0 + } + $hsb configure -takefocus 0 + $vsb configure -takefocus 0 + + # + # Make sure that the scrollbars won't use the old command syntax + # + $hsb set 0 1 + $vsb set 0 1 + + grid rowconfigure $win 1 -weight 1 + grid columnconfigure $win 1 -weight 1 + + # + # Configure the widget according to the command-line + # arguments and to the available database options + # + if {[catch { + mwutil::configureWidget $win configSpecs scrollutil::sa::doConfig \ + scrollutil::sa::doCget [lrange $args 1 end] 1 + } result] != 0} { + destroy $win + return -code error $result + } + + # + # Move the original widget command into the namespace sa within the current + # one and create an alias of the original name for a new widget procedure + # + rename ::$win sa::$win + interp alias {} ::$win {} scrollutil::sa::scrollareaWidgetCmd $win + + return $win +} + +# +# Private configuration procedures +# ================================ +# + +#------------------------------------------------------------------------------ +# scrollutil::sa::doConfig +# +# Applies the value val of the configuration option opt to the scrollarea +# widget win. +#------------------------------------------------------------------------------ +proc scrollutil::sa::doConfig {win opt val} { + variable configSpecs + upvar ::scrollutil::ns${win}::data data + + # + # Apply the value to the widget corresponding to the given option + # + switch [lindex $configSpecs($opt) 2] { + f { + # + # Apply the value to the frame and save the + # properly formatted value of val in data($opt) + # + $win configure $opt $val + set data($opt) [$win cget $opt] + + switch -- $opt { + -borderwidth - + -relief { + if {[winfo exists $data(widget)] && + [winfo pixels $win $data(-borderwidth)] > 0 && + [string compare $data(-relief) "flat"] != 0} { + catch {::$data(widget) configure -borderwidth 0} + } + } + } + } + + w { + switch -- $opt { + -lockinterval { + set val [format "%d" $val] ;# integer check with error msg + if {$val < 0} { + set val 0 + } + set data($opt) $val + } + -respectheader { + set data($opt) [expr {$val ? 1 : 0}] + + if {$data(vsbManaged)} { + showVScrollbar $win 1 + } + } + -respecttitlecolumns { + set data($opt) [expr {$val ? 1 : 0}] + + if {$data(hsbManaged)} { + showHScrollbar $win 1 + } + } + -xscrollbarmode { + variable scrollbarModes + set val \ + [mwutil::fullOpt "scrollbar mode" $val $scrollbarModes] + if {[string compare $val "none"] != 0 && + [winfo exists $data(widget)]} { + if {![mwutil::isScrollable $data(widget) x]} { + return -code error "\"$data(widget)\" fails to\ + support horizontal scrolling" + } + } + set data($opt) $val + + set tagList [bindtags $win.hsb] + set idx [lsearch -exact $tagList "DynamicHScrollbar"] + if {[string compare $val "dynamic"] == 0} { + if {$idx < 0} { + bindtags $win.hsb \ + [linsert $tagList 1 DynamicHScrollbar] + } + } else { + bindtags $win.hsb [lreplace $tagList $idx $idx] + } + + switch $val { + static { showHScrollbar $win } + dynamic { + eval setHScrollbar [list $win] [$win.hsb get] + } + none { hideHScrollbar $win } + } + } + -yscrollbarmode { + variable scrollbarModes + set val \ + [mwutil::fullOpt "scrollbar mode" $val $scrollbarModes] + if {[string compare $val "none"] != 0 && + [winfo exists $data(widget)]} { + if {![mwutil::isScrollable $data(widget) y]} { + return -code error "\"$data(widget)\" fails to\ + support vertical scrolling" + } + } + set data($opt) $val + + switch $val { + static { showVScrollbar $win } + dynamic { + eval setVScrollbar [list $win] [$win.vsb get] + } + none { hideVScrollbar $win } + } + } + } + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::doCget +# +# Returns the value of the configuration option opt for the scrollarea widget +# win. +#------------------------------------------------------------------------------ +proc scrollutil::sa::doCget {win opt} { + upvar ::scrollutil::ns${win}::data data + return $data($opt) +} + +# +# Private procedures implementing the scrollarea widget command +# ============================================================= +# + +#------------------------------------------------------------------------------ +# scrollutil::sa::scrollareaWidgetCmd +# +# Processes the Tcl command corresponding to a scrollarea widget. +#------------------------------------------------------------------------------ +proc scrollutil::sa::scrollareaWidgetCmd {win args} { + set argCount [llength $args] + if {$argCount == 0} { + mwutil::wrongNumArgs "$win option ?arg arg ...?" + } + + variable cmdOpts + set cmd [mwutil::fullOpt "option" [lindex $args 0] $cmdOpts] + switch $cmd { + cget { + if {$argCount != 2} { + mwutil::wrongNumArgs "$win $cmd option" + } + + # + # Return the value of the specified configuration option + # + upvar ::scrollutil::ns${win}::data data + variable configSpecs + set opt [mwutil::fullConfigOpt [lindex $args 1] configSpecs] + return $data($opt) + } + + configure { + variable configSpecs + return [mwutil::configureSubCmd $win configSpecs \ + scrollutil::sa::doConfig scrollutil::sa::doCget \ + [lrange $args 1 end]] + } + + setwidget { + if {$argCount != 2} { + mwutil::wrongNumArgs "$win $cmd widget" + } + + return [setwidgetSubCmd $win [lindex $args 1]] + } + + widget { + if {$argCount != 1} { + mwutil::wrongNumArgs "$win $cmd" + } + + upvar ::scrollutil::ns${win}::data data + return $data(widget) + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::setwidgetSubCmd +# +# Processes the scrollarea setwidget subcommmand. +#------------------------------------------------------------------------------ +proc scrollutil::sa::setwidgetSubCmd {win widget} { + variable scrollareaArr + upvar ::scrollutil::ns${win}::data data + + if {[winfo exists $widget]} { + if {[string compare $data(-xscrollbarmode) "none"] != 0} { + if {![mwutil::isScrollable $widget x]} { + return -code error "\"$widget\" fails to support horizontal\ + scrolling" + } + } + + if {[string compare $data(-yscrollbarmode) "none"] != 0} { + if {![mwutil::isScrollable $widget y]} { + return -code error "\"$widget\" fails to support vertical\ + scrolling" + } + } + } elseif {[string length $widget] != 0} { + return -code error "bad window path name \"$widget\"" + } + + set oldWidget $data(widget) + if {[string compare $widget $oldWidget] == 0} { + return $oldWidget + } + + if {[winfo exists $oldWidget]} { + grid forget $oldWidget + if {[string compare [winfo class $oldWidget] "Tablelist"] == 0 && + [package vcompare $::tablelist::version "6.5"] >= 0} { + grid forget $data(cf-ne) $data(cf-sw) + bind $oldWidget <> "" + bind $oldWidget <> "" + } + + catch {::$oldWidget configure -xscrollcommand ""} + catch {::$oldWidget configure -yscrollcommand ""} + + set tagList [bindtags $oldWidget] + set idx [lsearch -exact $tagList "WidgetOfScrollarea"] + bindtags $oldWidget [lreplace $tagList $idx $idx] + + if {[info exists scrollareaArr($oldWidget)]} { + unset scrollareaArr($oldWidget) + } + } + + setHScrollbar $win 0 1 + setVScrollbar $win 0 1 + + $win.hsb configure -command "" + $win.vsb configure -command "" + + array set data { + cf-ne "" + cf-sw "" + cf-ne_height 1 + cf-sw_width 1 + } + + if {[string length $widget] == 0} { + set data(widget) "" + return $oldWidget + } + + grid $widget -in $win -row 0 -rowspan 2 -column 0 -columnspan 2 -sticky news + raise $widget + + catch {::$widget configure -highlightthickness 0} + if {[winfo pixels $win $data(-borderwidth)] > 0 && + [string compare $data(-relief) "flat"] != 0} { + catch {::$widget configure -borderwidth 0} + } + if {[string compare $data(-xscrollbarmode) "none"] != 0} { + ::$widget configure -xscrollcommand \ + [list scrollutil::sa::setHScrollbar $win] + $win.hsb configure -command [list $widget xview] + } + if {[string compare $data(-yscrollbarmode) "none"] != 0} { + ::$widget configure -yscrollcommand \ + [list scrollutil::sa::setVScrollbar $win] + $win.vsb configure -command [list $widget yview] + } + if {[string compare [winfo class $widget] "Tablelist"] == 0 && + [package vcompare $::tablelist::version "6.5"] >= 0} { + set data(cf-ne) [::$widget cornerpath -ne] + set data(cf-sw) [::$widget cornerpath -sw] + + bind $widget <> { + scrollutil::sa::onHeaderHeightChanged %W + } + bind $widget <> { + scrollutil::sa::onTitleColsWidthChanged %W + } + onHeaderHeightChanged $widget + onTitleColsWidthChanged $widget + } + + set tagList [bindtags $widget] + set idx [lsearch -exact $tagList "WidgetOfScrollarea"] + if {$idx < 0} { + bindtags $widget [linsert $tagList 1 WidgetOfScrollarea] + } + + set scrollareaArr($widget) $win + + set data(widget) $widget + return $oldWidget +} + +# +# Private callback procedures +# =========================== +# + +#------------------------------------------------------------------------------ +# scrollutil::sa::setHScrollbar +# +# Wrapper for the set subcommand of the Tcl command associated with the +# horizontal scrollbar of the scrollarea widget win. +#------------------------------------------------------------------------------ +proc scrollutil::sa::setHScrollbar {win first last} { + upvar ::scrollutil::ns${win}::data data + $win.hsb set $first $last + + if {[string compare $data(-xscrollbarmode) "dynamic"] == 0} { + if {$first == 0 && $last == 1} { + hideHScrollbar $win + } elseif {[winfo width $data(widget)] > 1} { + showHScrollbar $win + } + } + + updateVScrollbar $win +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::setVScrollbar +# +# Wrapper for the set subcommand of the Tcl command associated with the +# vertical scrollbar of the scrollarea widget win. +#------------------------------------------------------------------------------ +proc scrollutil::sa::setVScrollbar {win first last} { + upvar ::scrollutil::ns${win}::data data + $win.vsb set $first $last + + if {[string compare $data(-yscrollbarmode) "dynamic"] == 0} { + if {$first == 0 && $last == 1} { + hideVScrollbar $win + } elseif {[winfo height $data(widget)] > 1} { + showVScrollbar $win + } + } + + updateHScrollbar $win +} + +# +# Private procedures used in bindings +# =================================== +# + +#------------------------------------------------------------------------------ +# scrollutil::sa::onScrollareaConfigure +#------------------------------------------------------------------------------ +proc scrollutil::sa::onScrollareaConfigure win { + upvar ::scrollutil::ns${win}::data data + set delay $data(-lockinterval) + if {$delay > 1} { + incr delay 50 + } + + after $delay [list scrollutil::sa::updateScrollbars $win] +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::updateScrollbars +#------------------------------------------------------------------------------ +proc scrollutil::sa::updateScrollbars win { + if {[winfo exists $win] && + [string compare [winfo class $win] "Scrollarea"] == 0} { + updateHScrollbar $win + updateVScrollbar $win + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::onScrollareaDestroy +#------------------------------------------------------------------------------ +proc scrollutil::sa::onScrollareaDestroy win { + namespace delete ::scrollutil::ns$win + catch {rename ::$win ""} +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::onDynamicHScrollbarMap +#------------------------------------------------------------------------------ +proc scrollutil::sa::onDynamicHScrollbarMap hsb { + set top [winfo toplevel $hsb] + if {![winfo ismapped $top]} { + return "" + } + + foreach {first last} [$hsb get] {} + if {$first == 0 && $last == 1} { + return "" + } + + set textWidgetFound 0 + set sa [winfo parent $hsb] + set widget [::$sa widget] + set class [winfo class $widget] + if {[string compare $class "Text"] == 0 || + [string compare $class "Ctext"] == 0} { + set textWidgetFound 1 + } elseif {[string compare $class "Scrollsync"] == 0} { + foreach w [::$widget widgets] { + set class [winfo class $w] + if {[string compare $class "Text"] == 0 || + [string compare $class "Ctext"] == 0} { + set textWidgetFound 1 + break + } + } + } + if {!$textWidgetFound} { + return "" + } + + # + # Guard against a potential endless loop by making sure that + # showing the horizontal scrollbar won't make the toplevel higher + # + set height [winfo height $top] + set geom [wm geometry $top] + update idletasks + if {[winfo height $top] > $height} { + wm geometry $top $geom + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::onWidgetOfScrollareaDestroy +#------------------------------------------------------------------------------ +proc scrollutil::sa::onWidgetOfScrollareaDestroy widget { + variable scrollareaArr + set win $scrollareaArr($widget) + unset scrollareaArr($widget) + + if {[winfo exists $win] && + [string compare [winfo class $win] "Scrollarea"] == 0} { + ::$win setwidget "" + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::onHeaderHeightChanged +#------------------------------------------------------------------------------ +proc scrollutil::sa::onHeaderHeightChanged tbl { + set win [lindex [grid info $tbl] 1] + upvar ::scrollutil::ns${win}::data data + + set newHeight [winfo reqheight $data(cf-ne)] + set oldHeight $data(cf-ne_height) + set data(cf-ne_height) $newHeight + + if {($oldHeight == 1 && $newHeight > 1 || + $oldHeight > 1 && $newHeight == 1) && $data(vsbManaged)} { + showVScrollbar $win 1 + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::onTitleColsWidthChanged +#------------------------------------------------------------------------------ +proc scrollutil::sa::onTitleColsWidthChanged tbl { + set win [lindex [grid info $tbl] 1] + upvar ::scrollutil::ns${win}::data data + + set newWidth [winfo reqwidth $data(cf-sw)] + set oldWidth $data(cf-sw_width) + set data(cf-sw_width) $newWidth + + if {($oldWidth == 1 && $newWidth > 1 || + $oldWidth > 1 && $newWidth == 1) && $data(hsbManaged)} { + showHScrollbar $win 1 + } +} + +# +# Private utility procedures +# ========================== +# + +#------------------------------------------------------------------------------ +# scrollutil::sa::showHScrollbar +#------------------------------------------------------------------------------ +proc scrollutil::sa::showHScrollbar {win {redisplay 0}} { + upvar ::scrollutil::ns${win}::data data + if {$data(hsbManaged) && !$redisplay} { + return "" + } + + if {$data(-respecttitlecolumns) && $data(cf-sw_width) > 1} { + grid $data(cf-sw) -in $win -row 2 -column 0 -sticky ns + grid $win.hsb -row 2 -column 1 -columnspan 1 -sticky ew + } else { + if {[winfo exists $data(cf-sw)]} { + grid forget $data(cf-sw) + } + grid $win.hsb -row 2 -column 0 -columnspan 2 -sticky ew + } + set data(hsbManaged) 1 + + if {[winfo ismapped $win]} { + set data(hsbLocked) 1 + after $data(-lockinterval) \ + [list scrollutil::sa::unlockScrollbar $win hsb] + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::hideHScrollbar +#------------------------------------------------------------------------------ +proc scrollutil::sa::hideHScrollbar win { + upvar ::scrollutil::ns${win}::data data + if {!$data(hsbManaged) || $data(hsbLocked)} { + return "" + } + + if {[winfo exists $data(cf-sw)]} { + grid forget $data(cf-sw) + } + grid forget $win.hsb + set data(hsbManaged) 0 +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::updateHScrollbar +#------------------------------------------------------------------------------ +proc scrollutil::sa::updateHScrollbar win { + # + # Handle the case that the last hideHScrollbar invocation + # returned prematurely because of the scrollbar lock + # + upvar ::scrollutil::ns${win}::data data + if {[string compare $data(-xscrollbarmode) "dynamic"] == 0} { + foreach {first last} [$win.hsb get] {} + if {$first == 0 && $last == 1} { + hideHScrollbar $win + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::showVScrollbar +#------------------------------------------------------------------------------ +proc scrollutil::sa::showVScrollbar {win {redisplay 0}} { + upvar ::scrollutil::ns${win}::data data + if {$data(vsbManaged) && !$redisplay} { + return "" + } + + if {$data(-respectheader) && $data(cf-ne_height) > 1} { + grid $data(cf-ne) -in $win -row 0 -column 2 -sticky ew + grid $win.vsb -row 1 -rowspan 1 -column 2 -sticky ns + } else { + if {[winfo exists $data(cf-ne)]} { + grid forget $data(cf-ne) + } + grid $win.vsb -row 0 -rowspan 2 -column 2 -sticky ns + } + set data(vsbManaged) 1 + + if {[winfo ismapped $win]} { + set data(vsbLocked) 1 + after $data(-lockinterval) \ + [list scrollutil::sa::unlockScrollbar $win vsb] + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::hideVScrollbar +#------------------------------------------------------------------------------ +proc scrollutil::sa::hideVScrollbar win { + upvar ::scrollutil::ns${win}::data data + if {!$data(vsbManaged) || $data(vsbLocked)} { + return "" + } + + if {[winfo exists $data(cf-ne)]} { + grid forget $data(cf-ne) + } + grid forget $win.vsb + set data(vsbManaged) 0 +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::updateVScrollbar +#------------------------------------------------------------------------------ +proc scrollutil::sa::updateVScrollbar win { + # + # Handle the case that the last hideVScrollbar invocation + # returned prematurely because of the scrollbar lock + # + upvar ::scrollutil::ns${win}::data data + if {[string compare $data(-yscrollbarmode) "dynamic"] == 0} { + foreach {first last} [$win.vsb get] {} + if {$first == 0 && $last == 1} { + hideVScrollbar $win + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::sa::unlockScrollbar +#------------------------------------------------------------------------------ +proc scrollutil::sa::unlockScrollbar {win sb} { + if {[winfo exists $win] && + [string compare [winfo class $win] "Scrollarea"] == 0} { + upvar ::scrollutil::ns${win}::data data + set data(${sb}Locked) 0 + } +} diff --git a/modules/scrollutil/scripts/scrollsync.tcl b/modules/scrollutil/scripts/scrollsync.tcl new file mode 100644 index 00000000..7a24f235 --- /dev/null +++ b/modules/scrollutil/scripts/scrollsync.tcl @@ -0,0 +1,557 @@ +#============================================================================== +# Contains the implementation of the scrollsync widget. +# +# Structure of the module: +# - Namespace initialization +# - Private procedure creating the default bindings +# - Public procedure creating a new scrollsync widget +# - Private configuration procedures +# - Private procedures implementing the scrollsync widget command +# - Private callback procedure +# - Private procedures used in bindings +# - Private utility procedures +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +# +# Namespace initialization +# ======================== +# + +namespace eval scrollutil::ss { + # + # The array configSpecs is used to handle configuration options. The names + # of its elements are the configuration options for the Scrollsync class. + # The value of an array element is either an alias name or a list + # containing the database name and class as well as an indicator specifying + # the widget to which the option applies: f stands for the frame and w for + # the scrollsync widget itself. + # + # Command-Line Name {Database Name Database Class W} + # ------------------------------------------------------------------------ + # + variable configSpecs + array set configSpecs { + -background {background Background f} + -bg -background + -borderwidth {borderWidth BorderWidth f} + -bd -borderwidth + -cursor {cursor Cursor f} + -highlightbackground {highlightBackground HighlightBackground f} + -highlightcolor {highlightColor HighlightColor f} + -highlightthickness {highlightThickness HighlightThickness f} + -relief {relief Relief f} + -takefocus {takeFocus TakeFocus f} + -xscrollcommand {xScrollCommand ScrollCommand w} + -yscrollcommand {yScrollCommand ScrollCommand w} + } + + # + # Extend the elements of the array configSpecs + # + proc extendConfigSpecs {} { + variable ::scrollutil::usingTile + variable configSpecs + + if {$usingTile} { + foreach opt {-background -bg -highlightbackground -highlightcolor + -highlightthickness} { + unset configSpecs($opt) + } + } else { + set helpFrm .__helpFrm + for {set n 2} {[winfo exists $helpFrm]} {incr n} { + set helpFrm .__helpFrm$n + } + tk::frame $helpFrm + foreach opt {-background -highlightbackground -highlightcolor + -highlightthickness} { + set configSet [$helpFrm configure $opt] + lappend configSpecs($opt) [lindex $configSet 3] + } + destroy $helpFrm + } + + lappend configSpecs(-borderwidth) 0 + lappend configSpecs(-cursor) "" + lappend configSpecs(-relief) flat + lappend configSpecs(-takefocus) 0 + lappend configSpecs(-xscrollcommand) "" + lappend configSpecs(-yscrollcommand) "" + } + extendConfigSpecs + + variable configOpts [lsort [array names configSpecs]] + + # + # Use a list to facilitate the handling of the command options + # + variable cmdOpts [list cget configure setwidgets widgets xview yview] +} + +# +# Private procedure creating the default bindings +# =============================================== +# + +#------------------------------------------------------------------------------ +# scrollutil::ss::createBindings +# +# Creates the default bindings for the binding tags Scrollsync and +# WidgetOfScrollsync. +#------------------------------------------------------------------------------ +proc scrollutil::ss::createBindings {} { + bind Scrollsync continue + bind Scrollsync { + if {[string compare [focus -lastfor %W] %W] == 0} { + focus [lindex [%W widgets] 0] + } + } + bind Scrollsync { scrollutil::ss::onScrollsyncConfigure %W } + bind Scrollsync { scrollutil::ss::onScrollsyncDestroy %W } + + bind WidgetOfScrollsync { + scrollutil::ss::onWidgetOfScrollsyncDestroy %W + } +} + +# +# Public procedure creating a new scrollsync widget +# ================================================= +# + +#------------------------------------------------------------------------------ +# scrollutil::scrollsync +# +# Creates a new scrollsync widget whose name is specified as the first command- +# line argument, and configures it according to the options and their values +# given on the command line. Returns the name of the newly created widget. +#------------------------------------------------------------------------------ +proc scrollutil::scrollsync args { + variable usingTile + variable ss::configSpecs + variable ss::configOpts + + if {[llength $args] == 0} { + mwutil::wrongNumArgs "scrollsync pathName ?options?" + } + + # + # Create a frame of the class Scrollsync + # + set win [lindex $args 0] + if {[catch { + if {$usingTile} { + ttk::frame $win -class Scrollsync -padding 0 + } else { + tk::frame $win -class Scrollsync -container 0 + catch {$win configure -padx 0 -pady 0} + } + $win configure -height 0 -width 0 + } result] != 0} { + return -code error $result + } + + # + # Create a namespace within the current one to hold the data of the widget + # + namespace eval ns$win { + # + # The folowing array holds various data for this widget + # + variable data + array set data { + xviewLocked 0 + yviewLocked 0 + widgetList {} + xScrollableList {} + yScrollableList {} + } + } + + # + # Initialize some further components of data + # + upvar ::scrollutil::ns${win}::data data + foreach opt $configOpts { + set data($opt) [lindex $configSpecs($opt) 3] + } + + # + # Configure the widget according to the command-line + # arguments and to the available database options + # + if {[catch { + mwutil::configureWidget $win configSpecs scrollutil::ss::doConfig \ + scrollutil::ss::doCget [lrange $args 1 end] 1 + } result] != 0} { + destroy $win + return -code error $result + } + + # + # Move the original widget command into the namespace ss within the current + # one and create an alias of the original name for a new widget procedure + # + rename ::$win ss::$win + interp alias {} ::$win {} scrollutil::ss::scrollsyncWidgetCmd $win + + return $win +} + +# +# Private configuration procedures +# ================================ +# + +#------------------------------------------------------------------------------ +# scrollutil::ss::doConfig +# +# Applies the value val of the configuration option opt to the scrollsync +# widget win. +#------------------------------------------------------------------------------ +proc scrollutil::ss::doConfig {win opt val} { + variable configSpecs + upvar ::scrollutil::ns${win}::data data + + # + # Apply the value to the widget corresponding to the given option + # + switch [lindex $configSpecs($opt) 2] { + f { + # + # Apply the value to the frame and save the + # properly formatted value of val in data($opt) + # + $win configure $opt $val + set data($opt) [$win cget $opt] + } + + w { + switch -- $opt { + -xscrollcommand - + -yscrollcommand { + set data($opt) $val + } + } + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::doCget +# +# Returns the value of the configuration option opt for the scrollsync widget +# win. +#------------------------------------------------------------------------------ +proc scrollutil::ss::doCget {win opt} { + upvar ::scrollutil::ns${win}::data data + return $data($opt) +} + +# +# Private procedures implementing the scrollsync widget command +# ============================================================= +# + +#------------------------------------------------------------------------------ +# scrollutil::ss::scrollsyncWidgetCmd +# +# Processes the Tcl command corresponding to a scrollsync widget. +#------------------------------------------------------------------------------ +proc scrollutil::ss::scrollsyncWidgetCmd {win args} { + set argCount [llength $args] + if {$argCount == 0} { + mwutil::wrongNumArgs "$win option ?arg arg ...?" + } + + variable cmdOpts + set cmd [mwutil::fullOpt "option" [lindex $args 0] $cmdOpts] + switch $cmd { + cget { + if {$argCount != 2} { + mwutil::wrongNumArgs "$win $cmd option" + } + + # + # Return the value of the specified configuration option + # + upvar ::scrollutil::ns${win}::data data + variable configSpecs + set opt [mwutil::fullConfigOpt [lindex $args 1] configSpecs] + return $data($opt) + } + + configure { + variable configSpecs + return [mwutil::configureSubCmd $win configSpecs \ + scrollutil::ss::doConfig scrollutil::ss::doCget \ + [lrange $args 1 end]] + } + + setwidgets { + if {$argCount != 2} { + mwutil::wrongNumArgs "$win $cmd widgetList" + } + + return [setwidgetsSubCmd $win [lindex $args 1]] + } + + widgets { + if {$argCount != 1} { + mwutil::wrongNumArgs "$win $cmd" + } + + upvar ::scrollutil::ns${win}::data data + return $data(widgetList) + } + + xview { + return [viewSubCmd $win x [lrange $args 1 end]] + } + + yview { + return [viewSubCmd $win y [lrange $args 1 end]] + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::setwidgetsSubCmd +# +# Processes the scrollsync setwidgets subcommmand. +#------------------------------------------------------------------------------ +proc scrollutil::ss::setwidgetsSubCmd {win widgetList} { + upvar ::scrollutil::ns${win}::data data + + foreach w $widgetList { + if {![winfo exists $w]} { + return -code error "bad window path name \"$w\"" + } + } + + variable scrollsyncArr + + set oldWidgetList $data(widgetList) + foreach w $oldWidgetList { + if {[winfo exists $w]} { + set tagList [bindtags $w] + set idx [lsearch -exact $tagList "WidgetOfScrollsync"] + bindtags $w [lreplace $tagList $idx $idx] + } + + if {[info exists scrollsyncArr($w)]} { + unset scrollsyncArr($w) + } + } + + array set data {xScrollableList {} yScrollableList {}} + + foreach w $widgetList { + set tagList [bindtags $w] + set idx [lsearch -exact $tagList "WidgetOfScrollsync"] + if {$idx < 0} { + bindtags $w [linsert $tagList 1 WidgetOfScrollsync] + } + + set scrollsyncArr($w) $win + + foreach axis {x y} { + if {[mwutil::isScrollable $w $axis]} { + lappend data(${axis}ScrollableList) $w + ::$w ${axis}view moveto 0 + ::$w configure -${axis}scrollcommand \ + [list scrollutil::ss::scrollCmd $win $w $axis] + } + } + + } + + set data(widgetList) $widgetList + return $oldWidgetList +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::viewSubCmd +# +# Processes the scrollsync xview and yview subcommmands. +#------------------------------------------------------------------------------ +proc scrollutil::ss::viewSubCmd {win axis argList} { + upvar ::scrollutil::ns${win}::data data + set masterWidget [lindex $data(${axis}ScrollableList) 0] + set viewCmd ${axis}view + + switch [llength $argList] { + 0 { + # + # Command: $win (x|y)view + # + if {[string length $masterWidget] == 0} { + return [list 0 1] + } else { + return [::$masterWidget $viewCmd] + } + } + + 1 { + # + # Command: $win (x|y)view + # + return -code error \ + "the command \"$win $viewCmd \" is not supported" + } + + default { + # + # Command: $win (x|y)view moveto + # $win (x|y)view scroll units|pages + # + set argList [mwutil::getScrollInfo $argList] + if {[string length $masterWidget] != 0} { + eval [list ::$masterWidget] $viewCmd $argList + } + return "" + } + } +} + +# +# Private callback procedure +# ========================== +# + +#------------------------------------------------------------------------------ +# scrollutil::ss::scrollCmd +# +# Propagates the position of the horizontal/vertical view of the widget widget +# within the scrollsync win to the other horizontally/vertically scrollable +# widgets and passes the data of the master widget's view to the value of the +# -xscrollcommand/-yscrollcommand option. +#------------------------------------------------------------------------------ +proc scrollutil::ss::scrollCmd {win widget axis first last} { + upvar ::scrollutil::ns${win}::data data + if {$data(${axis}viewLocked)} { + return "" + } + + foreach w $data(${axis}ScrollableList) { + if {[string compare $w $widget] == 0} { + continue + } + + if {$first != 0 && $last == 1} { + ::$w ${axis}view moveto 1 + } else { + ::$w ${axis}view moveto $first + } + } + + set masterWidget [sortScrollableList $win $axis] + if {[string length $data(-${axis}scrollcommand)] != 0} { + eval $data(-${axis}scrollcommand) [::$masterWidget ${axis}view] + } + + set data(${axis}viewLocked) 1 + after 1 [list scrollutil::ss::unlockView $win $axis] +} + +# +# Private procedures used in bindings +# =================================== +# + +#------------------------------------------------------------------------------ +# scrollutil::ss::onScrollsyncConfigure +#------------------------------------------------------------------------------ +proc scrollutil::ss::onScrollsyncConfigure win { + upvar ::scrollutil::ns${win}::data data + after 50 [list scrollutil::ss::updateMasterWidgets $win] +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::updateMasterWidgets +#------------------------------------------------------------------------------ +proc scrollutil::ss::updateMasterWidgets win { + if {![winfo exists $win] || + [string compare [winfo class $win] "Scrollsync"] != 0} { + return "" + } + + upvar ::scrollutil::ns${win}::data data + foreach axis {x y} { + set masterWidget [sortScrollableList $win $axis] + if {[string length $masterWidget] != 0 && + [string length $data(-${axis}scrollcommand)] != 0} { + eval $data(-${axis}scrollcommand) [::$masterWidget ${axis}view] + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::onScrollsyncDestroy +#------------------------------------------------------------------------------ +proc scrollutil::ss::onScrollsyncDestroy win { + namespace delete ::scrollutil::ns$win + catch {rename ::$win ""} +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::onWidgetOfScrollsyncDestroy +#------------------------------------------------------------------------------ +proc scrollutil::ss::onWidgetOfScrollsyncDestroy widget { + variable scrollsyncArr + set win $scrollsyncArr($widget) + unset scrollsyncArr($widget) + + if {[winfo exists $win] && + [string compare [winfo class $win] "Scrollsync"] == 0} { + set widgetList [::$win widgets] + set idx [lsearch -exact $widgetList $widget] + ::$win setwidgets [lreplace $widgetList $idx $idx] + } +} + +# +# Private utility procedures +# ========================== +# + +#------------------------------------------------------------------------------ +# scrollutil::ss::sortScrollableList +#------------------------------------------------------------------------------ +proc scrollutil::ss::sortScrollableList {win axis} { + upvar ::scrollutil::ns${win}::data data + set data(${axis}ScrollableList) \ + [lsort -command "compareViews $axis" $data(${axis}ScrollableList)] + return [lindex $data(${axis}ScrollableList) 0] +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::compareViews +#------------------------------------------------------------------------------ +proc scrollutil::ss::compareViews {axis w1 w2} { + foreach {first1 last1} [::$w1 ${axis}view] {} + foreach {first2 last2} [::$w2 ${axis}view] {} + set fraction1 [expr {$last1 - $first1}] + set fraction2 [expr {$last2 - $first2}] + + if {$fraction1 < $fraction2} { + return -1 + } elseif {$fraction1 == $fraction2} { + return 0 + } else { + return 1 + } +} + +#------------------------------------------------------------------------------ +# scrollutil::ss::unlockView +#------------------------------------------------------------------------------ +proc scrollutil::ss::unlockView {win axis} { + if {[winfo exists $win] && + [string compare [winfo class $win] "Scrollsync"] == 0} { + upvar ::scrollutil::ns${win}::data data + set data(${axis}viewLocked) 0 + } +} diff --git a/modules/scrollutil/scripts/tclIndex b/modules/scrollutil/scripts/tclIndex new file mode 100644 index 00000000..569cd18d --- /dev/null +++ b/modules/scrollutil/scripts/tclIndex @@ -0,0 +1,78 @@ +# Tcl autoload index file, version 2.0 +# This file is generated by the "auto_mkindex" command +# and sourced to set up indexing information for one or +# more commands. Typically each line is a command that +# sets an element in the auto_index array, where the +# element name is the name of a command and the value is +# a script that loads the command. + +set auto_index(::mwutil::makeFocusProcs) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::getChildren) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::wrongNumArgs) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::getAncestorByClass) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::convEventFields) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::defineKeyNav) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::processTraversal) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::configureWidget) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::fullConfigOpt) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::fullOpt) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::enumOpts) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::configureSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::attribSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::hasattribSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::unsetattribSubCmd) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::getScrollInfo) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::isScrollable) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::hasFocus) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::genMouseWheelEvent) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::windowingSystem) [list source [file join $dir mwutil.tcl]] +set auto_index(::mwutil::currentTheme) [list source [file join $dir mwutil.tcl]] +set auto_index(::scrollutil::sa::extendConfigSpecs) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::createBindings) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::scrollarea) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::doConfig) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::doCget) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::scrollareaWidgetCmd) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::setwidgetSubCmd) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::setHScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::setVScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::onScrollareaConfigure) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::updateScrollbars) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::onScrollareaDestroy) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::onDynamicHScrollbarMap) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::onWidgetOfScrollareaDestroy) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::onHeaderHeightChanged) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::onTitleColsWidthChanged) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::showHScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::hideHScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::updateHScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::showVScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::hideVScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::updateVScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::sa::unlockScrollbar) [list source [file join $dir scrollarea.tcl]] +set auto_index(::scrollutil::ss::extendConfigSpecs) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::createBindings) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::scrollsync) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::doConfig) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::doCget) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::scrollsyncWidgetCmd) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::setwidgetsSubCmd) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::viewSubCmd) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::scrollCmd) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::onScrollsyncConfigure) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::updateMasterWidgets) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::onScrollsyncDestroy) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::onWidgetOfScrollsyncDestroy) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::sortScrollableList) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::compareViews) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::ss::unlockView) [list source [file join $dir scrollsync.tcl]] +set auto_index(::scrollutil::createWheelEventBindings) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::enableScrollingByWheel) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::adaptWheelEventHandling) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::setFocusCheckWindow) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::focusCheckWindow) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::hasFocus) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::isCompatible) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::scrollByUnits) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::mayScroll) [list source [file join $dir wheelEvent.tcl]] +set auto_index(::scrollutil::onScrlWidgetContDestroy) [list source [file join $dir wheelEvent.tcl]] diff --git a/modules/scrollutil/scripts/wheelEvent.tcl b/modules/scrollutil/scripts/wheelEvent.tcl new file mode 100644 index 00000000..0e0a1e14 --- /dev/null +++ b/modules/scrollutil/scripts/wheelEvent.tcl @@ -0,0 +1,457 @@ +#============================================================================== +# Contains procedures for mouse wheel event handling in scrollable widget +# containers like BWidget ScrollableFrame and iwidgets::scrolledframe. Tested +# also with the scrolledframe::scrolledframe command of the Scrolledframe +# package by Maurice Bredelet (ulis) and its optimized and enhanced version +# contributed by Keith Nash, as well as with the sframe command implemented by +# Paul Walton (see https://wiki.tcl-lang.org/page/A+scrolled+frame). +# +# Structure of the module: +# - Namespace initialization +# - Public procedures +# - Private procedures +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +if {[string compare $tcl_platform(platform) "windows"] == 0} { + package require Tk 8.6b2 +} else { + package require Tk 8.4 +} + +# +# Namespace initialization +# ======================== +# + +namespace eval scrollutil { + # + # Mouse wheel event bindings for the binding + # tags "WheeleventRedir" and "WheeleventBreak": + # + set eventList [list ] + switch [tk windowingsystem] { + aqua { + lappend eventList + } + x11 { + lappend eventList \ + + } + } + foreach event $eventList { + if {[string match <*Button-?> $event]} { + bind WheeleventRedir $event [format { + if {![scrollutil::hasFocus %%W] || + ![scrollutil::isCompatible %s %%W]} { + event generate [winfo toplevel %%W] %s \ + -rootx %%X -rooty %%Y + break + } + } $event $event] + } else { + bind WheeleventRedir $event [format { + if {![scrollutil::hasFocus %%W] || + ![scrollutil::isCompatible %s %%W]} { + event generate [winfo toplevel %%W] %s \ + -rootx %%X -rooty %%Y -delta %%D + break + } + } $event $event] + } + + bind WheeleventBreak $event { break } + } + + # + # The list of scrollable widget containers that are + # registered for scrolling by the mouse wheel event + # bindings created by the createWheelEventBindings command: + # + variable scrlWidgetContList {} + + # + # event binding for the binding tag "ScrlWidgetCont": + # + bind ScrlWidgetCont { + scrollutil::onScrlWidgetContDestroy %W + } + + # + # event binding for the binding tag "WheeleventWidget": + # + bind WheeleventWidget { + unset -nocomplain scrollutil::focusCheckWinArr(%W) + } +} + +# +# Public procedures +# ================= +# + +#------------------------------------------------------------------------------ +# scrollutil::createWheelEventBindings +# +# Usage: scrollutil::createWheelEventBindings ?tag tag ...? +# +# Creates mouse wheel event bindings for the specified binding tags such that +# if the widget under the pointer is (a descendant of) one of the registered +# scrollable widget containers then these events will trigger a scrolling of +# that widget container. Each tag argument must be "all" or the path name of +# an existing toplevel widget. +#------------------------------------------------------------------------------ +proc scrollutil::createWheelEventBindings args { + set winSys [tk windowingsystem] + foreach tag $args { + if {[string match .* $tag]} { + if {![winfo exists $tag]} { + return -code error "bad window path name \"$tag\"" + } + + if {[winfo toplevel $tag] ne $tag} { + return -code error "\"$tag\" is not a toplevel widget" + } + } elseif {$tag ne "all"} { + return -code error "unsupported tag \"$tag\": must be \"all\" or\ + the path name of an existing toplevel widget" + } + + if {$winSys eq "aqua"} { + bind $tag { + scrollutil::scrollByUnits %W %X %Y y [expr {-%D}] + } + bind $tag { + scrollutil::scrollByUnits %W %X %Y y [expr {-10 * %D}] + } + + bind $tag { + scrollutil::scrollByUnits %W %X %Y x [expr {-%D}] + } + bind $tag { + scrollutil::scrollByUnits %W %X %Y x [expr {-10 * %D}] + } + } else { + bind $tag { + scrollutil::scrollByUnits %W %X %Y y [expr {-(%D/120) * 4}] + } + bind $tag { + scrollutil::scrollByUnits %W %X %Y x [expr {-(%D/120) * 4}] + } + + if {$winSys eq "x11"} { + bind $tag { + scrollutil::scrollByUnits %W %X %Y y -5 + } + bind $tag { + scrollutil::scrollByUnits %W %X %Y y 5 + } + bind $tag { + scrollutil::scrollByUnits %W %X %Y x -5 + } + bind $tag { + scrollutil::scrollByUnits %W %X %Y x 5 + } + } + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::enableScrollingByWheel +# +# Usage: scrollutil::enableScrollingByWheel ?scrlWidgetCont scrlWidgetCont ...? +# +# Adds the specified scrollable widget containers to the internal list of +# widget containers that are registered for scrolling by the mouse wheel event +# bindings created by the createWheelEventBindings command. +#------------------------------------------------------------------------------ +proc scrollutil::enableScrollingByWheel args { + variable scrlWidgetContList + foreach swc $args { + if {![winfo exists $swc]} { + return -code error "bad window path name \"$swc\"" + } + + if {[catch {$swc xview scroll 0 units}] != 0} { + return -code error "\"$swc\" fails to support horizontal scrolling\ + by units" + } + + if {[catch {$swc yview scroll 0 units}] != 0} { + return -code error "\"$swc\" fails to support vertical scrolling\ + by units" + } + + if {[lsearch -exact $scrlWidgetContList $swc] >= 0} { + continue + } + + lappend scrlWidgetContList $swc + + set tagList [bindtags $swc] + if {[lsearch -exact $tagList "ScrlWidgetCont"] < 0} { + bindtags $swc [linsert $tagList 1 ScrlWidgetCont] + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::adaptWheelEventHandling +# +# Usage: scrollutil::adaptWheelEventHandling ?widget widget ...? +# +# For each widget argument, the command performs the following actions: +# +# * If $widget is a tablelist then it sets the latter's -xmousewheelwindow +# and -ymousewheelwindow options to the path name of the containing +# toplevel window (for Tablelist versions 6.4 and later). +# +# * Otherwise it locates the (first) binding tag that has mouse wheel event +# bindings and is different from both the path name of the containing +# toplevel window and "all". If the search for this tag was successful +# then the command modifies the widget's list of binding tags by prepending +# the tag "WheeleventRedir" and appending the tag "WheeleventBreak" to this +# binding tag. As a result, a mouse wheel event sent to this widget will +# be handled as follows: +# +# - If the focus is on or inside the window [focusCheckWindow $widget] +# then the event will be handled by the binding script associated with +# this tag and no further processing of the event will take place. +# +# - If the focus is outside the window [focusCheckWindow $widget] then +# the event will be redirected to the containing toplevel window via +# event generate rather than being handled by the binding script +# associated with the above-mentioned tag. +#------------------------------------------------------------------------------ +proc scrollutil::adaptWheelEventHandling args { + set winSys [tk windowingsystem] + foreach w $args { + if {![winfo exists $w]} { + return -code error "bad window path name \"$w\"" + } + + set wTop [winfo toplevel $w] + if {[winfo class $w] eq "Tablelist"} { + if {[package vcompare $::tablelist::version "6.4"] >= 0} { + $w configure -xmousewheelwindow $wTop -ymousewheelwindow $wTop + } + } else { + set tagList [bindtags $w] + if {[lsearch -exact $tagList "WheeleventRedir"] >= 0} { + continue + } + + foreach tag $tagList { + if {$tag eq $wTop || $tag eq "all" || + ($winSys eq "x11" && [bind $tag ] eq "") || + ($winSys ne "x11" && [bind $tag ] eq "")} { + continue + } + + set tagIdx [lsearch -exact $tagList $tag] + bindtags $w [lreplace $tagList $tagIdx $tagIdx \ + WheeleventRedir $tag WheeleventBreak] + break + } + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::setFocusCheckWindow +# +# Usage: scrollutil::setFocusCheckWindow widget ?widget ...? otherWidget +# +# For each widget argument, the command sets the associated "focus check +# window" to otherWidget. This is the window to be used instead of the widget +# when checking whether the focus is on/inside or outside that window. It must +# be an ancestor of or identical to widget. +#------------------------------------------------------------------------------ +proc scrollutil::setFocusCheckWindow args { + set argCount [llength $args] + if {$argCount < 2} { + return -code error "wrong # args: should be\ + \"scrollutil::setFocusCheckWindow widget ?widget ...? otherWidget\"" + } + + foreach w $args { + if {![winfo exists $w]} { + return -code error "bad window path name \"$w\"" + } + } + + set w2 [lindex $args end] + + variable focusCheckWinArr + set n 0 + foreach w $args { + if {$n == $argCount - 1} { + return "" + } + + if {[string first $w2. $w.] != 0} { + return -code error \ + "\"$w2\" is neither an ancestor of nor is identical to \"$w\"" + } + + set focusCheckWinArr($w) $w2 + + set tagList [bindtags $w] + if {[lsearch -exact $tagList "WheeleventWidget"] < 0} { + bindtags $w [linsert $tagList 1 WheeleventWidget] + } + + incr n + } +} + +#------------------------------------------------------------------------------ +# scrollutil::focusCheckWindow +# +# Usage: scrollutil::focusCheckWindow widget +# +# Returns the "focus check window" associated with widget. This is the window +# that is used instead of the widget when checking whether the focus is +# on/inside or outside that window. If the command setFocusCheckWindow was not +# invoked for widget then the return value is widget itself. +#------------------------------------------------------------------------------ +proc scrollutil::focusCheckWindow w { + if {![winfo exists $w]} { + return -code error "bad window path name \"$w\"" + } + + variable focusCheckWinArr + return [expr {[info exists focusCheckWinArr($w)] ? + $focusCheckWinArr($w) : $w}] +} + +# +# Private procedures +# ================== +# + +#------------------------------------------------------------------------------ +# scrollutil::hasFocus +#------------------------------------------------------------------------------ +proc scrollutil::hasFocus w { + set focusWin [focus -displayof $w] + if {$focusWin eq ""} { + set focusTop "" + } else { + set focusTop [winfo toplevel $focusWin] + } + + set focusCheckWin [focusCheckWindow $w] + if {[string first $focusCheckWin. $focusWin.] == 0 && + [winfo toplevel $focusCheckWin] eq $focusTop} { + return 1 + } elseif {[string match "*Scrollbar" [winfo class $w]]} { + set w2 [lindex [$w cget -command] 0] ;# the associated widget + set focusCheckWin2 [focusCheckWindow $w2] + return [expr {[winfo exists $w2] && + [string first $focusCheckWin2. $focusWin.] == 0 && + [winfo toplevel $focusCheckWin2] eq $focusTop}] + } else { + return 0 + } +} + +#------------------------------------------------------------------------------ +# scrollutil::isCompatible +#------------------------------------------------------------------------------ +proc scrollutil::isCompatible {event w} { + set tagList [bindtags $w] + set idx [lsearch -exact $tagList "WheeleventRedir"] + set tag [lindex $tagList [incr idx]] + if {[bind $tag $event] eq ""} { + return 0 + } elseif {[string match "*Scrollbar" [winfo class $w]]} { + set orient [$w cget -orient] + return [expr { + ($orient eq "horizontal" && [string match "" $event]) || + ($orient eq "vertical" && ![string match "" $event]) + }] + } else { + return 1 + } +} + +#------------------------------------------------------------------------------ +# scrollutil::scrollByUnits +#------------------------------------------------------------------------------ +proc scrollutil::scrollByUnits {w rootX rootY axis units} { + set w [winfo containing -displayof $w $rootX $rootY] + variable scrlWidgetContList + foreach swc $scrlWidgetContList { + if {[mayScroll $swc $w]} { + $swc ${axis}view scroll $units units + return "" + } + } +} + +#------------------------------------------------------------------------------ +# scrollutil::mayScroll +#------------------------------------------------------------------------------ +proc scrollutil::mayScroll {swc w} { + if {[string first $swc. $w.] != 0} { ;# $w is not (a descendant of) $swc + return 0 + } + + set swcTop [winfo toplevel $swc] + set wTop [winfo toplevel $w] + if {$swcTop ne $wTop} { ;# $swc and $w have different toplevels + return 0 + } + + if {[winfo class $swc] eq "Scrolledframe" && + [llength [info commands ::iwidgets::scrolledframe]] != 0 && + ($w eq [$swc component horizsb] || $w eq [$swc component vertsb])} { + return 0 + } + + # + # Don't scroll the window $swc if the toplevel window of any + # combobox widget contained in it is currently popped down + # + set swcTop [winfo toplevel $swc] + set toplevelList [wm stackorder $swcTop] + if {[llength $toplevelList] == 1} { + return 1 + } else { + foreach top $toplevelList { + if {$top eq $swcTop} { + continue + } + + # + # Check whether the toplevel $top is a child of a + # ttk::combobox, BWidget ComboBox or Oakley combobox + # widget, or is a descendant of an iwidgets::combobox + # + set topName [winfo name $top] + set topPar [winfo parent $top] + set topParClass [winfo class $topPar] + set topParName [winfo name $topPar] + if {($topParClass eq "TCombobox" && $topName eq "popdown") || + ($topParClass eq "ComboBox" && $topName eq "shell") || + ($topParClass eq "Combobox" && $topName eq "top") || + ($topParName eq "efchildsite" && $topName eq "popup")} { + return 0 + } + } + + return 1 + } +} + +#------------------------------------------------------------------------------ +# scrollutil::onScrlWidgetContDestroy +#------------------------------------------------------------------------------ +proc scrollutil::onScrlWidgetContDestroy swc { + variable scrlWidgetContList + set idx [lsearch -exact $scrlWidgetContList $swc] + set scrlWidgetContList [lreplace $scrlWidgetContList $idx $idx] +} diff --git a/modules/scrollutil/scrollutil.tcl b/modules/scrollutil/scrollutil.tcl new file mode 100644 index 00000000..45f478cb --- /dev/null +++ b/modules/scrollutil/scrollutil.tcl @@ -0,0 +1,14 @@ +#============================================================================== +# Main Scrollutil package module. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require -exact scrollutil::common 1.1 + +package provide scrollutil $::scrollutil::version +package provide Scrollutil $::scrollutil::version + +::scrollutil::useTile 0 +::scrollutil::sa::createBindings +::scrollutil::ss::createBindings diff --git a/modules/scrollutil/scrollutilCommon.tcl b/modules/scrollutil/scrollutilCommon.tcl new file mode 100644 index 00000000..b98196c3 --- /dev/null +++ b/modules/scrollutil/scrollutilCommon.tcl @@ -0,0 +1,73 @@ +#============================================================================== +# Main Scrollutil and Scrollutil_tile package module. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require Tk 8 + +namespace eval ::scrollutil { + # + # Public variables: + # + variable version 1.1 + variable library + if {$::tcl_version >= 8.4} { + set library [file dirname [file normalize [info script]]] + } else { + set library [file dirname [info script]] ;# no "file normalize" yet + } + + # + # Creates a new scrollarea/scrollsync widget: + # + namespace export scrollarea scrollsync + + # + # Public procedures for mouse wheel event + # handling in scrollable widget containers: + # + namespace export createWheelEventBindings enableScrollingByWheel \ + adaptWheelEventHandling setFocusCheckWindow \ + focusCheckWindow +} + +package provide scrollutil::common $::scrollutil::version + +# +# The following procedure, invoked in "scrollutil.tcl" and +# "scrollutil_tile.tcl", sets the variable ::scrollutil::usingTile to the given +# value and sets a trace on this variable. +# +proc ::scrollutil::useTile {bool} { + variable usingTile $bool + trace variable usingTile wu [list ::scrollutil::restoreUsingTile $bool] +} + +# +# The following trace procedure is executed whenever the variable +# ::scrollutil::usingTile is written or unset. It restores the variable to its +# original value, given by the first argument. +# +proc ::scrollutil::restoreUsingTile {origVal varName index op} { + variable usingTile $origVal + switch $op { + w { + return -code error "it is not allowed to use both Scrollutil and\ + Scrollutil_tile in the same application" + } + u { + trace variable usingTile wu \ + [list ::scrollutil::restoreUsingTile $origVal] + } + } +} + +interp alias {} ::tk::frame {} ::frame +interp alias {} ::tk::scrollbar {} ::scrollbar + +# +# Everything else needed is lazily loaded on demand, via the dispatcher +# set up in the subdirectory "scripts" (see the file "tclIndex"). +# +lappend auto_path [file join $::scrollutil::library scripts] diff --git a/modules/scrollutil/scrollutil_tile.tcl b/modules/scrollutil/scrollutil_tile.tcl new file mode 100644 index 00000000..51421c91 --- /dev/null +++ b/modules/scrollutil/scrollutil_tile.tcl @@ -0,0 +1,18 @@ +#============================================================================== +# Main Scrollutil_tile package module. +# +# Copyright (c) 2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +#============================================================================== + +package require Tk 8.4 +if {$::tk_version < 8.5 || [regexp {^8\.5a[1-5]$} $::tk_patchLevel]} { + package require tile 0.6 +} +package require -exact scrollutil::common 1.1 + +package provide scrollutil_tile $::scrollutil::version +package provide Scrollutil_tile $::scrollutil::version + +::scrollutil::useTile 1 +::scrollutil::sa::createBindings +::scrollutil::ss::createBindings diff --git a/modules/tablelist/CHANGES.txt b/modules/tablelist/CHANGES.txt index 9a00399a..e915dbfe 100644 --- a/modules/tablelist/CHANGES.txt +++ b/modules/tablelist/CHANGES.txt @@ -1,6 +1,290 @@ -What is new in Tablelist 5.17? +What is new in Tablelist 6.6? +----------------------------- + +1. Added mouse bindings for setting, extending, and toggling the column- + wise cell selection with the aid of the header labels if the + selection type is "cell" (thanks to Nicolas Bats for his proposal, + testing, and discussions on this subject). + +2. New "-selectfiltercommand" widget and column configuration option, + which can be used for filtering the cells that are to be selected by + the column-wise cell selection operation (again, thanks to Nicolas + Bats for his proposal, testing, and discussions on this subject). + +3. Improvements related to the interactive editing of multi-line cells + (thanks to Johann Oberdorfer for his proposal). + +4. Adapted the look & feel of the tree style "adwaita" to current + versions of the GTK+ 3 theme Adwaita. + +5. Improved the description of the "-height" option in the reference + manual and extended it by a hint concerning the desired height in + rows (thanks to Jakob Gager for discussions on this subject). + +6. The reference manual now contains several links to the new Scrollutil + package, along with an example showing how the scrollutil::scrollarea + widget can be used to make the creation of a scrolled tablelist quite + simple. + +7. Eliminated the flickering in the presence of header items, introduced + in Tablelist 6.5 (thanks to Johann Oberdorfer for reporting this + regression). + +8. Fixed a long-standing bug related to the "move" subcommand (thanks to + John J. Seal for his bug report). + +9. Several further improvements and minor bug fixes. + +What was new in Tablelist 6.5? +------------------------------ + +1. Support for the new virtual events <> + and <>, generated when the header's + height or the total width of the viewable title columns, + respectively, has changed. + +2. Optimized the vertical scrolling by units (thanks to Nicolas Bats for + his input). + +3. Minor improvement related to the appearance of embedded checkbuttons + on X11. + +4. Fixed a bug introduced in Tablelist 6.4, related to the "-showlabels" + option (thanks to Jakob Gager for his bug report). + +5. Fixed a few bugs specific to Mac OS X Aqua, introduced in Tablelist + 6.4 (thanks to Paul Obermeier and Nicolas Bats for their bug + reports). + +6. Fixed a bug related to the handling of mouse wheel events during + interactive cell editing, introduced in Tablelist 6.4 (thanks to + Alexandru Dadalau for his bug report). + +7. Fixed a bug related to the "move" subcommand, introduced in Tablelist + 6.3 (thanks to Jose Luis Lijo and Bo Berggren for their bug reports). + +8. Several further improvements in the code and documentation. + +What was new in Tablelist 6.4? +------------------------------ + +1. Added the "-xmousewheelwindow" and "-ymousewheelwindow" configuration + options, which make it possible to redirect the mouse wheel events of + the tablelist's body to the containing scrollable window or toplevel + widget in case the focus is outside the tablelist (thanks to Michael + Niehren for discussions on this subject). + +2. Optimized the deletion of a list of items (thanks to Martin Lemburg + for his proposal). + +3. Improved the performance of the vertical scrolling (thanks to Olivier + Jolet for discussions on this subject). + +4. Eliminated a potential endless loop triggered by key navigation with + the "aqua" theme and selection type "cell" (thanks to Michael + Grundler for his bug report). + +5. Fixed a regression introduced in Tablelist 6.3, related to the + handling of the "-listvariable" option when using Itcl 3.x (thanks to + Ralf Fassel for his bug report and valuable contribution). + +6. Fixed another regression introduced in Tablelist 6.3, related to + clearing the multiple or extended selection (thanks to Martin Lemburg + for his bug report). + +7. Several further improvements and minor bug fixes in the code and + demo scripts. + +What was new in Tablelist 6.3? ------------------------------ +1. Added the "-showbusycursor" configuration option, used to control + whether the default bindings should display a busy cursor during the + actions that can take a long time to complete, using the new + "setbusycursor" and "restorecursor" subcommands. + +2. The "-stretch" configuration option is no longer ignored if the + width of the tablelist widget was specified as zero or less (thanks + to Adrian Medrano Calvo for his proposal). For technical reasons + there is just a minor restriction, which is only relevant on X11: If + the value of the "-width" option is zero or less and the tablelist + has stretchable columns, then the "-setgrid" option will be ignored. + +3. The vertical scrollbar, when managed with the aid of the + "cornerpath" subcommand, will now appear below the entire header, + including both the header labels and the header items (if any). + +4. Besides the north-east corner frame there is now a south-west corner + frame, designed to be used when managing the horizontal scrollbar + in the presence of title columns. The "cornerpath" subcommand now + accepts the corner specification as optional argument. + +5. Significant optimizations in the item insertion as well as in the + selection-related code (thanks to Johann Oberdorfer for testing and + discussions on this subject). + +6. Adapted to some changes in future Tcl and Tk releases (for example, + made sure that it works with Tcl 9.0 and Tk 8.7). + +7. Further improvements related to the interactive cell editing with + the aid of the ctext widget (thanks to Sait Dogru for discussions on + this subject). + +8. Made the overall handling of the "-listvariable" option much more + robust (thanks to Ulrich Seidl for his bug report). + +9. Fixed a long-standing bug related to the "-maxwidth" column + configuration option (again, thanks to Ulrich Seidl for his bug + report). + +10. Fixed a bug related to the "-displayondemand" configuration option + (thanks to "tombert" for his bug report). + +11. Fixed a bug related to the tooltip support (thanks to Bo Berggren + for his bug report). + +12. Fixed a bug related to the "rowconfigure" subcommand, introduced in + Tablelist version 6.0 (thanks to Ulrich Seidl for his bug report). + +13. Numerous further improvements and minor bug fixes. + +What was new in Tablelist 6.2? +------------------------------ + +1. Added the "-labelvalign" column configuration option, for controlling + the vertical alignment of header label images (thanks to Johann + Oberdorfer for his proposal). + +2. The "collapse" and "expand" subcommands now accept a list of indices + as first argument (thanks to Ulrich Seidl for his proposal). This is + much more efficient than a series of invocations for individual rows. + +3. Significantly improved the overall performance of tablelist widgets + containing a tree structure, embedded images, or multi-line cells + (thanks to Ulrich Seidl for reporting some performance-related + issues in tree widgets). + +4. Important improvements related to the scanning performance and + behavior (thanks to Johann Oberdorfer for discussions on this + subject). + +5. Changed the default arrow style "flat7x5" to "flat8x4" on the + windowing system "x11" and for the tile themes "alt", "clam", + "default", "kroc", "sriv", "srivlg", and "step" (POTENTIAL + INCOMPATIBILITY!). + +6. The manual now recommends managing the vertical scrollbar (if any) to + appear below the header labels with the aid of the "cornerpath" + subcommand not only for Mac OS X Aqua but also for X11. The demo + scripts have been adapted accordingly. + +7. Fixed two minor bugs related to the interactive cell editing with the + aid of the ctext widget (thanks to Sait Dogru for his bug report). + +8. Fixed a long-standing bug related to the handling of the + "-listvariable" option in connection with snit widgetadaptors (thanks + to Rolf Ade for his bug report). + +9. Several further code improvements and minor bug fixes (thanks to + Alexandru Dadalau and Bernhard Wallner for their bug reports). + +What was new in Tablelist 6.1? +------------------------------ + +1. Added the "-imagebackground" cell configuration option, useful for + embedded images having (partially) transparent regions (thanks to + Jose Luis Lijo for his proposal). + +2. Extended the description of the "bodytag" subcommand in the + reference manual by examples showing how to register the body of a + tablelist widget as a drag source in such a way that the drag works + also for the separators, multi-line cells, and embedded images. + +3. Eliminated a regression related to both temporarily and persistently + embedded Tk checkbuttons on Windows, introduced in the previous + Tablelist version (thanks to Johann Oberdorfer, Jyrki Majamaeki, and + Ralf Fassel for their bug reports). + +What was new in Tablelist 6.0? +------------------------------ + +1. Added support for header items (aka title rows) with the aid of the + new "header", "headerpath", and "headertag" subcommands. The first + one supports a great number of subcommands itself, like + "insert(list)", "delete", "size", "rowconfigure", "cellconfigure", + "get(formatted)", "get(formatted)cells", etc. (thanks to Hemang + Lavana, Kenneth Green, and Ralf Fassel for their proposals). The + demo scripts "embeddedWindows.tcl" and "embeddedWindows_tile.tcl" now + contain invocations of "header insert" and "header rowconfigure". + +2. Added the "embed(ttk)checkbutton" and "embed(ttk)checkbuttons" + subcommands, which provide interactive cell editing with the aid of + persistently embedded checkbuttons (thanks to Mark Garvey and Holger + Jakobs for their proposal). The Tablelist Programmer's Guide now + contains an example of usage of the "embedcheckbuttons" subcommand. + +3. Compatibility with the revised implementation of the text widget, + which will be contained in Tk 8.7 (thanks to Brad Lanam, Gregor + Cramer, and Francois Vogel for their valuable assistance). + +4. The "dicttoitem" and "itemtodict" subcommands are now supported in + the presence of alternative, Tcl-only "dict" implementations, too + (thanks to Andy Goth for his proposal). + +5. Deleting all items has become by orders of magnitude faster (thanks + to Martin Lemburg for requesting this performance improvement). + +6. Guarded against invocations of the "update" command from within the + command specified as the value of the "-tooltipaddcommand" option + (thanks to Alexandru Dadalau for his bug report and discussions on + this subject). + +7. Made sure that the "xview" and "yview" subcommands work as expected + even if the script was started from wthin a C application in which + the decimal point is different from "." (thanks to Paul Obermeier for + his bug report). + +8. Numerous further improvements in the code, demo scripts, and + documentation. + +What was new in Tablelist 5.18? +------------------------------- + +1. Improved the performance of the vertical scrolling (thanks to + Alexandru Dadalau and Olivier Jolet for discussions on this subject). + +2. Added the "-displayondemand" configuration option, which can be used + to speed up the scrolling even further. + +3. Added the "tablelist::delaySashPosUpdates" command (described in the + manual page "Commands Related to Binding Scripts"), designed to + control the frequency of the sash position updates for a given + panedwindow widget, which might be necessary to eliminate some + artifacts if some of the panes contain tablelist widgets with + embedded images (thanks to Nicolas Robert for his input). + +4. Added support for the themes "Arc" and "clearlooks"; updated the + support for the themes "Aquativo", "blue", "clam","keramik", + "keramik_alt", and "plastik". + +5. Extended the reference manual by the description of an important use + case for the "-formatcommand" column configuration option, related to + tablelist columns whose "-sortmode" option was set to "integer" or + "real" (thanks to Alexandru Dadalau for discussions on this subject). + +6. Fixed a bug related to retrieving the current cell selection (thanks + to Alexandru Dadalau for his bug report). + +7. Fixed a bug related to excluding the "dicttoitem" and "itemtodict" + subcommands for Tk 8.4 and earlier (thanks to Andy Goth for his bug + report). + +8. Numerous further improvements in the code, demo scripts, and + documentation. + +What was new in Tablelist 5.17? +------------------------------- + 1. Added the tree styles "arc", "blueMenta", "menta", "ubuntuMate", and "ubuntu3", inspired by the Arc icon theme (of the GTK 2/3 theme Arc) and some GTK 3 themes of the latest versions of the MATE desktop and @@ -66,7 +350,7 @@ What was new in Tablelist 5.16? 8 Drastically increased the speed of the "collapse" and "collapseall" subcommands with the "-fully" option (thanks to Ulrich Seidl for - reporting the pure performance of "collapseall -fully"). + reporting the poor performance of "collapseall -fully"). 9. Adapted the implementation of the "delete" subcommand to the changed text widget behavior in Tk 8.6.5 (thanks to Ulrich Seidl for his bug @@ -1444,7 +1728,7 @@ What was new in Tablelist 3.6? internal list (thanks to Patrick Fradin for his valuable input). 7. Fixed a bug related to the "-listvariable" option, introduced in - the previous Tablelist release (thanks to Torsten Reincke for his + the previous Tablelist release (thanks to Torsten Reincke for her bug report). 8. Fixed two bugs related to the "cellselection" subcommand (thanks to diff --git a/modules/tablelist/COPYRIGHT.txt b/modules/tablelist/COPYRIGHT.txt index f92b2874..a2369392 100644 --- a/modules/tablelist/COPYRIGHT.txt +++ b/modules/tablelist/COPYRIGHT.txt @@ -1,5 +1,5 @@ -Multi-column listbox and tree widget package Tablelist, version 5.17 -Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +Multi-column listbox and tree widget package Tablelist, version 6.6 +Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) This library is free software; you can use, modify, and redistribute it for any purpose, provided that existing copyright notices are retained diff --git a/modules/tablelist/ChangeLog b/modules/tablelist/ChangeLog index 6aafc40e..cc8b12dd 100644 --- a/modules/tablelist/ChangeLog +++ b/modules/tablelist/ChangeLog @@ -1,3 +1,332 @@ +2019-07-13 Csaba Nemethi + + * scripts/tablelistMove.tcl: Fixed a bug related to the "move" + subcommand. + + * CHANGES.txt: Updated. + +2019-07-13 Csaba Nemethi + + * scripts/tablelistConfig.tcl: Removed the restrictions related to the + * scripts/tablelistWidget.tcl: scrollutil::scrollarea widget. + +2019-07-08 Csaba Nemethi + + * scripts/tablelistWidget.tcl: Reverted the change in the procedure + tablelist::vertMoveTo. + +2019-07-06 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.6. + * COPYRIGHT.txt: + * README.txt: + * ../../examples/tablelist/*.tcl: + + * CHANGES.txt: Updated to reflect the changes. + + * scripts/*.tcl: Added mouse bindings for column-wise cell selection; + new "-selectfiltercommand" widget and column configuration option; + improved the interactive editing of multi-line cells; updated the + tree style "adwaita"; eliminated the flickering in the presence of + header items; fixed a bug related to the error handling in the + tablelist configuration at widget creation time in the presence of + the "-columntitles" option; several further improvements and minor + bug fixes. + + * scripts/tclIndex: Newly generated. + + * doc/*.html: Updated to reflect the changes; improved and extended the + description of the "-height" option in the reference manual; added + references to the new Scrollutil package and an example showing how + the scrollutil::scrollarea widget can be used to make the creation of + a scrolled tablelist quite simple. + + * doc/adwaita.png: Updated screenshots. + * doc/arrowStyles_vista.png: + +2019-04-18 Csaba Nemethi + + * CHANGES.txt: Slightly extended. + +2019-04-14 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.5. + * COPYRIGHT.txt: + * README.txt: + + * CHANGES.txt: Updated to reflect the changes. + * doc/*.html: + + * scripts/*.tcl: Added support for the virtual events + <> and + <>; optimized the vertical scrolling + by units; minor improvement related to the appearance of embedded + checkbuttons on X11; fixed a bug related to the "-showlabels" option; + fixed a few bugs specific to Mac OS X Aqua; fixed a bug related to + the handling of mouse wheel events during interactive cell editing; + fixed a bug related to the "move" subcommand; several further + improvements. + + * scripts/tclIndex: Newly generated. + + * ../../examples/tablelist/*.tcl: Bumped the version number to 6.5; + minor improvements. + + * doc/scrollbars.png: Updated screenshot. + +2019-01-07 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.4; updated the + * COPYRIGHT.txt: copyright information. + * README.txt: + + * CHANGES.txt: Updated to reflect the changes. + * doc/*.html: + + * scripts/*.tcl: Added the "-xmousewheelwindow" and + "-ymousewheelwindow" configuration options; optimized the deletion of + a list of items; improved the performance of the vertical scrolling; + eliminated a potential endless loop triggered by key navigation with + the "aqua" theme and selection type "cell"; fixed two regressions + introduced in Tablelist 6.3, related to (1) the handling of the + "-listvariable" option when using Itcl 3.x and (2) clearing the + multiple or extended selection; further improvements and minor bug + fixes; updated the copyright information. + + * scripts/tclIndex: Newly generated. + + * ../../examples/tablelist/*.tcl: Bumped the version number to 6.4; + minor bug fixes; updated the copyright information. + +2018-09-19 Csaba Nemethi + + * CHANGES.txt: Slightly extended. + + * scripts/tablelistConfig.tcl: Fixed a bug related to the "rowconfigure" + * scripts/tablelistWidget.tcl: subcommand, introduced in Tablelist 6.0. + +2018-09-01 Csaba Nemethi + + * scripts/tablelistConfig.tcl: Minor changes for TIP 278 conformance. + * scripts/tablelistThemes.tcl: + * scripts/tablelistUtil.tcl: + +2018-08-28 Csaba Nemethi + + * CHANGES.txt: Slightly extended. + + * scripts/tablelistWidget.tcl: Bugfixes and further optimizations. + +2018-08-18 Csaba Nemethi + + * CHANGES.txt: Updated to reflect the changes committed yesterday. + +2018-08-17 Csaba Nemethi + + * tablelistPublic.tcl: Adapted to some changes in future Tcl and Tk + * tablelist.tcl releases (TIP 278, independent Tcl and Tk + * tablelist_tile.tcl versions). + * scripts/mwutil.tcl + +2018-08-16 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.3. + * COPYRIGHT.txt: + * README.txt: + * ../../examples/tablelist/*.tcl: + + * CHANGES.txt: Updated to reflect the changes. + * doc/*.html: + + * scripts/*.tcl: Added the "-showbusycursor" configuration option and + the "setbusycursor" and "restorecursor" subcommands; the "-stretch" + option is no longer ignored if the width was specified as zero or + less; enhancements related to managing both scrollbars with the aid + of the "cornerpath" subcommand; optimizations in the item insertion + and the selection-related code; improved the interactive cell editing + with the aid of the ctext widget; made the overall handling of the + "-listvariable" option much more robust; fixed some bugs related to + the "-maxwidth" column configuration option, the "-displayondemand" + option, and the tooltip support; further improvements and minor bug + fixes. + + * scripts/tclIndex: Newly generated. + + * doc/browseTree.png: Updated screenshots. + * doc/dirViewer.png: + * doc/embeddedWindows.png: + * doc/embeddedWindows_tile.png: + + * doc/scrollbars.png: Added screenshot. + +2018-06-05 Csaba Nemethi + + * doc/tablelist.html: Using the "cornerpath" subcommand not + * doc/tablelistWidget.html: only on Mac OS X Aqua but also on + * ../../examples/tablelist/*.tcl: X11. + + * CHANGES.txt: Updated to reflect the changes. + + * doc/browse.png: Updated screenshots. + * doc/browseTree.png: + * doc/bwidget.png: + * doc/config.png: + * doc/dirViewer.png: + * doc/embeddedWindows.png: + * doc/embeddedWindows_tile.png: + * doc/styles.png: + * doc/tileWidgets.png: + +2018-05-25 Csaba Nemethi + + * doc/browseTree.png: Updated. + * doc/tablelist.html: + +2018-05-25 Csaba Nemethi + + * doc/tablelist.html: Minor correction. + +2018-05-22 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.2. + * COPYRIGHT.txt: + * README.txt: + * ../../examples/tablelist/*.tcl: + + * CHANGES.txt: Updated to reflect the changes. + * doc/*.html: + + * scripts/*.tcl: Added the "-labelvalign" column configuration option; + the "collapse" and "expand" subcommands now accept a list of indices + as first argument; significantly improved the overall performance of + tablelist widgets containing a tree structure, embedded images, or + multi-line cells; important improvements related to the scanning + performance and behavior; changed the default arrow style "flat7x5" + to "flat8x4" on the windowing system "x11" and for some tile themes; + fixed some bugs related to the interactive cell editing and the + handling of the "-listvariable" option in connection with snit + widgetadaptors; further code improvements and minor bug fixes. + + * scripts/tclIndex: Newly generated. + + * doc/arrowStyles_vista.png: Updated screenshots. + * doc/browse.png: + * doc/browseTree.png: + * doc/bwidget.png: + * doc/config.png: + * doc/dirViewer.png: + * doc/embeddedWindows.png: + * doc/embeddedWindows_tile.png: + * doc/styles.png: + * doc/tileWidgets.png: + +2018-03-05 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.1; + * COPYRIGHT.txt: updated the copyright information. + * README.txt: + * ../../examples/tablelist/*.tcl: + + * CHANGES.txt: Updated to reflect the changes. + + * scripts/*.tcl: Added the "-imagebackground" cell configuration option; + updated the copyright information. + + * doc/*.html: Updated to reflect the changes; more on the "bodytag" + subcommand in connection with embedded images etc. as drag sources. + +2018-02-12 Csaba Nemethi + + * CHANGES.txt: Updated. + +2018-01-08 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.0.1. + * COPYRIGHT.txt: + * README.txt: + * doc/index.html: + * doc/tablelist.html: + + * CHANGES.txt: Updated to reflect the changes. + + * scripts/tablelistUtil.tcl: Inserted the missing "]" in line #6448. + +2017-12-06 Csaba Nemethi + + * *.tcl: Bumped the version number to 6.0. + * COPYRIGHT.txt: + * README.txt: + + * CHANGES.txt: Updated to reflect the changes. + + * scripts/*.tcl: Added support for header items (aka title rows), added + the "embed(ttk)checkbutton" and "embed(ttk)checkbuttons" subcommands; + compatibility with the revised implementation of the text widget; + support for Tcl-only "dict" implementations; deleting all items has + become by orders of magnitude faster; guarded against invocations of + the "update" command when displaying the tooltip; "xview" and "yview" + now work as expected even if the decimal point is different from "."; + numerous further improvements. + + * scripts/tclIndex: Newly generated. + + * doc/*.html: Updated to reflect the changes. + + * doc/dirViewer.png: Updated screenshots + * doc/embeddedWindows.png: + * doc/embeddedWindows_tile.png: + + * ../../examples/*.tcl: Bumped the version number to 6.0; updates and + minor improvements. + +2017-06-24 Csaba Nemethi + + * scripts/tablelistWdget.tcl: Fixed a bug related to excluding the + "dicttoitem" and "itemtodict" subcommands for Tk 8.4 and earlier. + + * CHANGES.txt: Updated to reflect the changes. + +2017-06-23 Csaba Nemethi + + * scripts/tablelistWidget.tcl: Minor cleanup. + +2017-06-23 Csaba Nemethi + + * scripts/tablelistWidget.tcl: Corrected a typo. + +2017-06-23 Csaba Nemethi + + * *.tcl: Bumped the version number to 5.18. + * COPYRIGHT.txt: + * README.txt: + + * CHANGES.txt: Updated to reflect the changes. + + * scripts/*.tcl: Improved the performance of the vertical scrolling; + added the "-displayondemand" configuration option; added the + "tablelist::delaySashPosUpdates" command; added support for the + themes "Arc" and "clearlooks"; updated the support for a few other + themes; fixed a bug related to retrieving the current cell selection; + numerous further improvements. + + * scripts/tclIndex: Newly generated. + + * doc/*.html: Updated to reflect the changes; more on the + "-formatcommand" column configuration option in connection with + "-sortmode integer|real"; minor improvements. + + * doc/browse.png: Updated screenshots. + * doc/browseTree.png: + * doc/bwidget.png: + * doc/config.png: + * doc/dirViewer.png: + * doc/embeddedWindows.png: + * doc/embeddedWindows_tile.png: + * doc/tileWidgets.png: + + * ../../examples/*.tcl: Bumped the version number to 5.18; minor + improvements. + 2017-03-22 Csaba Nemethi * *.tcl: Bumped the version number to 5.17. diff --git a/modules/tablelist/README.txt b/modules/tablelist/README.txt index 268987a5..4c7bd712 100644 --- a/modules/tablelist/README.txt +++ b/modules/tablelist/README.txt @@ -43,11 +43,11 @@ pixels). The columns are, per default, resizable. The alignment of each column can be specified as "left", "right", or "center". The columns, rows, and cells can be configured individually. Several -of the global and column-specific options refer to the headers, +of the global and column-specific options refer to the header titles, implemented as label widgets. For instance, the "-labelcommand" option specifies a Tcl command to be invoked when mouse button 1 is released -over a label. The most common value of this option sorts the items -based on the respective column. +over a header label. The most common value of this option sorts the +items based on the respective column. The Tablelist package provides a great variety of tree styles controlling the look & feel of the column that displays the tree @@ -88,8 +88,8 @@ How to Get It? -------------- Tablelist is available for free download from the same URL as Wcb. The -distribution file is "tablelist5.17.tar.gz" for UNIX and -"tablelist5_17.zip" for Windows. These files contain the same +distribution file is "tablelist6.6.tar.gz" for UNIX and +"tablelist6_6.zip" for Windows. These files contain the same information, except for the additional carriage return character preceding the linefeed at the end of each line in the text files for Windows. @@ -108,16 +108,20 @@ locations of these library directories are given by the "tcl_library" and "tk_library" variables, respectively. To install Tablelist on UNIX, "cd" to the desired directory and unpack -the distribution file "tablelist5.17.tar.gz": +the distribution file "tablelist6.6.tar.gz": - gunzip -c tablelist5.17.tar.gz | tar -xf - + gunzip -c tablelist6.6.tar.gz | tar -xf - -This command will create a directory named "tablelist5.17", with the +On most UNIX systems this can be replaced with + + tar -zxf tablelist6.6.tar.gz + +Both commands will create a directory named "tablelist6.6 with the subdirectories "demos", "doc", and "scripts". On Windows, use WinZip or some other program capable of unpacking the -distribution file "tablelist5_17.zip" into the directory -"tablelist5.17", with the subdirectories "demos", "doc", and "scripts". +distribution file "tablelist6_6.zip" into the directory "tablelist6.6", +with the subdirectories "demos", "doc", and "scripts". The file "tablelistEdit.tcl" in the "scripts" directory is only needed for applications making use of interactive cell editing. Similarly, the diff --git a/modules/tablelist/doc/adwaita.png b/modules/tablelist/doc/adwaita.png index 7ac7229d..d10c8bc2 100644 Binary files a/modules/tablelist/doc/adwaita.png and b/modules/tablelist/doc/adwaita.png differ diff --git a/modules/tablelist/doc/arrowStyles_vista.png b/modules/tablelist/doc/arrowStyles_vista.png index 5c12b5b7..d3b8bde9 100644 Binary files a/modules/tablelist/doc/arrowStyles_vista.png and b/modules/tablelist/doc/arrowStyles_vista.png differ diff --git a/modules/tablelist/doc/browse.png b/modules/tablelist/doc/browse.png index 76319709..118fd30d 100644 Binary files a/modules/tablelist/doc/browse.png and b/modules/tablelist/doc/browse.png differ diff --git a/modules/tablelist/doc/browseTree.png b/modules/tablelist/doc/browseTree.png index 505e42ee..4ff3ea87 100644 Binary files a/modules/tablelist/doc/browseTree.png and b/modules/tablelist/doc/browseTree.png differ diff --git a/modules/tablelist/doc/bwidget.png b/modules/tablelist/doc/bwidget.png index 8a2ab5a3..50278aea 100644 Binary files a/modules/tablelist/doc/bwidget.png and b/modules/tablelist/doc/bwidget.png differ diff --git a/modules/tablelist/doc/config.png b/modules/tablelist/doc/config.png index 4fd0fb63..46552281 100644 Binary files a/modules/tablelist/doc/config.png and b/modules/tablelist/doc/config.png differ diff --git a/modules/tablelist/doc/dirViewer.png b/modules/tablelist/doc/dirViewer.png index 7d12b79d..199a80ed 100644 Binary files a/modules/tablelist/doc/dirViewer.png and b/modules/tablelist/doc/dirViewer.png differ diff --git a/modules/tablelist/doc/embeddedWindows.png b/modules/tablelist/doc/embeddedWindows.png index 34f29db0..884e89d5 100644 Binary files a/modules/tablelist/doc/embeddedWindows.png and b/modules/tablelist/doc/embeddedWindows.png differ diff --git a/modules/tablelist/doc/embeddedWindows_tile.png b/modules/tablelist/doc/embeddedWindows_tile.png index 78a87fda..af2ef5a6 100644 Binary files a/modules/tablelist/doc/embeddedWindows_tile.png and b/modules/tablelist/doc/embeddedWindows_tile.png differ diff --git a/modules/tablelist/doc/index.html b/modules/tablelist/doc/index.html index 5ed6c3e6..12d83212 100644 --- a/modules/tablelist/doc/index.html +++ b/modules/tablelist/doc/index.html @@ -1,7 +1,6 @@ - The Multi-Column Listbox and Tree Widget Package Tablelist - 5.17 + The Multi-Column Listbox and Tree Widget Package Tablelist 6.6
      -

      The Multi-Column Listbox and Tree Widget Package Tablelist 5.17

      +

      The Multi-Column Listbox and Tree Widget Package Tablelist 6.6

      by

      @@ -33,9 +32,11 @@

      Contents

      Commands for Interactive Sorting by One or More Columns

      -

      Helper Commands Used in Tablelist Binding +

      Commands Related to Binding Scripts

      +

      Commands Related to Tile Themes

      +

      Interactive Tablelist Cell Editing Using Tk Core Widgets

      @@ -56,7 +57,5 @@

      Contents

      Interactive Tablelist Cell Editing Using the Mentry Package

      - -

      Commands Related to Tile Themes

      diff --git a/modules/tablelist/doc/scrollbars.png b/modules/tablelist/doc/scrollbars.png new file mode 100644 index 00000000..3adf1f36 Binary files /dev/null and b/modules/tablelist/doc/scrollbars.png differ diff --git a/modules/tablelist/doc/styles.png b/modules/tablelist/doc/styles.png index 7bdc4f40..584e66d3 100644 Binary files a/modules/tablelist/doc/styles.png and b/modules/tablelist/doc/styles.png differ diff --git a/modules/tablelist/doc/tablelist.html b/modules/tablelist/doc/tablelist.html index a1f417bd..12dfacc5 100644 --- a/modules/tablelist/doc/tablelist.html +++ b/modules/tablelist/doc/tablelist.html @@ -13,7 +13,7 @@

      Tablelist Programmer's Guide

      -

      For Tablelist Version 5.17

      +

      For Tablelist Version 6.6

      by

      @@ -52,7 +52,7 @@

      Examples

    • A Directory Viewer Based on a tablelist
    • -
    • Improving the Look & Feel of a tablelist +
    • Improving the Look & Feel of a tablelist Widget
    • Advanced Interactive tablelist Cell @@ -119,15 +119,15 @@

      What Is Tablelist?

      center.

      The columns, rows, and cells can be configured individually.  Several - of the global and column-specific options refer to the headers, implemented - as label widgets.  For instance, the -labelcommand option - specifies a Tcl command to be invoked when mouse button 1 is released over a - label.  The most common value of this option sorts the items based on - the respective column.

      + of the global and column-specific options refer to the header titles, + implemented as label widgets.  For instance, the + -labelcommand option specifies a Tcl command to be invoked when + mouse button 1 is released over a header label.  The most common value + of this option sorts the items based on the respective column.

      The Tablelist package provides a great variety of tree styles controlling - the look & feel of the column that displays the tree hierarchy with the - aid of indentations and expand/collapse controls.

      + the look & feel of the column that displays the tree hierarchy with the aid + of indentations and expand/collapse controls.

      Interactive editing of the elements of a tablelist widget can be enabled for individual cells and for entire columns.  A great variety of widgets @@ -170,11 +170,10 @@

      What Is Tablelist?

      How to Get It?

      Tablelist is available for free download from the same URL as Wcb.  - The distribution file is tablelist5.17.tar.gz for UNIX and - tablelist5_17.zip for Windows.  These files contain the - same information, except for the additional carriage return character - preceding the linefeed at the end of each line in the text files for - Windows.

      + The distribution file is tablelist6.6.tar.gz for UNIX and + tablelist6_6.zip for Windows.  These files contain the same + information, except for the additional carriage return character preceding + the linefeed at the end of each line in the text files for Windows.

      Tablelist is also included in tklib, which has the address

      @@ -195,21 +194,29 @@

      How to Install It?

      To install Tablelist on UNIX, cd to the desired directory and unpack the distribution file - tablelist5.17.tar.gz:

      + tablelist6.6.tar.gz:

      -gunzip -c tablelist5.17.tar.gz | tar -xf -
      +gunzip -c tablelist6.6.tar.gz | tar -xf -
       
      -

      This command will create a directory named tablelist5.17, +

      On most UNIX systems this can be replaced with

      + +
      +
      +tar -zxf tablelist6.6.tar.gz
      +
      +
      + +

      Both commands will create a directory named tablelist6.6, with the subdirectories demos, doc, and scripts.

      On Windows, use WinZip or some other program capable of unpacking - the distribution file tablelist5_17.zip into the directory - tablelist5.17, with the subdirectories demos, + the distribution file tablelist6_6.zip into the directory + tablelist6.6, with the subdirectories demos, doc, and scripts.

      The file tablelistEdit.tcl in the scripts @@ -306,14 +313,14 @@

      How to Use It?

      tablelist and tablelist_tile.

      REMARK:  If you have an earlier Tablelist version as part of - ActiveTcl 8.5 or above and the new Tablelist release 5.17, then it is highly - recommended to specify the version number 5.17 in the  + ActiveTcl 8.5 or above and the new Tablelist release 6.6, then it is highly + recommended to specify the version number 6.6 in the  package require  command, because otherwise the interpreter will load the old Tablelist version included in ActiveTcl as Tcl Module.  The examples below use the - statement  package require tablelist 5.17,  and their + statement  package require tablelist 6.6,  and their tile-based counterparts invoke the command  package require - tablelist_tile 5.17.

      + tablelist_tile 6.6.

      Since the packages Tablelist and Tablelist_tile are implemented in the tablelist namespace, you must either invoke the

      @@ -342,7 +349,7 @@

      How to Use It?

    • The variable tablelist::scalingpct holds the scaling percentage used by Tablelist when adapting the sizes of the tree styles - vistaAero, vistaClassic, win7Aero, + vistaAero, vistaClassic, win7Aero, win7Classic, and win10 to the display's DPI scaling level.  The currently supported values are 100, 125, 150, and 200.  You can use @@ -354,7 +361,7 @@

      How to Use It?

    • The boolean variable tablelist::strictTk (having the default value 0) controls the strict listbox-compatibility of - the default bindings. + the default bindings.
    • The read-only boolean variable tablelist::usingTile has the value 0 in the package Tablelist and the value @@ -368,14 +375,14 @@

      How to Use It?

      More on Tablelist_tile

      A tablelist widget consists of a body (containing the items) and a header - (displaying the column titles).  Both components are contained in a - hull, implemented as a frame.  The header has a rather complex - structure, consisting mainly of frame and label widgets.  While in the - Tablelist package all of these components are Tk widgets, the Tablelist_tile - package uses both Tk and tile frame and label widgets.  Due to several - incompatibilities between Tk and tile, it is currently not possible to - replace all Tk widgets making up a tablelist with their tile - counterparts.

      + (displaying the column titles and optional header items).  Both + components are contained in a hull, implemented as a frame.  The header + has a rather complex structure, consisting, among others, of frame and label + widgets.  While in the Tablelist package all of these components are Tk + widgets, the Tablelist_tile package uses both Tk and tile frame and label + widgets.  Due to several incompatibilities between Tk and tile, it is + currently not possible to replace all Tk widgets making up a tablelist with + their tile counterparts.

      From the above it follows that the package Tablelist_tile will only work as expected if the Tk frame and label commands @@ -411,20 +418,19 @@

      More on Tablelist_tile

      describes the differences between the packages Tablelist and Tablelist_tile.

      -

      The Tablelist_tile package checks whether the required Tcl, Tk, and tile +

      The Tablelist_tile package checks whether the required Tk and tile versions are present, by executing the commands

      -package require Tcl 8.4
      -package require Tk  8.4
      +package require Tk 8.4
       if {$::tk_version < 8.5 || [regexp {^8\.5a[1-5]$} $::tk_patchLevel]} {
           package require tile 0.6
       }
       
      -

      The last command above reflects the fact that, beginning with Tk 8.5a6, +

      The second command above reflects the fact that, beginning with Tk 8.5a6, tile is integrated into the Tk core and therefore it should only be loaded explicitly when using an earlier Tk version.

      @@ -474,14 +480,15 @@

      A tablelist Widget for Displaying and Editing

      The file config.tcl in the demos directory contains a procedure demo::displayConfig that displays the configuration options of an arbitrary widget in a tablelist contained in a - newly created top-level widget and allows you to edit these options.  + newly created toplevel widget and allows you to edit these options.  This procedure can prove to be quite useful during interactive GUI development.  To test it, start wish and evaluate the file by using the source command as follows:

        -
      • If wish was started in the demos directory - then it is sufficient to enter +
      • + If wish was started in the demos directory then + it is sufficient to enter
        @@ -490,15 +497,16 @@ 

        A tablelist Widget for Displaying and Editing

      • -
      • If wish was started in some other directory then you can - use the tablelist::library variable to find the location of - the file.  For example, assuming that your Tablelist installation has - the directory structure described in the How to - install it? section, the required commands are: +
      • + If wish was started in some other directory then you can use + the tablelist::library variable to find the location of the + file.  For example, assuming that your Tablelist installation has + the directory structure described in the How to + install it? section, the required commands are:
        -package require tablelist 5.17
        +package require tablelist 6.6
         source [file join $tablelist::library demos config.tcl]
         
        @@ -540,8 +548,7 @@

        A tablelist Widget for Displaying and Editing the following figure:

        - Configuration Options + Configuration Options

        It is assumed that the Tcl command associated with the widget specified by @@ -555,13 +562,13 @@

        A tablelist Widget for Displaying and Editing
        -package require tablelist 5.17
        +package require tablelist 6.6
         
         namespace eval demo {
             #
             # Get the current windowing system ("x11", "win32", "classic", or "aqua")
             # and add some entries to the Tk option database for the following
        -    # widget hierarchy within a top-level widget of the class DemoTop:
        +    # widget hierarchy within a toplevel widget of the class DemoTop:
             #
             # Name              Class
             # -----------------------------
        @@ -588,12 +595,11 @@ 

        A tablelist Widget for Displaying and Editing option add *DemoTop*Font TkDefaultFont option add *DemoTop*selectBackground #5294e2 option add *DemoTop*selectForeground white - } else { - option add *DemoTop.tf.borderWidth 1 - option add *DemoTop.tf.relief sunken - option add *DemoTop.tf.tbl.borderWidth 0 - option add *DemoTop.tf.tbl.highlightThickness 0 } + option add *DemoTop.tf.borderWidth 1 + option add *DemoTop.tf.relief sunken + option add *DemoTop.tf.tbl.borderWidth 0 + option add *DemoTop.tf.tbl.highlightThickness 0 option add *DemoTop.tf.tbl.background white option add *DemoTop.tf.tbl.stripeBackground #f0f0f0 option add *DemoTop.tf.tbl.setGrid yes @@ -605,7 +611,7 @@

        A tablelist Widget for Displaying and Editing # demo::displayConfig # # Displays the configuration options of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayConfig w { @@ -617,7 +623,7 @@

        A tablelist Widget for Displaying and Editing } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .configTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -628,7 +634,7 @@

        A tablelist Widget for Displaying and Editing # # Create a scrolled tablelist widget with 5 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf frame $tf @@ -653,7 +659,7 @@

        A tablelist Widget for Displaying and Editing scrollbar $hsb -orient horizontal -command [list $tbl xview] # - # Create three buttons within a frame child of the top-level widget + # Create three buttons within a frame child of the toplevel widget # set bf $top.bf frame $bf @@ -669,11 +675,11 @@

        A tablelist Widget for Displaying and Editing # grid $tbl -row 0 -rowspan 2 -column 0 -sticky news variable winSys - if {[string compare $winSys "aqua"] == 0} { + if {[string compare $winSys "win32"] == 0} { + grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns + } else { grid [$tbl cornerpath] -row 0 -column 1 -sticky ew grid $vsb -row 1 -column 1 -sticky ns - } else { - grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns } grid $hsb -row 2 -column 0 -sticky ew grid rowconfigure $tf 1 -weight 1 @@ -742,7 +748,7 @@

        A tablelist Widget for Displaying and Editing

        The -editendcommand option specifies the command to be invoked automatically whenever the interactive - editing of a cell's contents is finished and the final contents of the + editing of a cell's content is finished and the final content of the temporary embedded entry widget used for the editing are different from its original one.  Per default, the elements of a tablelist widget can only be edited programmatically, but we enable the interactive editing for the @@ -777,12 +783,15 @@

        A tablelist Widget for Displaying and Editing #f0f0f0, which improves the readability of the items and gives the widget a nice appearance.

        -

        The option database entries given for the windowing systems other than - x11 are implicitly used when managing the tablelist widget and - the two scrollbars with the aid of grid.  Notice how the - cornerpath - subcommand enables us to achieve a native look & feel with respect to the - vertical scrollbar on the windowing system aqua.

        +

        The option database entries for *DemoTop.tf.borderWidth, + *DemoTop.tf.relief, *DemoTop.tf.tbl.borderWidth, + and *DemoTop.tf.tbl.highlightThickness are implicitly used when + managing the tablelist widget and the two scrollbars with the aid of + grid.  Notice how the cornerpath subcommand enables us + to achieve a native look & feel with respect to the vertical scrollbar on the + windowing systems other than win32 (i.e., aqua and + x11).

        We populate the tablelist by invoking the demo::putConfig procedure discussed below.  The same script is associated with the @@ -964,7 +973,7 @@

        A tablelist Widget for Displaying and Editing with 1 or 0, even if the entry contains the string yes or no.  The procedure returns this canonical option value, thus making sure that the latter will become the new - contents of the cell that was just edited.

        + content of the cell that was just edited.

        Two Widget Browsers Based on a tablelist

        @@ -972,7 +981,7 @@

        Two Widget Browsers Based on a tablelist

        demos directory contain a procedure demo::displayChildren that displays information about the children of an arbitrary widget in a tablelist contained in a newly created - top-level widget.  To test it, start wish and evaluate the + toplevel widget.  To test it, start wish and evaluate the chosen file by using the source command, in a similar way as in the case of the previous example.

        @@ -1003,14 +1012,14 @@

        Two Widget Browsers Based on a tablelist

        in the file browse.tcl is a multi-column listbox:

        - Widget Browser + Widget Browser

        The tablelist created by the procedure of the same name in the file browseTree.tcl is a multi-column tree widget:

        - Widget Browser + Widget Browser

        The demo::displayChildren command inserts some data of the @@ -1034,7 +1043,7 @@

        Two Widget Browsers Based on a tablelist

         package require Tk 8.3
        -package require tablelist 5.17
        +package require tablelist 6.6
         
         namespace eval demo {
             variable dir [file dirname [info script]]
        @@ -1054,7 +1063,7 @@ 

        Two Widget Browsers Based on a tablelist

        # demo::displayChildren # # Displays information on the children of the widget w in a tablelist widget -# contained in a newly created top-level widget. Returns the name of the +# contained in a newly created toplevel widget. Returns the name of the # tablelist widget. #------------------------------------------------------------------------------ proc demo::displayChildren w { @@ -1066,7 +1075,7 @@

        Two Widget Browsers Based on a tablelist

        } # - # Create a top-level widget of the class DemoTop + # Create a toplevel widget of the class DemoTop # set top .browseTop for {set n 2} {[winfo exists $top]} {incr n} { @@ -1076,7 +1085,7 @@

        Two Widget Browsers Based on a tablelist

        # # Create a vertically scrolled tablelist widget with 9 dynamic-width - # columns and interactive sort capability within the top-level + # columns and interactive sort capability within the toplevel # set tf $top.tf frame $tf @@ -1134,7 +1143,7 @@

        Two Widget Browsers Based on a tablelist

        bind $bodyTag <<Button3>> +[list demo::postPopupMenu $top %X %Y] # - # Create three buttons within a frame child of the top-level widget + # Create three buttons within a frame child of the toplevel widget # set bf $top.bf frame $bf @@ -1335,7 +1344,7 @@

        Two Widget Browsers Based on a tablelist

        We mark every newly created row corresponding to a child widget that has children itself as collapsed by invoking the collapse subcommand.  This - will prepend an expand/collapse control to the contents of the first column, + will prepend an expand/collapse control to the content of the first column, whose column index 0 is the default value of the -treecolumn configuration option.

        @@ -1400,7 +1409,7 @@

        Two Widget Browsers Based on a tablelist

        #------------------------------------------------------------------------------ # demo::labelCmd # -# Sorts the contents of the tablelist widget tbl by its col'th column and makes +# Sorts the content of the tablelist widget tbl by its col'th column and makes # sure the items will be updated 500 ms later (because one of the items might # refer to a canvas containing the arrow that displays the sorting order). #------------------------------------------------------------------------------ @@ -1566,7 +1575,7 @@

        Two Widget Browsers Based on a tablelist

        -

        Before redisplaying the tablelist's contents via +

        Before redisplaying the tablelist's content via demo::putChildren, we get the full keys of the currently expanded items with the aid of the expandedkeys tablelist @@ -1616,11 +1625,11 @@

        A Directory Viewer Based on a tablelist

        as multi-column tree widget:

        - Directory Viewer + Directory Viewer

        By double-clicking an item or invoking the single entry of a pop-up menu - within the body of the tablelist, you can display the contents of the folder + within the body of the tablelist, you can display the content of the folder corresponding to the selected item.  To go one level up, click on the Parent button.

        @@ -1632,7 +1641,7 @@

        A Directory Viewer Based on a tablelist

         package require Tk 8.3
        -package require tablelist 5.17
        +package require tablelist 6.6
         
         #
         # Add some entries to the Tk option database
        @@ -1650,7 +1659,7 @@ 

        A Directory Viewer Based on a tablelist

        #------------------------------------------------------------------------------ # displayContents # -# Displays the contents of the directory dir in a tablelist widget. +# Displays the content of the directory dir in a tablelist widget. #------------------------------------------------------------------------------ proc displayContents dir { # @@ -1681,7 +1690,7 @@

        A Directory Viewer Based on a tablelist

        . . . # - # Populate the tablelist with the contents of the given directory + # Populate the tablelist with the content of the given directory # $tbl sortbycolumn 0 putContents $dir $tbl root @@ -1693,20 +1702,15 @@

        A Directory Viewer Based on a tablelist

        and the two scrollbars as children of a frame of class ScrollArea.  For this class, the file option.tcl, sourced into the main script, contains - some look & feel related settings similar to the ones encountered in our + some look & feel related settings similar to the ones encountered in our first example:

        -if {[string compare $winSys "x11"] == 0} {
        -    . . .
        -} else {
        -    option add *ScrollArea.borderWidth                  1
        -    option add *ScrollArea.relief                       sunken
        -    option add *ScrollArea.Tablelist.borderWidth        0
        -    option add *ScrollArea.Tablelist.highlightThickness 0
        -    . . .
        -}
        +option add *ScrollArea.borderWidth                      1
        +option add *ScrollArea.relief                           sunken
        +option add *ScrollArea.Tablelist.borderWidth            0
        +option add *ScrollArea.Tablelist.highlightThickness     0
         
        @@ -1722,7 +1726,7 @@

        A Directory Viewer Based on a tablelist

        #------------------------------------------------------------------------------ # putContents # -# Outputs the contents of the directory dir into the tablelist widget tbl, as +# Outputs the content of the directory dir into the tablelist widget tbl, as # child items of the one identified by nodeIdx. #------------------------------------------------------------------------------ proc putContents {dir tbl nodeIdx} { @@ -1748,7 +1752,7 @@

        A Directory Viewer Based on a tablelist

        # # Build a list from the data of the subdirectories and # files of the directory dir. Prepend a "D" or "F" to - # each entry's name and modification date & time, for + # each entry's name and modification date & time, for # sorting purposes (it will be removed by formatString). # set itemList {} @@ -1793,7 +1797,7 @@

        A Directory Viewer Based on a tablelist

        # # Mark the row as collapsed if the directory is non-empty # - if {[file readable $name] && [llength \ + if {[file readable $name] && [llength \ [glob -nocomplain -types {d f} -directory $name *]] != 0} { $tbl collapse $row } @@ -1883,7 +1887,7 @@

        A Directory Viewer Based on a tablelist

        #------------------------------------------------------------------------------ # expandCmd # -# Outputs the contents of the directory whose leaf name is displayed in the +# Outputs the content of the directory whose leaf name is displayed in the # first cell of the specified row of the tablelist widget tbl, as child items # of the one identified by row, and updates the image displayed in that cell. #------------------------------------------------------------------------------ @@ -1918,7 +1922,7 @@

        A Directory Viewer Based on a tablelist

        displayContents with an empty string as argument, i.e., displays the volumes mounted on the system.

        -

        Improving the Look & Feel of a tablelist Widget

        +

        Improving the Look & Feel of a tablelist Widget

        The script styles.tcl in the demos directory demonstrates some ways of making tablelist widgets smarter and improving the @@ -1926,7 +1930,7 @@

        Improving the Look & Feel of a tablelist Widget

        the following figure:

        - Styles + Styles

        Here is the relevant code segment:

        @@ -2009,21 +2013,23 @@

        Advanced Interactive tablelist Cell Editing

        from the Tk core and from the packages tile, BWidget, Iwidgets, combobox (by Bryan Oakley), ctext, and Mentry (or Mentry_tile) for interactive cell editing.  The following figure shows the tablelist widget, together with - a BWidget ComboBox used to edit the contents of one of its cells:

        + a BWidget ComboBox used to edit the content of one of its cells:

        Serial Line Configuration + "409">

        Here is the relevant code segment from the script bwidget.tcl (the scripts tileWidgets.tcl, iwidgets.tcl, and - miscWidgets.tcl are similar):

        + miscWidgets.tcl are similar).  A few parts of the code are + shown in red color – we will return to this towards the + end of the section.

         package require Tk 8.4                          ;# because of "-compound"
        -package require tablelist 5.17
        +package require tablelist 6.6
         package require BWidget
         
         wm title . "Serial Line Configuration"
        @@ -2033,9 +2039,7 @@ 

        Advanced Interactive tablelist Cell Editing

        # set dir [file dirname [info script]] source [file join $dir option.tcl] -option add *Tablelist*Checkbutton.background white -option add *Tablelist*Checkbutton.activeBackground white -option add *Tablelist*Entry.background white +option add *Tablelist*Entry.background white # # Register some widgets from the BWidget package for interactive cell editing @@ -2072,7 +2076,7 @@

        Advanced Interactive tablelist Cell Editing

        $tbl configure -spacing 1 } $tbl columnconfigure 0 -sortmode integer -$tbl columnconfigure 1 -name available -editable yes -editwindow checkbutton \ +$tbl columnconfigure 1 -name available -editable yes -editwindow checkbutton \ -formatcommand emptyStr $tbl columnconfigure 2 -name lineName -editable yes -editwindow Entry \ -sortmode dictionary @@ -2095,15 +2099,15 @@

        Advanced Interactive tablelist Cell Editing

        # # Populate the tablelist widget; set the activation -# date & time to 10 minutes past the current clock value +# date & time to 10 minutes past the current clock value # set clock [expr {[clock seconds] + 600}] for {set i 0; set n 1} {$i < 16} {set i $n; incr n} { $tbl insert end [list $n [expr {$i < 8}] "Line $n" 9600 8 None 1 XON/XOFF \ $clock $clock [lindex $colorNames $i]] - set availImg [expr {($i < 8) ? "checkedImg" : "uncheckedImg"}] - $tbl cellconfigure end,available -image $availImg + set availImg [expr {($i < 8) ? "checkedImg" : "uncheckedImg"}] + $tbl cellconfigure end,available -image $availImg $tbl cellconfigure end,color -image img[lindex $colorValues $i] } @@ -2206,7 +2210,7 @@

        Advanced Interactive tablelist Cell Editing

        $w configure -values {50 75 110 300 1200 2400 4800 9600 19200 38400 57600 115200 230400 460800 921600} $w configure -invalidcommand bell -validate key -validatecommand \ - {expr {[string length %P] <= 6 && [regexp {^[0-9]*$} %S]}} + {expr {[string length %P] <= 6 && [regexp {^[0-9]*$} %S]}} } dataBits { @@ -2250,9 +2254,9 @@

        Advanced Interactive tablelist Cell Editing

        "tablelistWidget.html#editendcommand">-editendcommand configuration option, is responsible for a final validation of the edit window's text.  Another purpose of this command is to convert the text - contained in the edit window to the cell's new internal contents, - which is necessary because the internal value of the activation date and time - is a clock value in seconds:

        + contained in the edit window to the cell's new internal content, which + is necessary because the internal value of the activation date and time is a + clock value in seconds:

        @@ -2260,17 +2264,17 @@ 

        Advanced Interactive tablelist Cell Editing

        # editEndCmd # # Performs a final validation of the text contained in the edit window and gets -# the cell's internal contents. +# the cell's internal content. #------------------------------------------------------------------------------ proc editEndCmd {tbl row col text} { switch [$tbl columncget $col -name] { - available { + available { # # Update the image contained in the cell # set img [expr {$text ? "checkedImg" : "uncheckedImg"}] $tbl cellconfigure $row,$col -image $img - } + } baudRate { # @@ -2305,7 +2309,7 @@

        Advanced Interactive tablelist Cell Editing

        if {$actClock <= [clock seconds]} { bell tk_messageBox -title "Error" -icon error -message \ - "The activation date & time must be in the future" + "The activation date & time must be in the future" $tbl rejectinput } else { $tbl cellconfigure $row,actTime -text $actClock @@ -2328,6 +2332,31 @@

        Advanced Interactive tablelist Cell Editing

        +

        Instead of making the "Available" column editable via a + temporary checkbutton and displaying the images + "checkedImg" and "uncheckedImg" in its cells, we + can use the embedcheckbuttons + subcommand to populate the column with persistently embedded + checkbuttons.  The necessary changes are as follows:

        + +
          +
        • Remove those parts of the code above that are shown in + red color.
        • + +
        • + Invoke + +
          +
          +$tbl embedcheckbuttons 1
          +
          +
          + + after populating the tablelist widget. +
        • +
        +

        As mentioned above, the scripts tileWidgets.tcl, iwidgets.tcl, and miscWidgets.tcl are similar to bwidget.tcl.  The first one makes use of the tile entry, @@ -2356,15 +2385,15 @@

        A tablelist Widget Containing Embedded Windows

        active state:

        - Embedded Windows + Embedded Windows

        First, we create and populate the tablelist widget:

        -package require tablelist 5.17
        +package require tablelist 6.6
         
         wm title . "Tk Library Scripts"
         
        @@ -2424,25 +2453,38 @@ 

        A tablelist Widget Containing Embedded Windows

        # Populate the tablelist widget # cd $tk_library -set maxFileSize 0 +set totalSize 0 +set maxSize 0 foreach fileName [lsort [glob *.tcl]] { set fileSize [file size $fileName] $tbl insert end [list $fileName $fileSize $fileSize "" no] - if {$fileSize > $maxFileSize} { - set maxFileSize $fileSize + incr totalSize $fileSize + if {$fileSize > $maxSize} { + set maxSize $fileSize } } +if {$tk_version >= 8.5} { + $tbl header insert 0 [list "[$tbl size] *.tcl files" "" $totalSize "" ""] + $tbl header rowconfigure 0 -foreground blue +}

        We insert the size of each file not only into the column with the - title  "File Size" , but also into the column  + title  "File Size",  but also into the column  "Bar Chart".  Since we configured this column with  -formatcommand emptyStr,  the text will remain hidden in it.  It will, however, be needed when sorting the items by that column.

        +

        After populating the tablelist's body, we create a header item displaying + the total number and size of the library files, by invoking the  + header + insert  subcommand, and change its foreground color with the + aid of the  header + rowconfigure  subcommand.

        +

        To be able to create the embedded windows, we have first to implement the creation scripts for them, as specified in the description of the -window cell @@ -2478,7 +2520,7 @@

        A tablelist Widget Containing Embedded Windows

        # Manage the child frame # set fileSize [$tbl cellcget $row,fileSize -text] - place $w.f -relwidth [expr {double($fileSize) / $::maxFileSize}] + place $w.f -relwidth [expr {double($fileSize) / $::maxSize}] }
        @@ -2516,13 +2558,14 @@

        A tablelist Widget Containing Embedded Windows

        #------------------------------------------------------------------------------ # viewFile # -# Displays the contents of the file whose name is contained in the row with the +# Displays the content of the file whose name is contained in the row with the # given key of the tablelist widget tbl. #------------------------------------------------------------------------------ proc viewFile {tbl key} { set top .top$key if {[winfo exists $top]} { raise $top + focus $top return "" } @@ -2543,10 +2586,10 @@

        A tablelist Widget Containing Embedded Windows

        scrollbar $vsb -orient vertical -command [list $txt yview] # - # Insert the file's contents into the text widget + # Insert the file's content into the text widget # set chan [open $fileName] - $txt insert end [read $chan] + $txt insert end [read -nonewline $chan] close $chan . . . @@ -2560,14 +2603,14 @@

        A tablelist Widget Containing Embedded Windows

        -

        Each file will be displayed in a text widget contained in a top-level - whose name is .top$key, where $key is obtained with - the aid of the getkeys subcommand.  By using - the key instead of the row number, we will have a unique name for the - top-level, even if the order of the items changes due to interactive sorting - by a column.  (Remember that the embedded windows will be destroyed and - automatically recreated when sorting the items or moving the columns.)

        +

        Each file will be displayed in a text widget contained in a toplevel whose + name is .top$key, where $key is obtained with the + aid of the getkeys + subcommand.  By using the key instead of the row number, we will have a + unique name for the toplevel, even if the order of the items changes due to + interactive sorting by a column.  (Remember that the embedded windows + will be destroyed and automatically recreated when sorting the items or + moving the columns.)

        Having implemented the creation scripts for the frames and buttons, we can now use the Tile-Based Demo Scripts

         package require Tk 8.3                          ;# because of entry validation
        -package require tablelist 5.17
        +package require tablelist 6.6
         
        @@ -2616,7 +2659,7 @@

        Tile-Based Demo Scripts

        -package require tablelist_tile 5.17
        +package require tablelist_tile 6.6
         
        @@ -2716,13 +2759,13 @@

        Tile-Based Demo Scripts

        The demo script tileWidgets.tcl uses not only the Tablelist_tile package for creating a tablelist widget with a modern - theme-specific look & feel, but also the tile entry, spinbox, combobox, + theme-specific look & feel, but also the tile entry, spinbox, combobox, checkbutton, and menubutoon widgets for interactive cell editing.  The resulting window has a nice theme-specific appearance:

        Serial Line Configuration + height="404">

        The tile-based version of the demo script Tile-Based Demo Scripts

      Embedded Windows + height="316">
      diff --git a/modules/tablelist/doc/tablelistBWidget.html b/modules/tablelist/doc/tablelistBWidget.html index 86ef59ff..3a8a6acd 100644 --- a/modules/tablelist/doc/tablelistBWidget.html +++ b/modules/tablelist/doc/tablelistBWidget.html @@ -12,7 +12,7 @@

      Interactive Tablelist Cell Editing Using the BWidget Package

      -

      For Tablelist Version 5.17

      +

      For Tablelist Version 6.6

      by

      diff --git a/modules/tablelist/doc/tablelistBinding.html b/modules/tablelist/doc/tablelistBinding.html index a6210b3a..75458e24 100644 --- a/modules/tablelist/doc/tablelistBinding.html +++ b/modules/tablelist/doc/tablelistBinding.html @@ -1,6 +1,6 @@ - Helper Commands Used in Tablelist Binding Scripts + Commands Related to Binding Scripts @@ -10,9 +10,9 @@
      -

      Helper Commands Used in Tablelist Binding Scripts

      +

      Commands Related to Binding Scripts

      -

      For Tablelist Version 5.17

      +

      For Tablelist Version 6.6

      by

      @@ -37,6 +37,9 @@

      Contents

    • The tablelist::getTablelistColumn Command
    • + +
    • The + tablelist::delaySashPosUpdates Command
    @@ -46,17 +49,24 @@

    Contents

    Overview

    -

    The commands described in this reference page are designed to be used in - binding scripts associated with the binding tags whose names are returned by - the bodytag - and labeltag - subcommands of the Tcl command associated with a tablelist widget.  The - first two of these commands are also used in the default binding scripts - associated with the binding tag TablelistBody.  For - details and examples see the sections DEFAULT AND INDIVIDUAL BINDINGS FOR THE - TABLELIST BODY and DEFAULT - AND INDIVIDUAL BINDINGS FOR THE HEADER LABELS.

    +

    The first three commands described in this reference page are designed to + be used in binding scripts associated with the binding tags whose names are + returned by the bodytag and labeltag subcommands of the + Tcl command associated with a tablelist widget.  The first two of these + commands are also used in the default binding scripts associated with the + binding tag TablelistBody.  For details and examples + see the sections DEFAULT AND + INDIVIDUAL BINDINGS FOR THE TABLELIST BODY and DEFAULT AND INDIVIDUAL BINDINGS FOR THE + HEADER LABELS.

    + +

    The last command is related to the default binding scripts for Tk core + panedwindow and ttk::panedwindow widgets.  It can be used to control the + frequency of the sash position updates, which might be necessary to eliminate + some artifacts caused by dragging a sash if one or more of the panes contains + a tablelist widget with embedded images.

    Contents     The tablelist::convEventFields

     foreach {tablelist::W tablelist::x tablelist::y} \
    -    [tablelist::convEventFields %W %x %y] {}
    +    [tablelist::convEventFields %W %x %y] {}
     
    @@ -197,6 +207,62 @@

    The
    tablelist, path name, binding script
    +
    +
    + +

    The + tablelist::delaySashPosUpdates Command

    + +
    +
    NAME
    + +
    tablelist::delaySashPosUpdates – Set a delay for the + panedwindow sash position updates
    + +
    SYNOPSIS
    + +
    +
    +tablelist::delaySashPosUpdates panedwindowPathName ms
    +
    +
    + +
    DESCRIPTION
    + +
    This command sets a delay for the updates of the sash position caused + by dragging a sash of the panedwindow widget specified by the first + argument, which must be the path name of a Tk core panedwindow or + ttk::panedwindow widget.  ms must be an integer + giving the delay in milliseconds.  If this number is non-negative then + the sash position updates via  sash place ...  + (for a Tk core panedwindow widget) or  sashpos + ...  (for a ttk::panedwindow widget) will be scheduled for + execution ms milliseconds later, in such a way that, + until the time for an already scheduled update expires, new drag events + won't schedule new update operations (only their data will be + remembered).  This will reduce the frequency of the sash position + updates caused by dragging a sash of the specified widget, depending on the + value of ms.  If this number is negative then any + dragging of a sash of the specified widget will immediately trigger an + update of the sash position, as implemented in the default binding scripts + for Tk core panedwindow and ttk::panedwindow widgets.
    + +
    This command can be used to control the frequency of the + sash position updates for a given panedwindow widget, which might be + necessary to eliminate some artifacts caused by dragging a sash if one or + more of the panes contains a tablelist widget with embedded images.  + The value of ms (typically a number between 10 and 100) + is application- and platform-specific (on Windows and Mac OS X Aqua you + will need a higher value than on X11).
    + +
    KEYWORDS
    + +
    panedwindow, tablelist, path name, binding script
    +
    +

    Contents     Start page

    diff --git a/modules/tablelist/doc/tablelistColSort.html b/modules/tablelist/doc/tablelistColSort.html index 82e87f22..0090591b 100644 --- a/modules/tablelist/doc/tablelistColSort.html +++ b/modules/tablelist/doc/tablelistColSort.html @@ -12,7 +12,7 @@

    Commands for Interactive Sorting by One or More Columns

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    diff --git a/modules/tablelist/doc/tablelistCombobox.html b/modules/tablelist/doc/tablelistCombobox.html index 9799ea84..fcdb2f3b 100644 --- a/modules/tablelist/doc/tablelistCombobox.html +++ b/modules/tablelist/doc/tablelistCombobox.html @@ -12,7 +12,7 @@

    Interactive Tablelist Cell Editing Using the combobox Package

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    diff --git a/modules/tablelist/doc/tablelistCtext.html b/modules/tablelist/doc/tablelistCtext.html index 1dcb21ce..41e80f2e 100644 --- a/modules/tablelist/doc/tablelistCtext.html +++ b/modules/tablelist/doc/tablelistCtext.html @@ -12,7 +12,7 @@

    Interactive Tablelist Cell Editing Using the ctext Package

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    @@ -118,8 +118,8 @@

    The tablelist::addCtext Command

    display lines (taking into account the line wraps) contained in it.  You can use the script corresponding to the -editstartcommand - tablelist configuration option to override the initial settings according - to your needs. + tablelist configuration option to override the initial settings (except + the height) according to your needs.
    If the ctext widget's -wrap option was set to word or char (either by @@ -128,7 +128,7 @@

    The tablelist::addCtext Command

    interactive column resizing), its height will be set automatically to the number of display lines contained in it.  (The number of display lines is retrieved with the aid of the  count - -displaylines  ctext widget subcommand, introduced in Tk + -displaylines
      text widget subcommand, introduced in Tk 8.5.)
    If the widget callback package Wcb was loaded into the diff --git a/modules/tablelist/doc/tablelistIwidgets.html b/modules/tablelist/doc/tablelistIwidgets.html index cd952373..1be824cc 100644 --- a/modules/tablelist/doc/tablelistIwidgets.html +++ b/modules/tablelist/doc/tablelistIwidgets.html @@ -12,7 +12,7 @@

    Interactive Tablelist Cell Editing Using the Iwidgets Package

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    @@ -161,7 +161,7 @@

    The tablelist::addIncrDateTimeWidget present then the finishediting subcommand of the Tcl command associated with the tablelist widget will - retrieve the contents of the embedded window used for interactive cell + retrieve the content of the embedded window used for interactive cell editing as an integer clock value (in seconds), otherwise as a string.  Use this option for tablelist widgets whose internal list contains date or time information in seconds (displayed with the aid of @@ -333,8 +333,9 @@

    The tablelist::addIncrCombobox
    The temporary embedded combobox widget associated with the above name will be created with its - -editable option set to 1.  You can - use the script corresponding to the -editable option set to 1 and its + -grab option set to global.  + You can use the script corresponding to the -editstartcommand tablelist configuration option to make the combobox non-editable or define validations for it, as well as for populating its listbox component (by diff --git a/modules/tablelist/doc/tablelistMentry.html b/modules/tablelist/doc/tablelistMentry.html index 37df8880..7e31b702 100644 --- a/modules/tablelist/doc/tablelistMentry.html +++ b/modules/tablelist/doc/tablelistMentry.html @@ -12,7 +12,7 @@

    Interactive Tablelist Cell Editing Using the Mentry Package

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    @@ -142,7 +142,7 @@

    The tablelist::addDateMentry Command

    column configuration option).  The finishediting subcommand of the Tcl command associated with the tablelist widget will - retrieve the contents of the embedded window used for interactive cell + retrieve the content of the embedded window used for interactive cell editing by invoking the mentry::getClockVal command.  The value returned by this command (a clock value in seconds or one of the error strings "EMPTY", "BAD", @@ -151,7 +151,7 @@

    The tablelist::addDateMentry Command

    "tablelistWidget.html#editendcommand">-editendcommand
    tablelist configuration option (if any), as its last argument.  If this value is one of the above error strings then the script should reject - the mentry's contents by invoking the rejectinput subcommand.
    @@ -210,7 +210,7 @@

    The tablelist::addTimeMentry Command

    column configuration option).  The finishediting subcommand of the Tcl command associated with the tablelist widget will - retrieve the contents of the embedded window used for interactive cell + retrieve the content of the embedded window used for interactive cell editing by invoking the mentry::getClockVal command.  The value returned by this command (a clock value in seconds or one of the error strings "EMPTY" or "BAD") @@ -218,7 +218,7 @@

    The tablelist::addTimeMentry Command

    "tablelistWidget.html#editendcommand">-editendcommand
    tablelist configuration option (if any), as its last argument.  If this value is one of the above error strings then the script should reject - the mentry's contents by invoking the rejectinput subcommand.

    @@ -260,10 +260,10 @@

    The tablelist::addDateTimeMentry arguments have the same meanings as in the mentry::dateTimeMentry command.  If the -gmt argument is present then both the internal clock - value and its external date & time representation in the mentry widget - will be viewed as Greenwich Mean Time, otherwise as local time.  The - second optional argument specifies the name to be used for the mentry - widget as the value of the -editwindow column or cell configuration option.  It may be any string that is different from the Tk core and The tablelist::addDateTimeMentry
    A tablelist column having the above name as the value of its -editwindow option must contain as - internal cell values date & time information in seconds (displayed with - the aid of a command given by the -formatcommand column configuration option).  The finishediting subcommand of the Tcl command associated with the tablelist widget will - retrieve the contents of the embedded window used for interactive cell + retrieve the content of the embedded window used for interactive cell editing by invoking the mentry::getClockVal command.  The value returned by this command (a clock value in seconds or one of the error strings "EMPTY", "BAD", @@ -288,7 +288,7 @@

    The tablelist::addDateTimeMentry "tablelistWidget.html#editendcommand">-editendcommand tablelist configuration option (if any), as its last argument.  If this value is one of the above error strings then the script should reject - the mentry's contents by invoking the rejectinput subcommand.

    @@ -346,7 +346,7 @@

    The tablelist::addFixedPointMentry real numbers as internal cell values.  The finishediting subcommand of the Tcl command associated with the tablelist widget will - retrieve the contents of the embedded window used for interactive cell + retrieve the content of the embedded window used for interactive cell editing by invoking the mentry::getReal command.  The value returned by this command (a real number or the error string "EMPTY") will be passed to the script corresponding to the @@ -354,7 +354,7 @@

    The tablelist::addFixedPointMentry "tablelistWidget.html#editendcommand">-editendcommand tablelist configuration option (if any), as its last argument.  If this value is the above error string then the script should reject the - mentry's contents by invoking the rejectinput subcommand. @@ -405,7 +405,7 @@

    The tablelist::addIPAddrMentry addresses as internal cell values.  The finishediting subcommand of the Tcl command associated with the tablelist widget will - retrieve the contents of the embedded window used for interactive cell + retrieve the content of the embedded window used for interactive cell editing by invoking the mentry::getIPAddr command.  The value returned by this command (an IP address or the error string "EMPTY") will be passed to the script @@ -413,7 +413,7 @@

    The tablelist::addIPAddrMentry "tablelistWidget.html#editendcommand">-editendcommand tablelist configuration option (if any), as its last argument.  If this value is the above error string then the script should reject the - mentry's contents by invoking the rejectinput subcommand. @@ -464,7 +464,7 @@

    The tablelist::addIPv6AddrMentry IPv6 addresses as internal cell values.  The finishediting subcommand of the Tcl command associated with the tablelist widget will - retrieve the contents of the embedded window used for interactive cell + retrieve the content of the embedded window used for interactive cell editing by invoking the mentry::getIPv6Addr command.  The value returned by this command (an IPv6 address or the error string "EMPTY") will be passed to the script @@ -472,7 +472,7 @@

    The tablelist::addIPv6AddrMentry "tablelistWidget.html#editendcommand">-editendcommand tablelist configuration option (if any), as its last argument.  If this value is the above error string then the script should reject the - mentry's contents by invoking the rejectinput subcommand. diff --git a/modules/tablelist/doc/tablelistThemes.html b/modules/tablelist/doc/tablelistThemes.html index cfca980d..621d7eca 100644 --- a/modules/tablelist/doc/tablelistThemes.html +++ b/modules/tablelist/doc/tablelistThemes.html @@ -12,7 +12,7 @@

    Commands Related to Tile Themes

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    @@ -241,7 +241,7 @@

    tablelist::setThemeDefaults
    -tablelist::setThemeDefaults
    +tablelist::setThemeDefaults
     if {$tile::currentTheme eq "aqua"} {
         option add *Listbox.selectBackground \
                    $tablelist::themeDefaults(-selectbackground)
    diff --git a/modules/tablelist/doc/tablelistTile.html b/modules/tablelist/doc/tablelistTile.html
    index 622999cf..4a8203fa 100644
    --- a/modules/tablelist/doc/tablelistTile.html
    +++ b/modules/tablelist/doc/tablelistTile.html
    @@ -12,7 +12,7 @@
       

    Interactive Tablelist Cell Editing Using Tile Widgets

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    @@ -72,7 +72,7 @@

    Overview

    ::ttk::combobox, ::ttk::checkbutton, and ::ttk::menubutton are also supported.  The version of the tile package must be 0.6 or higher (the tile spinbox requires - even tile 0.8.3 or later, or, alternatively, Tk 8.6 or later).  These + even tile 0.8.3 or later, or, alternatively, Tk 8.5.9 or later).  These widgets are automatically registered for cell editing, hence the only action needed for using one of them for editing the cells of a given column is as follows:

    diff --git a/modules/tablelist/doc/tablelistTkCore.html b/modules/tablelist/doc/tablelistTkCore.html index 297c3bfc..20733a84 100644 --- a/modules/tablelist/doc/tablelistTkCore.html +++ b/modules/tablelist/doc/tablelistTkCore.html @@ -12,7 +12,7 @@

    Interactive Tablelist Cell Editing Using Tk Core Widgets

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    @@ -120,8 +120,8 @@

    Interactive Cell Editing Using the text Widget

    display lines (taking into account the line wraps) contained in it.  You can use the script corresponding to the -editstartcommand - tablelist configuration option to override the initial settings according - to your needs.
    + tablelist configuration option to override the initial settings (except + the height) according to your needs.
    If the text widget's -wrap option was set to word or char (either by diff --git a/modules/tablelist/doc/tablelistWidget.html b/modules/tablelist/doc/tablelistWidget.html index 6fcf9945..69cf9b2c 100644 --- a/modules/tablelist/doc/tablelistWidget.html +++ b/modules/tablelist/doc/tablelistWidget.html @@ -13,7 +13,7 @@

    The tablelist::tablelist Command

    -

    For Tablelist Version 5.17

    +

    For Tablelist Version 6.6

    by

    @@ -54,7 +54,9 @@

    Quick Reference

    -
    STANDARD OPTIONS
    +
    DESCRIPTION
    + +
    STANDARD OPTIONS
    @@ -66,8 +68,8 @@ 

    Quick Reference

    -
    OPTIONS FOR THE BODY COMPONENT OF THE - WIDGET
    +
    OPTIONS FOR THE BODY AND HEADER COMPONENTS OF + THE WIDGET
    @@ -122,6 +124,9 @@ 

    Quick Reference

    -customdragsource boolean
    +
    -displayondemand + boolean
    +
    -editendcommand command
    @@ -140,7 +145,7 @@

    Quick Reference

    -fullseparators boolean
    -
    -height lines
    +
    -height units
    -incrarrowtype up|down
    @@ -217,6 +222,9 @@

    Quick Reference

    -resizecursor cursor
    +
    -selectfiltercommand + command
    +
    -selectmode single|browse|multiple|extended
    @@ -229,6 +237,9 @@

    Quick Reference

    -showarrow boolean
    +
    -showbusycursor + boolean
    +
    -showeditcursor boolean
    @@ -296,6 +307,12 @@

    Quick Reference

    -width characters
    +
    -xmousewheelwindow + window
    + +
    -ymousewheelwindow + window
    +
    COLUMN CONFIGURATION OPTIONS
    -align @@ -365,6 +382,9 @@

    Quick Reference

    -labelrelief raised|sunken|flat|ridge|solid|groove
    +
    -labelvalign + center|top|bottom
    +
    -maxwidth width
    @@ -376,6 +396,9 @@

    Quick Reference

    -selectbackground color
    +
    -selectfiltercommand + command
    +
    -selectforeground color
    @@ -411,7 +434,8 @@

    Quick Reference

    -wrap boolean
    -
    ROW CONFIGURATION OPTIONS
    +
    ROW CONFIGURATION OPTIONS IN THE + TABLELIST BODY
    -background color  or  -bg @@ -438,7 +462,25 @@

    Quick Reference

    -text list
    -
    CELL CONFIGURATION OPTIONS
    +
    ROW CONFIGURATION OPTIONS IN THE + TABLELIST HEADER
    + +
    -background + color  or  -bg + color
    + +
    -font font
    + +
    -foreground + color  or  -fg + color
    + +
    -name name
    + +
    -text list
    + +
    CELL CONFIGURATION OPTIONS IN THE + TABLELIST BODY
    -background color  or  -bg @@ -458,6 +500,9 @@

    Quick Reference

    -image image
    +
    -imagebackground + color
    +
    -selectbackground color
    @@ -481,7 +526,41 @@

    Quick Reference

    -windowupdate command
    -
    DESCRIPTION
    +
    CELL CONFIGURATION OPTIONS IN + THE TABLELIST HEADER
    + +
    -background + color  or  -bg + color
    + +
    -font font
    + +
    -foreground + color  or  -fg + color
    + +
    -image + image
    + +
    -imagebackground + color
    + +
    -stretchwindow + boolean
    + +
    -text text
    + +
    -valign + center|top|bottom
    + +
    -window + command
    + +
    -windowdestroy + command
    + +
    -windowupdate + command
    COLORS AND FONTS
    @@ -490,7 +569,7 @@

    Quick Reference

    INTERACTIVE CELL EDITING
    -
    DRAG & DROP +
    DRAG & DROP SUPPORT
    VIRTUAL EVENTS
    @@ -530,6 +609,25 @@

    Quick Reference

    +
    HEADER ROW INDICES
    + +
    +
    +number  hknumber  end  last  @x,y  name
    +
    +
    + +
    HEADER CELL INDICES
    + +
    +
    +headerRow,col  end  last  @x,y
    +
    +    headerRow: number  hknumber  end  last  name
    +    col:       number  active  anchor  end  last  left  right  name
    +
    +
    +
    WIDGET COMMAND
    pathName activate @@ -580,22 +678,22 @@

    Quick Reference

    option args
    -
    pathName cellselection anchor +
    pathName cellselection anchor cellIndex
    -
    pathName cellselection clear - firstCell lastCell
    +
    pathName cellselection clear firstCell + lastCell
    -
    pathName cellselection clear +
    pathName cellselection clear cellIndexList
    -
    pathName cellselection includes +
    pathName cellselection includes cellIndex
    -
    pathName cellselection set - firstCell lastCell
    +
    pathName cellselection set firstCell + lastCell
    -
    pathName cellselection set +
    pathName cellselection set cellIndexList
    @@ -613,7 +711,7 @@

    Quick Reference

    nodeIndex
    pathName collapse - index ?-fully|-partly?
    + indexList ?-fully|-partly?
    pathName collapseall ?-fully|-partly?
    @@ -680,18 +778,17 @@

    Quick Reference

    "#cornerlabelpath">cornerlabelpath
    pathName cornerpath
    + "#cornerpath">cornerpath
    ?-ne|-sw?
    pathName curcellselection ?-all|-nonhidden|-viewable?
    -
    pathName curselection +
    pathName curselection ?-all|-nonhidden|-viewable?
    -
    pathName delete first - last
    +
    pathName delete + firstIndex lastIndex
    pathName delete indexList
    @@ -708,8 +805,8 @@

    Quick Reference

    pathName descendantcount nodeIndex
    -
    pathName dicttoitem dictionary
    +
    pathName dicttoitem + dictionary
    pathName editcell cellIndex
    @@ -723,11 +820,27 @@

    Quick Reference

    pathName editwintag
    +
    pathName embedcheckbutton cellIndex + ?command?
    + +
    pathName embedcheckbuttons columnIndex + ?command?
    + +
    pathName embedttkcheckbutton cellIndex + ?command?
    + +
    pathName embedttkcheckbuttons columnIndex + ?command?
    +
    pathName entrypath
    -
    pathName expand index - ?-fully|-partly?
    +
    pathName expand + indexList ?-fully|-partly?
    pathName expandall ?-fully|-partly?
    @@ -750,8 +863,8 @@

    Quick Reference

    pathName formatinfo
    -
    pathName get first - last
    +
    pathName get firstIndex + lastIndex
    pathName get indexList
    @@ -769,7 +882,7 @@

    Quick Reference

    columnIndexList
    pathName getformatted - first last
    + firstIndex lastIndex
    pathName getformatted indexList
    @@ -791,13 +904,13 @@

    Quick Reference

    columnIndexList
    pathName getfullkeys - first last
    + firstIndex lastIndex
    pathName getfullkeys indexList
    pathName getkeys - first last
    + firstIndex lastIndex
    pathName getkeys indexList
    @@ -815,6 +928,15 @@

    Quick Reference

    pathName hasrowattrib index name
    +
    pathName header option + ?arg arg ...?
    + +
    pathName headerpath
    + +
    pathName headertag
    +
    pathName hidetargetmark
    @@ -865,8 +987,8 @@

    Quick Reference

    pathName itemlistvar
    -
    pathName itemtodict item
    +
    pathName itemtodict + item
    pathName labelpath columnIndex
    @@ -911,6 +1033,9 @@

    Quick Reference

    pathName resetsortinfo
    +
    pathName restorecursor
    +
    pathName rowattrib index ?name? ?value name value ...?
    @@ -942,22 +1067,22 @@

    Quick Reference

    option args
    -
    pathName selection anchor +
    pathName selection anchor index
    -
    pathName selection clear first - last
    +
    pathName selection clear firstIndex + lastIndex
    -
    pathName selection clear +
    pathName selection clear indexList
    -
    pathName selection includes +
    pathName selection includes index
    -
    pathName selection set first - last
    +
    pathName selection set firstIndex + lastIndex
    -
    pathName selection set +
    pathName selection set indexList
    @@ -968,6 +1093,9 @@

    Quick Reference

    pathName separators
    +
    pathName setbusycursor
    +
    pathName showtargetmark before|inside index
    @@ -1011,7 +1139,7 @@

    Quick Reference

    columnIndexList
    pathName togglerowhide - first last
    + firstIndex lastIndex
    pathName togglerowhide indexList
    @@ -1035,8 +1163,8 @@

    Quick Reference

    name
    pathName viewablerowcount ?first - last?
    + "#viewablerowcount">viewablerowcount ?firstIndex + lastIndex?
    pathName windowpath cellIndex
    @@ -1050,10 +1178,10 @@

    Quick Reference

    pathName xview units
    -
    pathName xview moveto +
    pathName xview moveto fraction
    -
    pathName xview scroll number +
    pathName xview scroll number units|pages
    @@ -1067,17 +1195,198 @@

    Quick Reference

    pathName yview units
    -
    pathName yview moveto +
    pathName yview moveto fraction
    -
    pathName yview scroll number +
    pathName yview scroll number units|pages
    +
    HEADER-RELATED + SUBCOMMANDS
    + +
    pathName header bbox + headerIndex
    + +
    pathName header + cellattrib headerCellIndex ?name? ?value + name value ...?
    + +
    pathName header + cellbbox headerCellIndex
    + +
    pathName header + cellcget headerCellIndex option
    + +
    pathName header + cellconfigure headerCellIndex ?option? ?value + option value ...?
    + +
    pathName header + cellindex headerCellIndex
    + +
    pathName header + configcelllist {headerCellIndex option value + headerCellIndex option value ...}
    + +
    pathName header + configcells ?headerCellIndex option value + headerCellIndex option value ...?
    + +
    pathName header + configrowlist {headerIndex option value + headerIndex option value ...}
    + +
    pathName header + configrows ?headerIndex option value + headerIndex option value ...?
    + +
    pathName header + containing y
    + +
    pathName header + containingcell x y
    + +
    pathName header delete + firstHeaderIndex lastHeaderIndex
    + +
    pathName header delete + headerIndexList
    + +
    pathName header + embedcheckbutton headerCellIndex + ?command?
    + +
    pathName header + embedcheckbuttons columnIndex ?command?
    + +
    pathName header + embedttkcheckbutton headerCellIndex + ?command?
    + +
    pathName header + embedttkcheckbuttons columnIndex + ?command?
    + +
    pathName header + fillcolumn columnIndex text
    + +
    pathName header + findrowname name
    + +
    pathName header get + firstHeaderIndex lastHeaderIndex
    + +
    pathName header get + headerIndexList
    + +
    pathName header + getcells firstHeaderCell lastHeaderCell
    + +
    pathName header + getcells headerCellIndexList
    + +
    pathName header + getcolumns firstColumn lastColumn
    + +
    pathName header + getcolumns columnIndexList
    + +
    pathName header + getformatted firstHeaderIndex + lastHeaderIndex
    + +
    pathName header + getformatted headerIndexList
    + +
    pathName header + getformattedcells firstHeaderCell + lastHeaderCell
    + +
    pathName header + getformattedcells headerCellIndexList
    + +
    pathName header + getformattedcolumns firstColumn + lastColumn
    + +
    pathName header + getformattedcolumns columnIndexList
    + +
    pathName header + getfullkeys firstHeaderIndex + lastHeaderIndex
    + +
    pathName header + getfullkeys headerIndexList
    + +
    pathName header getkeys + firstHeaderIndex lastHeaderIndex
    + +
    pathName header getkeys + headerIndexList
    + +
    pathName header + hascellattrib headerCellIndex name
    + +
    pathName header + hasrowattrib headerIndex name
    + +
    pathName header + imagelabelpath headerCellIndex
    + +
    pathName header index + headerIndex
    + +
    pathName header insert + headerIndex ?item item ...?
    + +
    pathName header + insertlist headerIndex itemList
    + +
    pathName header + iselemsnipped headerCellIndex + fullTextName
    + +
    pathName header + itemlistvar
    + +
    pathName header nearest + y
    + +
    pathName header + nearestcell x y
    + +
    pathName header + rowattrib headerIndex ?name? ?value + name value ...?
    + +
    pathName header rowcget + headerIndex option
    + +
    pathName header + rowconfigure headerIndex ?option? ?value + option value ...?
    + +
    pathName header + size
    + +
    pathName header + unsetcellattrib headerCellIndex name
    + +
    pathName header + unsetrowattrib headerIndex name
    + +
    pathName header + windowpath headerCellIndex
    +
    DEFAULT AND INDIVIDUAL BINDINGS FOR THE TABLELIST BODY
    +
    DEFAULT AND INDIVIDUAL BINDINGS + FOR THE HEADER ITEMS
    +
    DEFAULT AND INDIVIDUAL BINDINGS FOR THE HEADER LABELS
    @@ -1111,7 +1420,107 @@

    Detailed Reference

    -
    STANDARD OPTIONS
    +
    DESCRIPTION
    + +
    The tablelist::tablelist command creates a new + window named pathName and of the class + Tablelist, and makes it into a tablelist + widget.  Additional options, described below, may be specified on the + command line or in the option database to configure aspects of the + tablelist such as its colors, font, and columns.  The + tablelist::tablelist 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.
    + +
    A tablelist is a multi-column listbox and tree widget, + implemented as a mega-widget, consisting of a body and a + header.  The body displays a list of items, one per + line.  Each item is a list of elements, which are aligned in + columns.  In other words, an item is the content of a row, and an + element is the text contained in a cell.  The header consists of label + widgets displaying the column titles.  They can be used, among others, + for interactive column resizing and column-based sorting of the body items, + as described below.  For Tk versions 8.5 and higher, the header + component can also contain (a typically small number of) items, just like + the body.  The order of the header items is not affected by any + sorting-related commands or bindings.  The end of the header row area + is visualized with the aid of a horizontal separator, placed just below the + last header row (if any).
    + +
    The reason for restricting the support for header items to + Tk versions 8.5 and later is that the header's height is set to be just + large enough to hold all its items.  This is done with the aid of + the  count -ypixels  text widget command, + which was introduced in Tk 8.5.
    + +
    Each cell (in both the body and the header) and each header + label of a tablelist widget can also contain an image, which is placed to + the left or right of the text, depending on the column's alignment.  + Instead of an image, a tablelist cell (in both the body and the header) can + also contain an embedded window, placed to the left or right of the text, + just like an embedded image.
    + +
    When a tablelist is used as a tree widget, one of its + columns will display the tree hierarchy with the aid of indentations and + expand/collapse controls.  The Tablelist package provides a great + variety of tree styles controlling the look & feel of that column, and + chooses the correct default style depending on the windowing system, + operating system version, and tile theme.  In a tablelist used as a + multi-column tree widget, every row of its body (but not of its header) is + at the same time a tree node, having exactly one parent node + and any number of child nodes.  The tree's origin is the + invisible root node, which has no parent itself and whose children + are the top-level nodes.
    + +
    The elements of a tablelist widget can, per default, be only + edited programmatically.  However, interactive editing can be enabled + for individual cells and for entire columns of the widget's body.  Per + default, the interactive cell editing uses a temporary embedded entry + widget, thus making sure that all the validation facilities available for + entry widgets can be used during the editing process.  A great variety + of widgets from the packages BWidget, Iwidgets, combobox (by Bryan Oakley), + ctext, and Mentry (or Mentry_tile), as well as Tk core text, spinbox, + checkbutton, and menubutton widgets, along with tile entry, spinbox, + combobox, checkbutton, and menubutton widgets are also supported as + temporary embedded widgets used for cell editing.  In addition, a rich + set of keyboard bindings is provided for a comfortable navigation between + the editable cells.
    + +
    When first created, a new tablelist widget has no + items.  Items (in both the body and the header) may be added, deleted, + or updated using widget commands described below.  In addition, one or + more items or elements of the widget's body may be selected.  If a + tablelist widget is exporting its selection (see the + -exportselection option), then it will observe the + standard X11 protocols for handling the selection.  Tablelist widget + selections are available as types STRING and + UTF8_STRING; the value of the selection will be a text + built by taking all of the rows having at least one viewable selected element, joining these elements + together with tabs, and the resulting strings in turn with newlines.  + If a tablelist widget that is exporting its selection is the selection + owner and some other window claims ownership of the selection away from it, + then the virtual event + <<TablelistSelectionLost>> is + generated.
    + +
    It is not necessary for all the elements to be displayed in + the tablelist widget at once; commands described below may be used to + change the horizontal view in the window and the vertical view in the body + (but not in the header).  Tablelist widgets allow scrolling in both + directions (but no vertical scrolling in the header component), using the + standard -xscrollcommand and + -yscrollcommand options.  They also support + scanning in the widget's body (but not in its header), as described + below.
    + +
    Each tablelist widget, as well as each tablelist column, + row, and cell (in both the body and the header) may have any number of + attributes, which can be used in commands that create or manipulate + tablelist widgets for particular purposes.
    + +
    STANDARD OPTIONS
    @@ -1133,8 +1542,24 @@ 

    Detailed Reference

    -selectforeground have theme-specific default values.
    -
    OPTIONS FOR THE BODY COMPONENT OF THE - WIDGET
    +
    REMARK 1:  If the value of the -width configuration option is zero or less and the + tablelist has stretchable columns, then the + -setgrid option will be ignored.  This minor + restriction has technical reasons and is only relevant on X11.
    + +
    REMARK 2:  Instead of creating the scrollbar(s) + manually and settings the -xscrollcommand and/or + -yscrollcommand options accordingly, you might consider + to use the scrollarea widget of + the Scrollutil package, + which greatly simplifies the creation of arbitrary scrolled widgets, + supports both static and dynamic scrollbars, and respects the header + component and title columns of tablelist widgets.
    + +
    OPTIONS FOR THE BODY AND HEADER + COMPONENTS OF THE WIDGET
    @@ -1143,11 +1568,11 @@ 

    Detailed Reference

    These options (described in the options manual entry) are only - valid for the body component of the tablelist widget.  As discussed in - the next section, the colors and font used when drawing the header labels - can be different from those specified for the body.  When using the - package Tablelist_tile, these options have theme-specific default - values.
    + valid for the body and header components of the tablelist widget.  As + discussed in the next section, the colors and font used when drawing the + header labels can be different from those specified for the body and + header items.  When using the package Tablelist_tile, these + options have theme-specific default values.
    WIDGET-SPECIFIC OPTIONS
    @@ -1176,12 +1601,12 @@

    Detailed Reference

    Specifies a Tcl command used to decide whether a given tablelist node may accept a specified item being moved interactively as a child.  The - specified command is automatically concatenated with the name of the - tablelist widget, the node index of the would-be new parent node, and - the row index of the dragged item, the resulting script is evaluated in - the global scope, and the return value (which must be a boolean) will - determine whether to allow to move the source item to the current mouse - position as a child of the given parent node.

    + specified command is automatically concatenated with the path name of + the tablelist widget, the node index of the would-be new parent node, + and the row index of the dragged item, the resulting script is + evaluated in the global scope, and the return value (which must be a + boolean) will determine whether to allow to move the source item to the + current mouse position as a child of the given parent node.

    For example, in the case of a tablelist widget used as a file manager, in which the top-level items represent volumes mounted on the @@ -1234,8 +1659,8 @@

    Detailed Reference

    may accept a specified item being moved interactively to be dropped as a sibling just before that row.  The specified command is automatically concatenated with the - name of the tablelist widget, the row index of the would-be new target, - and the row index of the dragged item, the resulting script is + path name of the tablelist widget, the row index of the would-be new + target, and the row index of the dragged item, the resulting script is evaluated in the global scope, and the return value (which must be a boolean) will determine whether to allow to move the source item to the current mouse position, just before the given row.

    @@ -1249,7 +1674,7 @@

    Detailed Reference

     proc acceptDropCmd {tbl targetRow sourceRow} {
         set rowCount [[$tbl size]
    -    return [expr {$sourceRow != $rowCount - 1 && $targetRow < $rowCount}]
    +    return [expr {$sourceRow != $rowCount - 1 && $targetRow < $rowCount}]
     }
     
    @@ -1330,9 +1755,9 @@

    Detailed Reference

    windowing system is x11 then the default arrow color is black and the -arrowstyle option has the default value - flat7x5.  The same holds true for some tile - themes, like alt, default, and - clam.  On the windowing system + flat8x4.  The same holds true for some tile + themes, like alt, clam, and + default.  On the windowing system win32, the default arrow color is #595959 for Windows 10, #569bc0 for Windows Vista, 7, and 8, #aca899 for Windows XP, and an empty @@ -1466,17 +1891,18 @@

    Detailed Reference

    photo7x4, photo9x5, photo11x6, and photo15x8 use GIF images that look very close to the native sort arrows on Windows - Vista, 7, and 8.  When using one of these styles, the -arrowcolor and -arrowcolor and + -arrowdisabledcolor options have no effect.

    On Windows Vista, 7, 8, and 10, the sort arrows are shown horizontally centered in the header labels, just below their top - edges:

    + edges:

    Arrow Styles Vista

    + "638" height="123">

    The arrow style photo7x7 uses PNG images that look and behave very close to the native sort arrows on Mac OS X Aqua @@ -1556,8 +1982,8 @@

    Detailed Reference

    button 1 down.  The default is 1, meaning that automatic scrolling will be in effect, just like in the case of the Tk listbox widget.  However, when using the TkDND package or some - other drag & drop implementation, you might want to set this option - to 0, in order to avoid any conflicts between the drag + other drag & drop implementation, you might want to set this option to + 0, in order to avoid any conflicts between the drag operation and the automatic scrolling.

    REMARK:  Starting with Tablelist version 5.12, this @@ -1598,8 +2024,8 @@

    Detailed Reference

    tablelist used as a tree widget (with the aid of the collapse or collapseall subcommand).  The - specified command is automatically concatenated with the name of the - tablelist widget and the row index, and the resulting script is + specified command is automatically concatenated with the path name of + the tablelist widget and the row index, and the resulting script is evaluated in the global scope, before hiding the descendants of the row in question.

    @@ -1635,26 +2061,28 @@

    Detailed Reference

    arbitrary character regions within the cells of the currently visible rows.  Whenever the Tablelist package needs to display the various foreground and background colors (including the stripe- and - selection-specific ones), it runs over the cells of the rows that are - currently visible in the tablelist window and displays the colors by - adding appropriate tags to the body text widget areas making up the - formatted contents of the cells.  After activating the colors for - a cell, the Tablelist code invokes the command specified as the value - of this configuration option (provided that it is a nonempty string), - in the global scope and with the following arguments specific to the - cell being processed:

    + selection-specific ones), it runs over the cells of the body and header + rows that are currently visible in the tablelist window and displays + the colors by adding appropriate tags to the body and header text + widget areas making up the formatted contents of the cells.  After + activating the colors for a cell, the Tablelist code invokes the + command specified as the value of this configuration option (provided + that it is a nonempty string), in the global scope and with the + following arguments specific to the body or header cell being + processed:

    • the path name of the tablelist widget;
    • -
    • the path name of the tablelist's body component;
    • +
    • the path name of the tablelist's body or header text widget;
    • -
    • the full key of the item containing the element being - processed;
    • +
    • the full key of the item containing the element being processed + (remember that this starts with the prefix k for + a body item and with hk for a header item);
    • -
    • the numerical row index of that item;
    • +
    • the numerical row or header row index of that item;
    • -
    • the numerical index of the cell's column;
    • +
    • the numerical index of the cell's column;
    • the text index (of the form line.char) of the first \t character delimiting the cell in the @@ -1679,7 +2107,7 @@

      Detailed Reference

      -proc myColorizeCmd {tbl body key row col tabIdx1 tabIdx2 inStripe selected} { ... }
      +proc myColorizeCmd {tbl textWidget key row col tabIdx1 tabIdx2 inStripe selected} { ... }
       
      @@ -1761,11 +2189,11 @@

      Detailed Reference

      called dynamic-width columns.  In general, they are more user-friendly than their static-width counterparts, being that their widths are automatically adapted to their contents.  On the - other hand, the static-width columns perform significantly better on - item insertion and sorting than the dynamic-width ones, due to some - optimizations introduced in Tablelist version 5.6.  (Prior to that - release, the above-mentioned operations were faster with dynamic-width - columns than with static-width ones.)

      + other hand, if the -displayondemand option is true + (which is the default) then the static-width columns perform + significantly better on item insertion and sorting than the + dynamic-width ones.

      @@ -1850,9 +2278,9 @@

      Detailed Reference

      Specifies a boolean value that indicates whether the tablelist - widget is a drag source for some drag & drop implementation other - than TkDND and the drag & drop framework included in BWidget.  - If true then the default bindings will perform an automatic drag-friendly handling of the selection and will suppress the automatic scrolling when the mouse leaves the tablelist window with button 1 down.  The default is @@ -1860,6 +2288,52 @@

      Detailed Reference

      +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -displayondemand
      Database Name: displayOnDemand
      Database Class: DisplayOnDemand
      + +
      +

      Specifies a boolean value that controls the way the texts of newly + inserted rows in the tablelist's body will be displayed in the + underlying text widget.  If true then the texts of the new rows + won't be inserted into the body text widget until the corresponding + cells become visible (e.g., as a result of horizontal or vertical + scrolling).  Otherwise the texts of the new rows will be displayed + in the underlying text widget immediately after inserting the + rows.  The default is 1.

      + +

      REMARK 1:  The default value true of this option makes + the item insertion and sorting significantly faster, especially in the + presence of static-width columns, because the snipping of elements that + don't fit into their cells will be postponed to the time when they get + displayed in the body text widget.  On the other hand, this + display on demand imposes some performance penalty on the scrolling, + especially if the tablelist widget has many columns.  To speed up + the scrolling, you might consider setting this option to false.

      + +

      REMARK 2:  Newly inserted header rows are displayed + immediately in the underlying text widget, independently of the value + of this option.

      +
      +
      +
      @@ -1883,16 +2357,16 @@

      Detailed Reference

      Specifies a Tcl command to be invoked on normal termination of the - interactive editing of a cell's contents if the final text of the + interactive editing of a cell's content if the final text of the temporary embedded widget used for the editing is different from its initial one.  The command is automatically concatenated with the - name of the tablelist widget, the cell's row and column indices, as - well as the final contents of the edit window, the resulting script is - evaluated in the global scope, and the return value becomes the cell's - new contents after destroying the temporary embedded widget.  The - main purpose of this script is to perform a final validation of the - edit window's contents.  See the description of the - -forceeditendcommand option for more about the invocation of the command mentioned above, as well as the INTERACTIVE CELL EDITING section for @@ -1958,13 +2432,13 @@

      Detailed Reference

      Specifies a Tcl command to be invoked when the interactive editing - of a cell's contents is started.  The command is automatically - concatenated with the name of the tablelist widget, the cell's row and - column indices, as well as the text displayed in the cell, the + of a cell's content is started.  The command is automatically + concatenated with the path name of the tablelist widget, the cell's row + and column indices, as well as the text displayed in the cell, the resulting script is evaluated in the global scope, and the return value - becomes the initial contents of the temporary embedded widget used for + becomes the initial content of the temporary embedded widget used for the editing.  The main purpose of this script is to define - validations for the edit window's contents.  See the INTERACTIVE CELL EDITING section for details on the editing process.

      @@ -1996,10 +2470,10 @@

      Detailed Reference

      tablelist used as a tree widget (with the aid of the expand or expandall subcommand).  The specified - command is automatically concatenated with the name of the tablelist - widget and the row index, and the resulting script is evaluated in the - global scope, before displaying the children of the row in - question.

      + command is automatically concatenated with the path name of the + tablelist widget and the row index, and the resulting script is + evaluated in the global scope, before displaying the children of the + row in question.

      For technical reasons (the use of the -elide text widget tag option for collapsing a row), this option is not @@ -2019,7 +2493,7 @@

      Detailed Reference

      # displayed in the first cell of the specified row set dir [$tbl rowattrib $row pathName] - # Display the contents of the directory $dir + # Display the content of the directory $dir # as child items of the one identified by $row putContents $dir $tbl $row } @@ -2027,7 +2501,8 @@

      Detailed Reference

      # The rest is just eye candy: if {[$tbl childcount $row] != 0} { # Update the image displayed in the row's first cell - $tbl cellconfigure $row,0 -image openFolderImg + $tbl cellconfigure $row,0 -image openFolderImg } } @@ -2065,7 +2540,7 @@

      Detailed Reference

      widget used for the editing equals its initial one, and will also be invoked when the interactive cell editing is canceled (in the latter case, the text passed to it as last argument will be the cell's - original contents, not its final one).  The default value of this + original content, not its final one).  The default value of this option is 0, meaning that the command will only be invoked on normal termination of the editing process, if the final text of the temporary embedded widget is different from its initial one.  See @@ -2074,7 +2549,7 @@

      Detailed Reference

      If the option's value is true and no value for the -editendcommand option was specified, then on - normal termination of the editing process the cell's new contents will + normal termination of the editing process the cell's new content will be set to the text contained in the edit window, even if it has not been changed interactively (but might have been returned by the command given by the the Detailed Reference

      -

      Specifies the desired height for the window, in units of characters - in the font given by the -font option.  This - is at the same time the desired height in lines, provided that no - column-, row-, or cell-specific fonts, multi-line elements, or embedded - images or windows will make the height of any of the rows different - from the one corresponding to the above-mentioned font.  With this - restriction, if the option's value is zero or less, then the window's - height is made just large enough to hold all the items in the tablelist - widget.

      +

      Specifies the desired height for the tablelist's body, in units of + characters in the font given by the -font + option.  This is at the same time the desired height in rows, + provided that no column-, row-, or cell-specific fonts, multi-line + elements, or embedded images or windows make the height of any of the + body items different from the one corresponding to the above-mentioned + font.  If the option's value is zero or less, then the body's + desired height in units of characters in the widget's font is kept in + sync with the number of viewable body items; + again, if all the items in the tablelist's body have the height + corresponding to the widget's font then this means that the body's + desired height is made just large enough to hold all the viewable body + items.

      + +

      REMARK:  Embedded images and windows often make the rows + of the tablelist higher, resulting in a discrepancy between the value + of this option and the number of rows visible in the body window.  + In many cases you can work around this problem by saving the value of + the widget's -font option, setting the latter to a + sufficiently large font, and then setting the -font + row configuration option of each body item to the saved widget font + value.

      @@ -2386,15 +2874,19 @@

      Detailed Reference

      -

      Specifies the Tcl command to be invoked when mouse button 1 is - pressed over one of the header labels and later released over the same - label.  When the <ButtonRelease-1> event - occurs, the command is automatically concatenated with the name of the +

      Specifies a Tcl command to be invoked when mouse button 1 is pressed + over one of the header labels and later released over the same + label.  Provided that the option's value is a nonempty string, + when the <ButtonRelease-1> event occurs, the + command is automatically concatenated with the path name of the tablelist widget and the column index of the respective label, and the - resulting script is evaluated in the global scope.  If the - tablelist's state is - disabled then this action will not take - place.  The most common value of this option is state is disabled then this + action will not take place.  The most common value of this option + is tablelist::sortByColumn; this command sorts the items based on the column whose index was passed to it as second argument.

      @@ -2423,16 +2915,20 @@

      Detailed Reference

      -

      Specifies the Tcl command to be invoked when mouse button 1 is - pressed together with the Shift key over one of the header - labels and later released over the same label.  When the +

      Specifies a Tcl command to be invoked when mouse button 1 is pressed + together with the Shift key over one of the header labels + and later released over the same label.  Provided that the + option's value is a nonempty string, when the <ButtonRelease-1> event occurs, the command - is automatically concatenated with the name of the tablelist widget and - the column index of the respective label, and the resulting script is - evaluated in the global scope.  If the tablelist's - state is - disabled then this action will not take - place.  The most common value of this option is state is disabled then this + action will not take place.  The most common value of this option + is tablelist::addToSortColumns; this command adds the column index passed to it as second argument to the list of sort columns and sorts the items based on the columns @@ -2644,14 +3140,15 @@

      Detailed Reference

      -

      Specifies the name of a variable.  The value of the variable is - a list to be displayed inside the widget; if the variable value changes - then the widget will automatically update itself to reflect the new +

      Specifies the name of a global varable or a qualified name of a + namespace variable.  The value of the variable is a list to be + displayed inside the widget's body; if the variable value changes then + the widget will automatically update itself to reflect the new value.  The value of the variable must be a valid list.  Each - list element corresponds to a row within the widget, and must be a - valid list itself; its elements correspond to the cells within the + list element corresponds to a row within the widget's body, and must be + a valid list itself; its elements correspond to the cells within the respective row.  Attempts to assign a variable whose value does - not fulfil these conditions to -listvariable will + not fulfill these conditions to -listvariable will cause an error.  Attempts to unset a variable in use as a -listvariable will fail but will not generate an error.

      @@ -2762,11 +3259,16 @@

      Detailed Reference

      -

      Specifies a boolean value that determines whether the rows can be - moved interactively.  See the DEFAULT AND - INDIVIDUAL BINDINGS FOR THE TABLELIST BODY section below for - information on moving a row interactively.  The default value is - 0.

      +

      Specifies a boolean value that determines whether the rows displayed + in the tablelist's body can be moved interactively.  See the + LOCAL DRAG & DROP subsection of the + DEFAULT AND INDIVIDUAL BINDINGS FOR THE + TABLELIST BODY section below for information on moving a row + interactively.  The default value is 0.

      + +

      REMARK:  The support for moving a row is restricted to + the widget's body component.  Moving of header rows is not + supported.

      @@ -2859,8 +3361,8 @@

      Detailed Reference

      the children (or descendants, when used with the -descend option) of a tablelist row whose children have not been inserted yet.  The specified command is - automatically concatenated with the name of the tablelist widget and - the row index, and the resulting script is evaluated in the global + automatically concatenated with the path name of the tablelist widget + and the row index, and the resulting script is evaluated in the global scope.  It is expected that this script will insert the children of the row in question, without expanding the node or changing its appearance in any other way.

      @@ -2876,11 +3378,12 @@

      Detailed Reference

      differences between them are as follows:

        -
      1. The command specified by the -populatecommand - option is only invoked for rows whose children have not been inserted - yet, while the one specified by -expandcommand is - always invoked before expanding a row, regardless of whether the - children of that row are already present in the widget or not.
      2. +
      3. The command specified by the + -populatecommand option is only invoked for rows + whose children have not been inserted yet, while the one specified by + -expandcommand is always invoked before expanding + a row, regardless of whether the children of that row are already + present in the widget or not.
      4. The command specified by the -expandcommand option may perform visual changes @@ -2903,7 +3406,7 @@

        Detailed Reference

        # displayed in the first cell of the specified row
        set dir [$tbl rowattrib $row pathName] - # Display the contents of the directory $dir + # Display the content of the directory $dir # as child items of the one identified by $row putContents $dir $tbl $row } @@ -2924,7 +3427,8 @@

        Detailed Reference

        # The rest is just eye candy: if {[$tbl childcount $row] != 0} { # Update the image displayed in the row's first cell - $tbl cellconfigure $row,0 -image openFolderImg + $tbl cellconfigure $row,0 -image openFolderImg } } @@ -3025,6 +3529,44 @@

        Detailed Reference

      +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -selectfiltercommand
      Database Name: selectFilterCommand
      Database Class: SelectFilterCommand
      + +
      +

      Specifies a Tcl command which can be used for filtering the cells + that will be selected when the default bindings for the header labels + perform a column-wise cell + selection.  If the option's value is a nonempty string then + this command is concatenated with the path name of the tablelist widget + and the numerical index of the respective column, and the resulting + script is evaluated in the global scope.  If another nonempty + command was specified as the value of the option of the same name at + column level then that column-specific command will be used instead of + the global one.  In both cases, the resulting script is expected + to return a list consisting of the row numbers of those cells contained + in the column in question that are to be selected by the column-wise + cell selection operation.

      +
      +
      +
      @@ -3156,55 +3698,129 @@

      Detailed Reference

      -
      +
      - + - + - +
      Command-Line Name: -showeditcursor-showbusycursor
      Database Name: showEditCursor showBusyCursor
      Database Class: ShowEditCursor ShowBusyCursor
      -

      Specifies a boolean value indicating whether the mouse cursor should +

      Specifies a boolean value indicating whether the default bindings + should display a windowing system-specific busy cursor during the + actions that can take a long time to complete, using the + setbusycursor and + restorecursor + subcommands.  The default value is 1.

      + +

      The potentially long-running actions that will temporarily change + the mouse cursor when this option is on are as follows:

      + +
        +
      • resizing or moving a column;
      • + +
      • invoking the command specified by the -labelcommand or -labelcommand2 option at widget or + column level (e.g., sorting the items by one or more columns);
      • + +
      • expanding or collapsing a row;
      • + +
      • extending, toggling, or canceling the (cell) selection if the + -selectmode option was + set to extended.
      • +
      + +

      REMARK:  If showing the busy cursor per default during + potentially long-running actions is not what you prefer, you can + override the default for all tablelist instances by inserting the + line

      + +
      +
      +option add *Tablelist.showBusyCursor 0
      +
      +
      + +

      somewhere at the beginning of your script (before creating any + tablelist widgets).

      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -showeditcursor
      Database Name: showEditCursor
      Database Class: ShowEditCursor
      + +
      +

      Specifies a boolean value indicating whether the mouse cursor should change automatically to one having the shape of a pencil whenever a click with mouse button 1 would start an editing session.  The default value is 1.

      -

      REMARK:  On X11 and Mac OS X Aqua, the cursor set by - Tablelist when a mouse click would start the interactive cell editing, - is Tk's built-in cursor pencil.  Since on - Windows this cursor is ugly and not really usable, the edit cursor - shown by Tablelist on this platform will be the one loaded from the - file pencil.cur, located in the scripts - subdirectory of the Tablelist installation directory.  If the - application was started as a starpack containing the Tablelist package, - then the edit cursor will be loaded from a copy of this file, created - automatically by Tablelist in the user's Temp - directory.

      - -

      The file pencil.cur is a copy of the file  - Ubuntu Handwriting.cur,  downloaded from the - address

      +

      On X11 and Mac OS X Aqua, the cursor set by Tablelist when a mouse + click would start the interactive cell editing, is Tk's built-in cursor + pencil.  Since on Windows this cursor is ugly + and not really usable, the edit cursor shown by Tablelist on this + platform will be the one loaded from the file pencil.cur, + located in the scripts subdirectory of the Tablelist + installation directory.  If the application was started as a + starpack containing the Tablelist package, then the edit cursor will be + loaded from a copy of this file, created automatically by Tablelist in + the user's Temp directory.  The file + pencil.cur is a copy of the file  Ubuntu + Handwriting.cur,  downloaded from the address

      http://www.rw-designer.com/cursor-detail/46745 + "http://www.rw-designer.com/cursor-detail/46922">http://www.rw-designer.com/cursor-detail/46922
      + +

      REMARK:  If showing the edit cursor per default + whenever a click with mouse button 1 would start the editing is not + what you prefer, you can override the default for all tablelist + instances by inserting the line

      + +
      +
      +option add *Tablelist.showEditCursor 0
      +
      +
      + +

      somewhere at the beginning of your script (before creating any + tablelist widgets).

      @@ -3237,6 +3853,20 @@

      Detailed Reference

      "#fullseparators">-fullseparators
      option is false, and there is free space left between the last row and the bottom of the tablelist window.  The default value is 1.

      + +

      REMARK:  If showing the horizontal separator per default + under the above-mentioned circumstancies is not what you prefer, you + can override the default for all tablelist instances by inserting the + line

      + +
      +
      +option add *Tablelist.showHorizSeparator 0
      +
      +
      + +

      somewhere at the beginning of your script (before creating any + tablelist widgets).

      @@ -3305,9 +3935,10 @@

      Detailed Reference

      tablelist window.

      REMARK:  Tablelist doesn't support horizontal separators - (except for the one mentioned above), but a nice distinguishing effect - for the rows can be achieved with the aid of the -stripebackground option discussed + (except for the one mentioned above and another one placed just below + the last header row), but a nice distinguishing effect for the rows in + the widget's body can be achieved with the aid of the -stripebackground option described below.

      @@ -3397,9 +4028,10 @@

      Detailed Reference

      Specifies additional space to provide above and below each row of - the widget.  The option's value may have any of the standard forms - for screen distances.  It defaults to 0.  See - also the -tight option.

      + the widget, in both the body and the header.  The option's value + may have any of the standard forms for screen distances.  It + defaults to 0.  See also the -tight option.

      @@ -3464,27 +4096,31 @@

      Detailed Reference

      -

      Specifies the columns to be stretched in order to fill the tablelist - window if necessary.  The option's value may be - all or a list of column indices in any of the forms - described in the COLUMN INDICES section - below.  In the second case, the specified column indices are - replaced with their numerical equivalents, except for - end and last, which are viewed - as dynamic column indices whose numerical equivalent (i.e., the index - of the tablelist's last column) might change during program execution - and therefore will be recomputed every time the columns are - stretched.  The list will be updated automatically whenever - columns are inserted, deleted, or moved.  The number of pixels by - which a column is stretched is proportional to its width in - pixels.  The default value of this option is an empty list, - meaning that no column will be stretched to eliminate the blank space - that might appear at the right of the table.  (Note that the blank - space following the header labels is filled with a dummy, insensitive - label having the same background, borderwidth, and relief as the - "normal" header labels.)  This option is ignored if the value of - the -width configuration - option is zero or less.

      +

      Specifies the stretchable columns, i.e., the columns to be + stretched in order to fill the tablelist window if necessary.  The + option's value may be all or a list of column + indices in any of the forms described in the COLUMN INDICES section below.  In the second + case, the specified column indices are replaced with their numerical + equivalents, except for end and + last, which are viewed as dynamic column indices + whose numerical equivalent (i.e., the index of the tablelist's last + column) might change during program execution and therefore will be + recomputed every time the columns are stretched.  The list will be + updated automatically whenever columns are inserted, deleted, or + moved.  The number of pixels by which a column is stretched is + proportional to its width in pixels.  The default value of this + option is an empty list, meaning that no column will be stretched to + eliminate the blank space that might appear at the right of the + table.  (Note that the blank space following the header labels is + filled with a dummy, insensitive label having the same background, + borderwidth, and relief as the "normal" header labels.)

      + +

      REMARK:  If the value of the -width configuration option is zero or less and + the tablelist has stretchable columns, then the + -setgrid option will be ignored.  This minor + restriction has technical reasons and is only relevant on X11.

      @@ -3511,19 +4147,19 @@

      Detailed Reference

      -

      Specifies the background color to use when displaying the items +

      Specifies the background color to use when displaying the body items belonging to a stripe.  Each stripe is composed of the same number - stripeHeight of consecutive stripeHeight of consecutive viewable items, according to the value of the -stripeheight - configuration option.  The first stripeHeight + configuration option.  The first stripeHeight viewable items are "normal" ones; they are followed by a stripe - composed of the next stripeHeight viewable items, which in - turn is followed by the same number of "normal" viewable items, and so - on.  In the Tablelist package and in most themes supported by - Tablelist_tile, the default value is an empty string, indicating that - the stripes will inherit the background color specified by the - -background + composed of the next stripeHeight viewable items, + which in turn is followed by the same number of "normal" viewable + items, and so on.  In the Tablelist package and in most themes + supported by Tablelist_tile, the default value is an empty string, + indicating that the stripes will inherit the background color specified + by the -background configuration option.  When using Tablelist_tile with the tileqt theme then the default value is given by the global KDE option alternateBackground, which in @@ -3561,18 +4197,18 @@

      Detailed Reference

      -

      Specifies the foreground color to use when displaying the items +

      Specifies the foreground color to use when displaying the body items belonging to a stripe.  Each stripe is composed of the same number - stripeHeight of consecutive stripeHeight of consecutive viewable items, according to the value of the -stripeheight - configuration option.  The first stripeHeight + configuration option.  The first stripeHeight viewable items are "normal" ones; they are followed by a stripe - composed of the next stripeHeight viewable items, which in - turn is followed by the same number of "normal" viewable items, and so - on.  The default value is an empty string, indicating that the - stripes will inherit the foreground color specified by the - -foreground + composed of the next stripeHeight viewable items, + which in turn is followed by the same number of "normal" viewable + items, and so on.  The default value is an empty string, + indicating that the stripes will inherit the foreground color specified + by the -foreground configuration option.  The -stripeforeground option has a higher priority than the -foreground column configuration option, but a lower priority than the @@ -3634,9 +4270,8 @@

      Detailed Reference

      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 widget itself but - its body child (containing the items) will receive the focus during - keyboard traversal with the standard keys (Tab and - Shift-Tab).

      + its body child will receive the focus during keyboard traversal with + the standard keys (Tab and Shift-Tab).

      @@ -3663,9 +4298,9 @@

      Detailed Reference

      Specifies the color of the gap displayed in the tablelist's body or - header to indicate the target position when moving a row or column - interactively.  The target indicator belonging to the tablelist's - body can also be displayed explicitly with the aid of the + header label area to indicate the target position when moving a row or + column interactively.  The target indicator belonging to the + tablelist's body can also be displayed explicitly with the aid of the showtargetmark subcommand, and its path name can be retrieved via targetmarkpath.  The default @@ -3697,9 +4332,9 @@

      Detailed Reference

      Specifies a boolean value that determines whether to eliminate the one-pixel additional space left below each tablelist row for Tk listbox - compatibility.  The default value is 0, which draws a - one-pixel additional space below each row, just like a Tk core - listbox.

      + compatibility, in both the body and the header.  The default value + is 0, which draws a one-pixel additional space below each + row, just like a Tk core listbox.

      REMARK:  You can set this option to true and at the same time provide additional space above and below each row with the aid of @@ -3783,18 +4418,23 @@

      Detailed Reference

      Specifies a Tcl command to be used for displaying cell- and column - label-specific balloon help.  When the mouse pointer enters a - cell, the command is automatically concatenated with the name of the - tablelist widget and the cell's row and column indices, and the - resulting script is evaluated in the global scope.  Similarly, - when the mouse pointer enters a header label, the command is - automatically concatenated with the name of the tablelist widget, the - number -1, and the column index of the respective label, - and the resulting script is evaluated in the global scope.  In - both cases, the action described above is only triggered if both the - value of this option and that of -tooltipdelcommand are nonempty - strings.

      + label-specific balloon help.  When the mouse pointer enters a cell + in the tablelist's body, the command is automatically concatenated with + the path name of the tablelist widget and the cell's row and column + indices, and the resulting script is evaluated in the global + scope.  Similarly, when the mouse pointer enters a header label, + the command is automatically concatenated with the path name of the + tablelist widget, the number -1, and the column index of + the respective label, and the resulting script is evaluated in the + global scope.  Finally, when the mouse pointer enters a cell in + the tablelist's header, the command is automatically concatenated with + the path name of the tablelist widget, the header cell's row index + prefixed by the letter h, as well as the cell's + column index, and the resulting script is evaluated in the global + scope.  In all three cases, the action described above is only + triggered if both the value of this option and that of + -tooltipdelcommand + are nonempty strings.

      For example, consider the procedure tooltipAddCmd shown below, which makes use of the DynamicHelp::add @@ -3805,9 +4445,9 @@

      Detailed Reference

       proc tooltipAddCmd {tbl row col} {
      -    if {($row >= 0 && [$tbl iselemsnipped $row,$col fullText]) ||
      -        ($row <  0 && [$tbl istitlesnipped $col fullText])} {
               DynamicHelp::add $tbl -text $fullText
           }
      @@ -3815,6 +4455,30 @@ 

      Detailed Reference

      +

      If the widget can also contain header items then a slightly more + complicated procedure is needed:

      + +
      +
      +proc tooltipAddCmd {tbl row col} {
      +    if {[string is integer $row]} {
      +        if {($row >= 0 && [$tbl iselemsnipped $row,$col fullText]) ||
      +            ($row <  0 && [$tbl istitlesnipped $col fullText])} {
      +            DynamicHelp::add $tbl -text $fullText
      +        }
      +    } else {
      +        set row [string range $row 1 end]
      +        if {[$tbl header iselemsnipped $row,$col fullText]} {
      +            DynamicHelp::add $tbl -text $fullText
      +        }
      +    }
      +}
      +
      +
      +

      A tablelist widget can use this procedure by specifying

      @@ -3830,9 +4494,9 @@

      Detailed Reference

       proc tooltipAddCmd {tbl row col} {
      -    if {($row >= 0 && [$tbl iselemsnipped $row,$col fullText]) ||
      -        ($row <  0 && [$tbl istitlesnipped $col fullText])} {
               tooltip::tooltip $tbl $fullText
           }
      @@ -3840,6 +4504,29 @@ 

      Detailed Reference

      +

      or, to cover also the case of header items:

      + +
      +
      +proc tooltipAddCmd {tbl row col} {
      +    if {[string is integer $row]} {
      +        if {($row >= 0 && [$tbl iselemsnipped $row,$col fullText]) ||
      +            ($row <  0 && [$tbl istitlesnipped $col fullText])} {
      +            tooltip::tooltip $tbl $fullText
      +        }
      +    } else {
      +        set row [string range $row 1 end]
      +        if {[$tbl header iselemsnipped $row,$col fullText]} {
      +            tooltip::tooltip $tbl $fullText
      +        }
      +    }
      +}
      +
      +
      +

      and can be used by specifying

      @@ -3862,10 +4549,12 @@

      Detailed Reference

      Both examples above make use of the iselemsnipped and istitlesnipped subcommands, to make - sure that the full cell and label texts will only be displayed for - those cells and header labels whose contents are snipped.

      + "#iselemsnipped">iselemsnipped
      header iselemsnipped,  and + istitlesnipped + subcommands, to make sure that the full cell and label texts will only + be displayed for those cells and header labels whose contents are + snipped.

      @@ -3894,8 +4583,8 @@

      Detailed Reference

      Specifies a Tcl command to be used for removing the cell- or column label-specific balloon help.  When the mouse pointer leaves a cell or a header label, the command specified by this option is - automatically concatenated with the name of the tablelist widget and - the resulting script is evaluated in the global scope.  This + automatically concatenated with the path name of the tablelist widget + and the resulting script is evaluated in the global scope.  This action is only triggered if both the value of this option and that of -tooltipaddcommand are nonempty strings.  Common values for this option are @@ -3929,9 +4618,9 @@

      Detailed Reference

      Specifies the column to contain the indentations and expand/collapse - controls for a tablelist used as a tree widget.  The option's - value may be a column index in any of the forms described in the - COLUMN INDICES section below.  The + controls in the body of a tablelist used as a tree widget.  The + option's value may be a column index in any of the forms described in + the COLUMN INDICES section below.  The specified column index is replaced with its numerical equivalent, and it will be updated automatically whenever columns are inserted, deleted, or moved.  The default value is 0.

      @@ -3969,15 +4658,15 @@

      Detailed Reference

      -

      Specifies the look & feel of the column containing the - indentations and expand/collapse controls for a tablelist used as a +

      Specifies the look & feel of the column containing the indentations + and expand/collapse controls in the body of a a tablelist used as a tree widget.  This includes, among others, the images used for displaying the expand/collapse controls, the indentation width, and whether expand/collapse controls and indentations are to be protected when selecting a row or cell.  The currently supported values are shown at a glance in the two tables below:

      -

      Tree styles for native look & feel:

      +

      Tree styles for native look & feel:

      @@ -4133,6 +4822,8 @@

      Detailed Reference

      + + @@ -4147,11 +4838,11 @@

      Detailed Reference

      - - + + @@ -4161,8 +4852,6 @@

      Detailed Reference

      - - @@ -4309,14 +4998,14 @@

      Detailed Reference

      aquavistaAero win110aqua
      aquavistaAero vistaClassic win7Classic win10aqua

      If the tree style is gtk, - adwaita, blueMenta, + adwaita, blueMenta, ubuntu, ubuntu2, ubuntu3, mint, mint2, mate, menta, ubuntuMate, arc, oxygen2, - vistaAero, win7Aero, - win10, aqua, + aqua, vistaAero, + win7Aero, win10, newWave, plain*, or bicolor*, and the Tk version is either 8.6 (with built-in PNG support) or 8.5 and the img::png @@ -4537,8 +5226,8 @@

      Detailed Reference

      menta - Inspired by the GTK 3 theme Menta of versions 1.14 and later - of the MATE desktop. + Inspired by the GTK 3 theme Menta of versions 1.14 and later of + the MATE desktop. @@ -4680,7 +5369,7 @@

      Detailed Reference

      "51"> Inspired by a couple of GTK 3 themes bundled with versions - earlier than 15.4 of the Ubuntu Linux distribution. + earlier than 15.04 of the Ubuntu Linux distribution. @@ -4690,7 +5379,7 @@

      Detailed Reference

      "51"> Inspired by a couple of GTK 3 themes bundled with versions - 15.04 – 16.04 of the Ubuntu Linux distribution. + 15.04 – 16.04 of the Ubuntu Linux distribution. @@ -4699,8 +5388,8 @@

      Detailed Reference

      ubuntu3 - Inspired by a couple of GTK 3 themes bundled with version - 16.10 of the Ubuntu Linux distribution. + Inspired by a couple of GTK 3 themes bundled with versions + 16.10 and later of the Ubuntu Linux distribution. @@ -4710,7 +5399,7 @@

      Detailed Reference

      "51"> Inspired by the themes Ambiant-MATE and Radiant-MATE bundled - with version 16.10 of the Ubuntu MATE distribution. + with versions 16.10 and later of the Ubuntu MATE distribution. @@ -4989,6 +5678,176 @@

      Detailed Reference

      characters of the widget's font.  If zero or less then the desired width for the window is made just large enough to hold all the columns in the tablelist widget.

      + +

      REMARK:  If the value of this configuration option is + zero or less and the tablelist has stretchable + columns, then the -setgrid option will be + ignored.  This minor restriction has technical reasons and is only + relevant on X11.

      +
      + + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -xmousewheelwindow
      Database Name: xMouseWheelWindow
      Database Class: MouseWheelWindow
      + +
      +

      This option is only relevant if the mouse wheel events are reported + to the widget under the pointer rather than to the one having the + focus.  This condition is fulfilled on X11 and Mac OS X, and for + Tk 8.6b2 and later on Windows, too (in earlier Tk versions the mouse + wheel events on Windows were sent to the widget having the focus).

      + +

      The -xmousewheelwindow option specifies the path + name of the window to which the default bindings for the binding tags + TablelistBody and + TablelistEdit should + redirect the mouse wheel events along the x axis via  + event generate  if the focus window on the + display containing the tablelist widget is outside the tablelist.  + The default is an empty string, meaning that the mouse wheel events + along the x axis received by a widget having one of the two + above-mentioned binding tags will give rise to horizontal scrolling of + the tablelist or its edit window, regardless of whether the focus is + inside or outside the tablelist widget.

      + +

      REMARK 1:  The mouse wheel events along the horizontal + axis are <Shift-MouseWheel> on Windows, + <Shift-MouseWheel> and + <Shift-Option-MouseWheel> on Mac OS X, and + <Shift-MouseWheel>, + <Shift-Button-4> and + <Shift-Button-5> on X11 (where + <Shift-MouseWheel> is not triggered by the X + server, but can be produced using  + event generate).

      + +

      REMARK 2:  If the tablelist is contained in a scrollable + widget container like a BWidget ScrollableFrame or + iwidgets::scrolledframe, and you set this option to the path name of + that container window or that of the containing toplevel widget, then a + horizontal mouse wheel event over the tablelist's body will be handled + as follows:

      + +
        +
      • If the focus is inside the tablelist widget then the + event will scroll the tablelist or its edit window horizontally and + no further processing of the event will take place.
      • + +
      • If the focus is outside the tablelist widget then no + scrolling of the tablelist's body or edit window will happen.  + Instead, the event will be redirected to the widget container or the + toplevel widget with the aid of the  event + generate  command.  This in turn will give rise + to horizontal scrolling of the widget container, provided that the + containing toplevel widget or the binding tag all + has the necessary mouse wheel event bindings.
      • +
      + +

      REMARK 3:  If you pass the tablelist widget to the + scrollutil::adaptWheelEventHandling + command then the latter sets this option to the path name of the + containing toplevel window.

      +
      +
      + +
      + + + + + + + + + + + + + + + + + + +
      Command-Line Name: -ymousewheelwindow
      Database Name: yMouseWheelWindow
      Database Class: MouseWheelWindow
      + +
      +

      This option is only relevant if the mouse wheel events are reported + to the widget under the pointer rather than to the one having the + focus.  This condition is fulfilled on X11 and Mac OS X, and for + Tk 8.6b2 and later on Windows, too (in earlier Tk versions the mouse + wheel events on Windows were sent to the widget having the focus).

      + +

      The -ymousewheelwindow option specifies the path + name of the window to which the default bindings for the binding tags + TablelistBody and + TablelistEdit should + redirect the mouse wheel events along the y axis via  + event generate  if the focus window on the + display containing the tablelist widget is outside the tablelist.  + The default is an empty string, meaning that the mouse wheel events + along the y axis received by a widget having one of the two + above-mentioned binding tags will give rise to vertical scrolling of + the tablelist or its edit window, regardless of whether the focus is + inside or outside the tablelist widget.

      + +

      REMARK 1:  The mouse wheel events along the vertical + axis are <MouseWheel> on Windows, + <MouseWheel> and + <Option-MouseWheel> on Mac OS X, and + <MouseWheel>, + <Button-4> and + <Button-5> on X11 (where + <MouseWheel> is not triggered by the X + server, but can be produced using  + event generate).

      + +

      REMARK 2:  If the tablelist is contained in a scrollable + widget container like a BWidget ScrollableFrame or + iwidgets::scrolledframe, and you set this option to the path name of + that container window or that of the containing toplevel widget, then a + vertical mouse wheel event over the tablelist's body will be handled as + follows:

      + +
        +
      • If the focus is inside the tablelist widget then the + event will scroll the tablelist or its edit window vertically and no + further processing of the event will take place.
      • + +
      • If the focus is outside the tablelist widget then no + scrolling of the tablelist's body or edit window will happen.  + Instead, the event will be redirected to the widget container or the + toplevel widget with the aid of the  event + generate  command.  This in turn will give rise + to vertical scrolling of the widget container, provided that the + containing toplevel widget or the binding tag all + has the necessary mouse wheel event bindings.
      • +
      + +

      REMARK 3:  If you pass the tablelist widget to the + scrollutil::adaptWheelEventHandling + command then the latter sets this option to the path name of the + containing toplevel window.

      @@ -5005,10 +5864,10 @@

      Detailed Reference

      -align alignment
      -
      Specifies how to align the elements of the column.  It must be - one of left, right, or - center.  This option also refers to the - column's title if the Specifies how to align the body and header elements of the + column.  It must be one of left, + right, or center.  This + option also refers to the column's title if the -labelalign option hasn't been specified for the given column, or if its value is an empty string.  The -align option is tied to the @@ -5021,20 +5880,20 @@

      Detailed Reference

      color
      or -bg color
      Specifies the normal background color to use when displaying the - contents of the column.
      + content of the column in both the body and the header.
      -changesnipside boolean
      Specifies whether to override the alignment-specific default position of the snip indicator when - displaying the elements of the column (excluding its title).  The - default value is 0, meaning that the snip string will be - appended to the elements if the column's alignment is - left or center and prepended to - them in case the alignment is right.
      + displaying the body and header elements of the column (excluding its + title).  The default value is 0, meaning that the + snip string will be appended to the elements if the column's alignment + is left or center and prepended + to them in case the alignment is right. -
      +
      -changetitlesnipside boolean
      Specifies whether to override the alignment-specific default @@ -5048,23 +5907,26 @@

      Detailed Reference

      -editable boolean
      -
      Specifies whether the elements of the column can be edited - interactively.  The default value is 0.  The - value of this option can be overridden for individual cells by using - the cell configuration option of the same - name.
      +
      Specifies whether the elements of the column in the tablelist's + body can be edited interactively.  The default value is + 0.  The value of this option can be overridden for + individual cells by using the cell + configuration option of the same name.
      + +
      REMARK:  The support for interactive editing + is restricted to the widget's body component
      -editwindow name
      Specifies the type of the temporary embedded widget to be used for - interactive editing of the contents of the given column's cells.  - name may be one of entry (which - is the default), text, spinbox - (the latter for Tk versions 8.4 or higher), - checkbutton, menubutton, - ttk::entry, ttk::spinbox, - ttk::combobox, + interactive editing of the contents of the given column's body + cells.  name may be one of + entry (which is the default), + text, spinbox (the latter for + Tk versions 8.4 or higher), checkbutton, + menubutton, ttk::entry, + ttk::spinbox, ttk::combobox, ttk::checkbutton, or ttk::menubutton (the latter five only in the presence of the tile widget engine), or the value returned by one of @@ -5089,25 +5951,25 @@

      Detailed Reference

      -font font
      -
      Specifies the font to use when displaying the contents of the - column.
      +
      Specifies the font to use when displaying the content of the column + in both the body and the header.
      -foreground color or -fg color
      Specifies the normal foreground color to use when displaying the - contents of the column.
      + content of the column in both the body and the header.
      -formatcommand command
      Specifies a Tcl command to be invoked when displaying the content - of a cell within this column or adding it to the selection when the - latter is being exported.  If command is a - nonempty string, then it is automatically concatenated with the cell's - text, the resulting script is evaluated in the global scope, and the - return value is displayed in the cell or added to the selection instead - of the original data.
      + of a body or header cell within this column or adding a body cell's + content to the selection when the latter is being exported.  If + command is a nonempty string then it is + automatically concatenated with the cell's text, the resulting script + is evaluated in the global scope, and the return value is displayed in + the cell or added to the selection instead of the original data.
      For example, if a time value in seconds is being inserted into the cell and command is the procedure @@ -5131,15 +5993,17 @@

      Detailed Reference

      "#getformatted">getformatted
      , getformattedcolumns, and getformattedcells - subcommands, or searching for a text pattern passed to the - searchcolumn subcommand - with the -formatted option.  All the other - subcommands, notably get, - getcolumns, - getcells, rowcget, columncget, cellcget, searchcolumn subcommand with the + -formatted option.  All the other subcommands, + notably get, getcolumns, getcells, rowcget, along with their counterparts for + the header, columncget, + cellcget, along with the + latter's header-related counterpart, sort, sortbycolumn, sortbycolumnlist, and @@ -5156,7 +6020,53 @@

      Detailed Reference

      strings because they are needed for other purposes (like sorting or editing).  In such cases, a procedure returning an empty string can be used as the option's value, thus making sure that the textual - information contained in that column remains hidden.
      + information contained in that column remains hidden: + +
      +
      +
      +proc emptyStr val { return "" }
      +
      +
      +
      + +
      Another important use case is related to tablelist columns whose + -sortmode option was + set to integer or real.  + If some of the cells of such a column are empty then an attempt to sort + the items by that column via sortbycolumn or sortbycolumnlist would generate an + error, because the  lsort -integer  + or  lsort -real  invocation made by + Tablelist would complain about getting an unexpected empty string + instead of an integer or floating-point number.  To avoid this, + make sure that the cells intended to display an empty string have as + internal value a number that is either strictly less or strictly + greater than all the other integer or real numbers contained in the + column in question, and use the -formatcommand + option to control what will be displayed in the column's cells.  + For example, if all the elements of the column are non-negative values + then you can use the number -1 as internal value for the + cells that should display an empty string, and set the value of the + -formatcommand option to formatNumber, + where formatNumber is the procedure implemented as + follows:
      + +
      +
      +
      +proc formatNumber val { return [expr {$val == -1 ? "" : $val}] }
      +
      +
      +
      + +
      This will make the cells displaying an empty string appear before + all the others when sorting the column in increasing order.  To + achieve the opposite effect, you will have to replace the + -1 with an application-specific value that is strictly + greater than all the other numbers contained in the column in + question.
      The demo scripts included in the Tablelist distribution contain further examples demonstrating the use of this option.  @@ -5187,7 +6097,7 @@

      Detailed Reference

      0.  After toggling the hidden state of a column, the <<TablelistColHiddenStateChanged>> virtual event is generated, with its -data option - set to the numerical column index for Tk versions 8.5 or higher.
      + set to the numerical column index for Tk versions 8.5 and higher.
      -labelalign alignment
      @@ -5215,6 +6125,7 @@

      Detailed Reference

      -labelheight lines
      -labelpady screenDistance
      -labelrelief relief + -selectfiltercommand command
      The value of each of these options may also be an empty string.  These options are the column-specific equivalents of the @@ -5248,6 +6159,17 @@

      Detailed Reference

      image are separated from each other by a gap corresponding to the width of a space character in the given label's font.
      +
      -labelvalign + verticalAlignment
      + +
      Specifies the vertical alignment of the Tk image (if any) displayed + in the header label.  The verticalAlignment + must be one of center (which is the default), + top, or bottom.  + Especially if the label contains a multi-line text, the image is often + not as tall as the text; in such cases, this option enables you to + control the column-dependent vertical alignment of the image.
      +
      -maxwidth width
      @@ -5268,18 +6190,20 @@

      Detailed Reference

      moving columns, its name remains constant and can be used as a safe alternative column index (see the COLUMN INDICES section for details).  Similarly, it can also be used - as the second component of a cell index of the form - row,col, as described in the CELL INDICES section.  To avoid ambiguities, - column names should be different from any other forms of column indices - (like numbers, active, anchor, - end, last, - left, right, or any of their - abbreviations).  They should also be different from (any - abbreviations of) the string all, which may be - specified as the value of the -stretch configuration option.  The - default value is an empty string. + as the second component of a body cell index of the form + row,col or a header cell index of the + form headerRow,col, as described in + the CELL INDICES and HEADER CELL INDICES sections.  To avoid + ambiguities, column names should be different from any other forms of + column indices (like numbers, active, + anchor, end, + last, left, + right, or any of their abbreviations).  They + should also be different from (any abbreviations of) the string + all, which may be specified as the value of the + -stretch configuration + option.  The default value is an empty string.
      -resizable boolean
      @@ -5295,14 +6219,14 @@

      Detailed Reference

      -selectbackground color
      -
      Specifies the background color to use when displaying the contents - of a cell in the given column while the cell is selected.
      +
      Specifies the background color to use when displaying the content + of a body cell in the given column while the cell is selected.
      -selectforeground color
      -
      Specifies the foreground color to use when displaying the contents - of a cell in the given column while the cell is selected.
      +
      Specifies the foreground color to use when displaying the content + of a body cell in the given column while the cell is selected.
      -showarrow boolean
      @@ -5321,24 +6245,24 @@

      Detailed Reference

      -showlinenumbers boolean
      -
      Specifies whether the given column should display the line numbers - (starting with 1 and ending with the number of the non-hidden - rows).  The default value is 0.
      +
      Specifies whether the body part of the given column should display + the line numbers (starting with 1 and ending with the number of the + non-hidden rows).  The default value is 0.
      The following details assume that the given column's -showlinenumbers option was set to true:  Associating the line numbers with the non-hidden rows takes place - automatically whenever items are inserted, deleted, updated, moved, or - sorted, or their -hide - option is toggled.  For increased efficiency, this is done at idle - time.  For example, if several items are inserted into or deleted - from the tablelist widget, then the necessary renumbering of the - non-hidden rows will be performed as an idle callback, the next time - the event loop is entered and there are no events to process.  The - line numbers will override any previous contents of the column's - cells.  They are, per default, displayed without leading zeros, - but this (and the display format in general) can be changed with the - aid of the -hide option is toggled.  For increased + efficiency, this is done at idle time.  For example, if several + items are inserted into or deleted from the body of a tablelist widget, + then the necessary renumbering of the non-hidden rows will be performed + as an idle callback, the next time the event loop is entered and there + are no events to process.  The line numbers will override any + previous contents of the column's cells.  They are, per default, + displayed without leading zeros, but this (and the display format in + general) can be changed with the aid of the -formatcommand column configuration option.
      @@ -5431,14 +6355,24 @@

      Detailed Reference

      integer Convert the elements to integers and use integer - comparison. + comparison.  If any of the elements cannot be converted to + an integer (e.g., because it is an empty string) then a sort + attempt will generate an error.  See the description of the + -formatcommand option for the + recommended way to avoid this problem. real Convert the elements to floating-point values and use - floating-point comparison. + floating-point comparison.  If any of the elements cannot be + converted to a floating-point value (e.g., because it is an empty + string) then a sort attempt will generate an error.  See the + description of the -formatcommand option for the + recommended way to avoid this problem. @@ -5455,33 +6389,34 @@

      Detailed Reference

      -stripebackground color
      -
      Specifies the background color to use when displaying the contents - of a cell in the given column if the cell's row belongs to a +
      Specifies the background color to use when displaying the content + of a body cell in the given column if the cell's row belongs to a stripe.
      -stripeforeground color
      -
      Specifies the foreground color to use when displaying the contents - of a cell in the given column if the cell's row belongs to a +
      Specifies the foreground color to use when displaying the content + of a body cell in the given column if the cell's row belongs to a stripe.
      -text list
      -
      Specifies a list of strings to be displayed in the cells of the - given column, i.e., updates the elements contained in the column.  - If the tablelist's state is - disabled then this option will be ignored.
      +
      Specifies a list of strings to be displayed in the body cells of + the given column, i.e., updates the elements contained in the column's + body part.  If the tablelist's state is disabled then this + option will be ignored.
      -title title
      -
      Specifies the text to be displayed in the column's header.  - This option is tied to the title element - corresponding to the given column in the list specifying the value of - the -columns option for the - tablelist widget; changes in either will automatically be reflected in - the other.
      +
      Specifies the text to be displayed in the column's header + label.  This option is tied to the title + element corresponding to the given column in the list specifying the + value of the -columns option + for the tablelist widget; changes in either will automatically be + reflected in the other.
      -valign verticalAlignment
      @@ -5518,20 +6453,20 @@

      Detailed Reference

      -wrap boolean
      -
      Specifies whether to display those elements of the given column - that don't fit into their cells in word-wrapped multi-line rather than - snipped form.  The default value is 0.  If the - specified column has static width or a nonzero -maxwidth value and the value of this - option is true, then elements of the column that are too long to be - displayed in a single line will be broken up into several lines.  - The same applies to the individual lines of the multi-line elements - (i.e., elements containing newline characters): they will also be - wrapped if necessary, thus giving rise to additional line breaks.  - In both cases, the line breaks are chosen at word boundaries wherever - possible, and they are only used for the external representation of the - strings contained in the given column, without affecting the internal - contents of the cells.
      +
      Specifies whether to display those body and header elements of the + given column that don't fit into their cells in word-wrapped multi-line + rather than snipped form.  The default value is + 0.  If the specified column has static width or a + nonzero -maxwidth value + and the value of this option is true, then elements of the column that + are too long to be displayed in a single line will be broken up into + several lines.  The same applies to the individual lines of the + multi-line elements (i.e., elements containing newline characters): + they will also be wrapped if necessary, thus giving rise to additional + line breaks.  In both cases, the line breaks are chosen at word + boundaries wherever possible, and they are only used for the external + representation of the strings contained in the given column, without + affecting the internal contents of the cells.
      @@ -5546,7 +6481,8 @@

      Detailed Reference

      the COLORS AND FONTS section for further details on these options. -
      ROW CONFIGURATION OPTIONS
      +
      ROW CONFIGURATION OPTIONS IN THE + TABLELIST BODY
      The following options are currently supported by the rowcget, Detailed Reference color or -bg color
      Specifies the normal background color to use when displaying the - contents of the row.
      + content of the row.
      -font font
      -
      Specifies the font to use when displaying the contents of the +
      Specifies the font to use when displaying the content of the row.
      -foreground color or -fg color
      Specifies the normal foreground color to use when displaying the - contents of the row.
      + content of the row.
      -hide boolean
      @@ -5581,7 +6517,7 @@

      Detailed Reference

      0.  After toggling the hidden state of a row, the <<TablelistRowHiddenStateChanged>> virtual event is generated, with its -data option - set to the numerical row index for Tk versions 8.5 or higher. + set to the numerical row index for Tk versions 8.5 and higher.
      For technical reasons (the use of the -elide option for a text widget tag), this option @@ -5628,13 +6564,13 @@

      Detailed Reference

      -selectbackground color
      -
      Specifies the background color to use when displaying the contents +
      Specifies the background color to use when displaying the content of a cell in the given row while the cell is selected.
      -selectforeground color
      -
      Specifies the foreground color to use when displaying the contents +
      Specifies the foreground color to use when displaying the content of a cell in the given row while the cell is selected.
      -text list
      @@ -5655,7 +6591,74 @@

      Detailed Reference

      string.  See the
      COLORS AND FONTS section for further details on these options. -
      CELL CONFIGURATION OPTIONS
      +
      ROW CONFIGURATION OPTIONS IN THE + TABLELIST HEADER
      + +
      The following options are currently supported by the  + header rowcget,  + header + rowconfigureheader configrowlist,  and  + header configrows  + commands:
      + +
      +
      +
      -background + color or -bg color
      + +
      Specifies the background color to use when displaying the content + of the header row.
      + +
      -font + font
      + +
      Specifies the font to use when displaying the content of the header + row.
      + +
      -foreground + color or -fg color
      + +
      Specifies the foreground color to use when displaying the content + of the header row.
      + +
      -name + name
      + +
      Specifies a name associated with the header row.  While the + numerical index of a header row might change by inserting or deleting + header rows, its name remains constant and can be used as a safe + alternative header row index (see the HEADER + ROW INDICES section for details).  Similarly, it can also be + used as the first component of a header cell index of the form + headerRow,col, as described in the + HEADER CELL INDICES section.  To + avoid ambiguities, header row names should be different from any other + forms of header row indices (like numbers, full keys, + end, last, or any of their + abbreviations).  The default value is an empty string.
      + +
      -text + list
      + +
      Specifies a list of strings to be displayed in the cells of the + given header row, i.e., updates the item contained in the header + row.  If the tablelist's state is disabled then this + option will be ignored.
      +
      +
      + +
      The -background, + -font, and -foreground header row + configuration options override the options of the same names set at column + or widget level (but not the ones set at header cell level) if the + specified value is not an empty string.  See the COLORS AND FONTS section for further details on + these options.
      + +
      CELL CONFIGURATION OPTIONS IN THE + TABLELIST BODY
      The following options are currently supported by the cellcget, Detailed Reference color or -bg color
      Specifies the normal background color to use when displaying the - contents of the cell.
      + content of the cell.
      -editable boolean
      -
      Specifies whether the contents of the cell can be edited +
      Specifies whether the content of the cell can be edited interactively.  The default value is 0.  This option overrides the one of the same name for the column containing the given cell.
      @@ -5683,7 +6686,7 @@

      Detailed Reference

      name
      Specifies the type of the temporary embedded widget to be used for - interactive editing of the cell's contents.  The default value is + interactive editing of the cell's content.  The default value is entry.  This option overrides the one of the same name for the column containing the given cell, and may have the same values as its @@ -5692,14 +6695,14 @@

      Detailed Reference

      -font font
      -
      Specifies the font to use when displaying the contents of the +
      Specifies the font to use when displaying the content of the cell.
      -foreground color or -fg color
      Specifies the normal foreground color to use when displaying the - contents of the cell.
      + content of the cell.
      -image image
      @@ -5719,26 +6722,52 @@

      Detailed Reference

      option will be ignored.
      To display an image in a cell, Tablelist makes use of an - embedded label widget (which is created on demand).  This requires - more memory than inserting the image directly into the tablelist's - body, but has the main advantage of making it possible to adjust the - width of the label containing the widget to fit into its column.  - This has the visual effect of cutting off part of the image from its - right side.  To make sure that images with transparent background - will be displayed correctly, the background color of the label widgets - containing the embedded images is automatically updated whenever + embedded label widget (which is created on demand).  This has the + main advantage of making it possible to adjust the width of the label + containing the image to fit into its column.  This has the visual + effect of cutting off part of the image from its right side.  The + above-mentioned gap to the left or right of the image is also part of + this label.  To make sure that an image with fully or partially + transparent background will be displayed correctly, the background + color of the label widget containing the embedded image is + automatically synchronized with the cell's background color whenever + necessary (e.g., when selecting or deselecting the cell's content, or + changing its background color), provided that the -imagebackground option was not + set or its value is an empty string.  This automatic color + synchronization makes also sure that the gap between the text and the + image is displayed in the right color.
      + +
      -imagebackground + color
      + +
      Specifies the background color of the label widget containing the + embedded image (if any).  If the value of this option is a valid + nonempty color specification then the fully transparent pixels of the + embedded image will appear in the specified color, and the partially + transparent ones will be shown modified according to their alpha + value and the image background color.  The default value is an + empty string, meaning that the background color of the label widget + containing the embedded image will be automatically updated whenever necessary.
      +
      REMARK:  This option works fine if the + cell's text (or at least the latter's formatted version) is an empty string.  + Otherwise there will be a gap between the text and the image, and this + gap will appear in the specified image background color if the latter + is a nonempty string.
      +
      -selectbackground color
      -
      Specifies the background color to use when displaying the contents +
      Specifies the background color to use when displaying the content of the cell while it is selected.
      -selectforeground color
      -
      Specifies the foreground color to use when displaying the contents +
      Specifies the foreground color to use when displaying the content of the cell while it is selected.
      -stretchwindow @@ -5784,10 +6813,10 @@

      Detailed Reference

      command
      Specifies a Tcl command creating the window to be embedded into the - cell.  The command is automatically concatenated with the name of - the tablelist widget, the cell's row and column indices, as well as the - path name of the embedded window to be created, and the resulting - script is evaluated in the global scope.  + cell.  The command is automatically concatenated with the path + name of the tablelist widget, the cell's row and column indices, as + well as the path name of the embedded window to be created, and the + resulting script is evaluated in the global scope.  command may also be an empty string, specifying that no embedded window is to be displayed.  If the column containing the cell is right-aligned then the window will be displayed @@ -5803,7 +6832,7 @@

      Detailed Reference

      the embedded window will be destroyed and later recreated by invoking the script mentioned above.  For example, when changing the value of some of the tablelist widget or column configuration options, - sorting the items, or moving a row or a column, the widget's contents + sorting the items, or moving a row or a column, the widget's content will be redisplayed, which makes it necessary to recreate the embedded windows.  This operation won't preserve the changes made on the embedded windows after their creation.  For this reason, you @@ -5815,7 +6844,7 @@

      Detailed Reference

      Specifies a Tcl command to be invoked when a window embedded into the cell is destroyed.  The command is automatically concatenated - with the name of the tablelist widget, the cell's row and column + with the path name of the tablelist widget, the cell's row and column indices, as well as the path name of the embedded window, and the resulting script is evaluated in the global scope.  This option provides an easy-to-use alternative to binding a script to the embedded @@ -5836,10 +6865,10 @@

      Detailed Reference

      "#stripebackground">-stripebackground
      and -stripeforeground widget or column configuration options.  The command is - automatically concatenated with the name of the tablelist widget, the - cell's row and column indices, the path name of the embedded window, - the option name -background and the cell's current - background color, as well as the option name + automatically concatenated with the path name of the tablelist widget, + the cell's row and column indices, the path name of the embedded + window, the option name -background and the cell's + current background color, as well as the option name -foreground and the cell's current foreground color.  The resulting script is then evaluated in the global scope.  The specified command can use the colors passed to it as @@ -5896,87 +6925,113 @@

      Detailed Reference

      "#colors_and_fonts">COLORS AND FONTS section for further details on these options.
      -
      DESCRIPTION
      +
      CELL CONFIGURATION OPTIONS IN THE + TABLELIST HEADER
      -
      The tablelist::tablelist command creates a new - window named pathName and of the class - Tablelist, and makes it into a tablelist - widget.  Additional options, described above, may be specified on the - command line or in the option database to configure aspects of the - tablelist such as its colors, font, and columns.  The - tablelist::tablelist 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.
      +
      The following options are currently supported by the  + header cellcget,  + header + cellconfigureheader configcelllist,  and  + header configcells  + commands:
      -
      A tablelist is a multi-column listbox and tree widget, - implemented as a mega-widget, consisting of a body and a - header.  The body displays a list of items, one per - line.  Each item is a list of elements, which are aligned in - columns.  In other words, an item is the contents of a row, and an - element is the text contained in a cell.  The header consists of label - widgets displaying the column titles.  The labels can be used, among - others, for interactive column resizing and column-based sorting of the - items, as described below.
      +
      +
      +
      -background + color or -bg color
      -
      Each cell and each header label of a tablelist widget can - also contain an image, which is placed to the left or right of the text, - depending on the column's alignment.  Instead of an image, a tablelist - cell can also contain an embedded window, placed to the left or right of - the text, just like an embedded image.
      +
      Specifies the normal background color to use when displaying the + content of the header cell.
      -
      When a tablelist is used as a tree widget, one of its - columns will display the tree hierarchy with the aid of indentations and - expand/collapse controls.  The Tablelist package provides a great - variety of tree styles controlling the look & feel of that column, and - chooses the correct default style depending on the windowing system, - operating system version, and tile theme.  In a tablelist used as a - multi-column tree widget, every row is at the same time a tree node, - having exactly one parent node and any number of child - nodes.  The tree's origin is the invisible root node, which has - no parent itself and whose children are the top-level nodes.
      +
      -font + font
      -
      The elements of a tablelist widget can, per default, be only - edited programmatically.  However, interactive editing can be enabled - for individual cells and for entire columns.  Per default, the - interactive cell editing uses a temporary embedded entry widget, thus - making sure that all the validation facilities available for entry widgets - can be used during the editing process.  A great variety of widgets - from the packages BWidget, Iwidgets, combobox (by Bryan Oakley), ctext, and - Mentry (or Mentry_tile), as well as Tk core text, spinbox, checkbutton, and - menubutton widgets, along with tile entry, spinbox, combobox, checkbutton, - and menubutton widgets are also supported as temporary embedded widgets - used for cell editing.  In addition, a rich set of keyboard bindings - is provided for a comfortable navigation between the editable cells.
      +
      Specifies the font to use when displaying the content of the header + cell.
      -
      When first created, a new tablelist widget has no - items.  Items may be added, deleted, or updated using widget commands - described below.  In addition, one or more items or elements may be - selected.  If a tablelist widget is exporting its selection (see the - -exportselection option), then it will observe the - standard X11 protocols for handling the selection.  Tablelist widget - selections are available as types STRING and - UTF8_STRING; the value of the selection will be a text - built by taking all of the rows having at least one viewable selected element, joining these elements - together with tabs, and the resulting strings in turn with newlines.  - If a tablelist widget that is exporting its selection is the selection - owner and some other window claims ownership of the selection away from it, - then the virtual event - <<TablelistSelectionLost>> is - generated.
      +
      -foreground + color or -fg color
      -
      It is not necessary for all the elements to be displayed in - the tablelist widget at once; commands described below may be used to - change the view in the window.  Tablelist widgets allow scrolling in - both directions using the standard -xscrollcommand and - -yscrollcommand options.  They also support - scanning, as described below.
      +
      Specifies the foreground color to use when displaying the content + of the header cell.
      -
      Each tablelist widget, as well as each tablelist column, - row, and cell may have any number of attributes, which can be used - in commands that create or manipulate tablelist widgets for particular - purposes.
      +
      -image + image
      + +
      Specifies the name of the Tk image to be displayed in the header + cell.  The details are the same as for a + cell in the tablelist body.
      + +
      + -imagebackground color
      + +
      Specifies the background color of the label widget containing the + embedded image (if any).  The details are the same as for a cell in the tablelist body.
      + +
      -stretchwindow + boolean
      + +
      Specifies whether the width of the window embedded into the header + cell shall be adapted dynamically to the width of the cell's column if + the latter is non-zero (i.e., static).  The details are the same + as for a cell in the tablelist + body.
      + +
      -text + text
      + +
      Specifies the string to be displayed in the given header cell, + i.e., updates the element contained in the cell.  If the + tablelist's state is + disabled then this option will be ignored.
      + +
      -valign + verticalAlignment
      + +
      Specifies the vertical alignment of the embedded image or window + displayed in the header cell (if any).  The default value is + center.  This option overrides the one of the same name for the column containing + the given cell, and may have the same values as its column-related + counterpart.
      + +
      -window + command
      + +
      Specifies a Tcl command creating the window to be embedded into the + header cell.  The details are similar to those for a cell in the tablelist body.
      + +
      -windowdestroy + command
      + +
      Specifies a Tcl command to be invoked when a window embedded into + the header cell is destroyed.  The details are the same as + for a cell in the tablelist + body.
      + +
      -windowupdate + command
      + +
      Specifies a Tcl command responsible for adapting the background and + foreground colors of a window embedded into the header cell to the + current background and foreground colors of the cell itself.  The + current header cell colors depend on whether the tablelist widget's + state is + normal or disabled.  The + other details are the same as for a cell + in the tablelist body.
      +
      +
      + +
      The -background, + -font, and -foreground header cell + configuration options override the options of the same names set at header + row, column, or widget level if the specified value is not an empty + string.  See the COLORS AND FONTS + section for further details on these options.
      COLORS AND FONTS
      @@ -5993,7 +7048,18 @@

      Detailed Reference

      "#cellconfigure">cellconfigure
      (or configcelllist, or configcells) subcommands of the Tcl command - associated with the tablelist widget.  Likewise, the + associated with the tablelist widget.  Similarly, the first three of + these options can also be specified for the widget's header at row and cell + level, with the aid of the  header rowconfigure  (or  + header + configrowlist , or  header configrows)  and  + header + cellconfigure  (or  header configcelllist, or  + header + configcells)  subcommands.  Likewise, the -stripebackground and -stripeforeground options can also be specified at column level.  For this reason, a particular cell can have up to four @@ -6030,22 +7096,22 @@

      Detailed Reference

      "#insertchildlist">insertchildlist
      subcommand rather than insert or insertlist for inserting - new items into the widget.
    • + new items into the widget's body.
      INTERACTIVE CELL EDITING
      -
      Whether or not the contents of a cell of a tablelist widget can be - edited interactively, depends on the -editable option - on both cell and Whether or not the content of a cell of a tablelist widget's body can + be edited interactively, depends on the -editable + option at both cell and column level.  If the cell-level option was set explicitly then its value determines the editability of the cell's - contents.  Otherwise the value of the column-level option is used to + content.  Otherwise the value of the column-level option is used to decide whether the cell can be edited interactively.  From this rule it follows that you can enable interactive cell editing for a whole column by setting its -editable option to true.  To - exclude some of the column's cells from interactive editing, set their + exclude some of the column's cells from interactive editing, just set their -editable option to false.
      The interactive cell editing is started by the @@ -6078,7 +7144,7 @@

      Detailed Reference

      In the simplest case, the text automatically inserted into the temporary embedded widget is the same as the text displayed in the - cell, which in turn can be the cell's contents or the string obtained from + cell, which in turn can be the cell's content or the string obtained from the latter by using the -formatcommand option of the cell's column.  However, if the value of the Detailed Reference command as its last argument (following the tablelist's path name as well as the cell's row and column indices), the resulting script is evaluated in the global scope, and the return value becomes the edit window's - contents.  From within this script you can invoke the - cancelediting subcommand, - which destroys the temporary embedded widget and cancels the editing of its - contents.  The main goal of this script is, however, to enable you to - define validations for the editing process.  This can be done either - with the aid of the options for entry validation, supported by Tk versions - 8.3 and higher (see the entry reference page), or by using the - widget callback package Wcb, available - for Tk versions 8.0 and higher.  The Iwidgets package (available for - Tk versions 8.0 or higher) provides its own validation facilities, which - can equally be used if the edit window is a widget belonging to that + content.  From within this script you can invoke the cancelediting subcommand, which destroys + the temporary embedded widget and cancels the editing of its content.  + The main goal of this script is, however, to enable you to define + validations for the editing process.  This can be done either with the + aid of the options for entry validation, supported by Tk versions 8.3 and + higher (see the entry reference page), or by using the widget + callback package Wcb, available for Tk + versions 8.0 and higher.  The Iwidgets package (available for Tk + versions 8.0 or higher) provides its own validation facilities, which can + equally be used if the edit window is a widget belonging to that extension.  In either case, you will need the path name of the temporary embedded widget or that of its entry or entry-like component; use the editwinpath and @@ -6152,7 +7218,7 @@

      Detailed Reference

      When normal termination of the editing process occurs, the Tcl command associated with the tablelist widget compares the edit window's - final contents to its original one.  If they are equal then the + final content with its original one.  If they are equal then the embedded widget is destroyed and the cell's original value is restored.  If the two strings are different and the value of the -editendcommand @@ -6160,30 +7226,29 @@

      Detailed Reference

      text is passed to that command as its last argument (following the tablelist's path name as well as the cell's row and column indices), the resulting script is evaluated in the global scope, and the return value - becomes the cell's new internal contents after destroying the temporary + becomes the cell's new internal content after destroying the temporary embedded widget.  The main goal of this script is to enable you to do - a final validation of the edit window's contents.  From within this + a final validation of the edit window's content.  From within this script you can invoke the rejectinput subcommand, which prevents the - script's return value from becoming the cell's new contents; this - subcommand also prevents the destruction of the temporary embedded - widget.  Another purpose of the command indicated by the + script's return value from becoming the cell's new content; this subcommand + also prevents the destruction of the temporary embedded widget.  + Another purpose of the command indicated by the -editendcommand option is to convert the edit window's - text to the cell's new internal contents, which is necessary if, due + text to the cell's new internal content, which is necessary if, due to the -formatcommand column configuration option, the cell's internal value is different from its external representation.  See the description of the -forceeditendcommand option for more about the invocation of the command mentioned above.
      -
      DRAG & DROP - SUPPORT
      +
      DRAG & DROP SUPPORT
      As described in detail in the - "DEFAULT AND INDIVIDUAL BINDINGS FOR THE TABLELIST BODY" section, the - default binding scripts perform an automatic drag-friendly handling of the - selection and of pointer movements with mouse button 1 down if the - tablelist widget's DEFAULT AND INDIVIDUAL BINDINGS FOR THE TABLELIST + BODY section, the default binding scripts perform an automatic + drag-friendly handling of the selection and of pointer movements with mouse + button 1 down if the tablelist widget's -customdragsource opton was set to true or its body component was registered as a drag source for mouse button 1 via the  tkdnd::drag_source register  or the @@ -6192,8 +7257,8 @@

      Detailed Reference

      On the other hand, you can also register a tablelist widget as a TkDND drop target, by invoking the  tkdnd::drop_target register  command.  Similarly, you can register the - body component of a tablelist widget as a drop target for the drag & - drop framework included in BWidget, with the aid of the + body component of a tablelist widget as a drop target for the drag & drop + framework included in BWidget, with the aid of the DropSite::register command.  (Notice that for BWidget it is necessary to register the tablelist's body rather than the widget itself.)
      @@ -6264,15 +7329,15 @@

      Detailed Reference

      -
      - BWidget EXAMPLE:  For an introduction to drag & drop with +
      + BWidget EXAMPLE:  For an introduction to drag & drop with BWidget see the online tutorial BWidget example: Drag and Drop Demo by Kevin Walzer.  The DropSite::* commands used in the following example are described in the "DropSite" reference page - included in the BWidget distribution.  When using this drag & - drop framework, you will have to register not only the tablelist's body, - but also its target indicator as drop sites, to make sure that the target + included in the BWidget distribution.  When using this drag & drop + framework, you will have to register not only the tablelist's body, but + also its target indicator as drop sites, to make sure that the target mark won't get hidden by moving the mouse cursor over it with mouse button 1 down: @@ -6288,11 +7353,14 @@

      Detailed Reference

      proc tblDropOverCmd {dropTarget dragSrc event rootX rootY op dataType data} { # $event may be "enter", "motion", or "leave" - set tbl [tablelist::getTablelistPath $dropTarget] + set tbl [tablelist::getTablelistPath $dropTarget] if {[string equal $event "leave"]} { set newWidget [winfo containing -displayof $dropTarget $rootX $rootY] - if {![string equal $newWidget [$tbl targetmarkpath]] && - ![string equal $newWidget [$tbl bodypath]]} { + if {![string equal $newWidget [$tbl targetmarkpath]] && + ![string equal $newWidget [$tbl bodypath]]} { $tbl hidetargetmark return 2 ;# refuse the drop and re-invoke the callback on motion events } @@ -6314,7 +7382,8 @@

      Detailed Reference

      } proc tblDropCmd {dropTarget dragSrc rootX rootY op dataType data} { - set tbl [tablelist::getTablelistPath $dropTarget] + set tbl [tablelist::getTablelistPath $dropTarget] handleTblDrop $tbl $data return 1 ;# accept the drop } @@ -6322,7 +7391,7 @@

      Detailed Reference

      -
      +
      In both examples above, you can restrict the type of the supported drop target indicator by appending the argument -horizontal or -vertical to the @@ -6353,13 +7422,16 @@

      Detailed Reference

      # Insert a sibling of the item indicated by $row, built from $data # (For a flat tablelist replace the following 2 lines with # "set key [$tbl insert $row ...]") - set key [$tbl insertchild [$tbl parentkey $row] \ + set key [$tbl insertchild [$tbl parentkey $row] \ [$tbl childindex $row] ...] } else { # Append a top-level item built from $data # (For a flat tablelist replace the following line with # "set key [$tbl insert end ...]") - set key [$tbl insertchild root end ...] + set key [$tbl insertchild root end ...] } } else { ;# "inside" # Insert a child of the item indicated by $row, built from $data @@ -6374,7 +7446,7 @@

      Detailed Reference

      -
      VIRTUAL EVENTS
      +
      VIRTUAL EVENTS
      Tablelist defines a few virtual events for the purposes of notification, and makes use of the  event @@ -6487,6 +7559,19 @@

      Detailed Reference

      subcommand, invoked to perform the multi-column sorting. + + + <<TablelistHeaderHeightChanged>> + + Generated whenever the (requested) height of the tablelist's + header changes.  Used by the scrollarea + widget of the Scrollutil package. + + The (requested) height of the tablelist's header. + + <<TablelistRowHiddenStateChanged>> @@ -6537,13 +7622,24 @@

      Detailed Reference

      Not used. + + <<TablelistTitleColsWidthChanged>> + + Generated whenever the total width of the non-hidden title + columns changes.  Used by the scrollarea + widget of the Scrollutil package. + + The total width of the non-hidden title columns. + + <<TablelistViewUpdated>> Generated whenever the tablelist widget has finished updating its - view.  Updating the view of a tablelist widget is a complex - operation, which, for performance reasons, is performed at idle - time. + view (which, for performance reasons, is performed at idle + time). Not used. @@ -6554,7 +7650,7 @@

      Detailed Reference

      Many of the widget commands for tablelist widgets take one or more row indices as arguments.  A row index specifies a particular item of the - tablelist, in any of the following ways:
      + tablelist's body component, in any of the following ways:
      @@ -6562,13 +7658,13 @@

      Detailed Reference

      + corresponds to the first item in the tablelist's body. - - + - - + elements in the tablelist's body. @@ -8848,7 +10397,7 @@

      Detailed Reference

      matching elements.  If an element of the specified column matches the given pattern and command is a nonempty string, then the latter is automatically concatenated with the - name of the tablelist widget, the element's row index, the + path name of the tablelist widget, the element's row index, the numerical equivalent of columnIndex, as well as the element itself or its formatted version (depending on the presence @@ -8961,7 +10510,7 @@

      Detailed Reference

      with the -descend option) of a row whose children have not been inserted yet, the command specified as the value of the -populatecommand - option (if any) is automatically concatenated with the name of the + option (if any) is automatically concatenated with the path name of the tablelist widget and the row index, and the resulting script is evaluated in the global scope.  This enables you to insert the children on demand, just before searching them for the specified @@ -8970,7 +10519,7 @@

      Detailed Reference

      pathName see index
      -
      Adjusts the view in the tablelist so that the item given by +
      Adjusts the view in the tablelist body so that the item given by index is visible.  If the item is already visible then the command has no effect; if the item is near one edge of the window then the tablelist scrolls to bring the item into view at @@ -8979,7 +10528,7 @@

      Detailed Reference

      pathName seecell cellIndex
      -
      Adjusts the view in the tablelist so that the cell given by +
      Adjusts the view in the tablelist body so that the cell given by cellIndex is visible.  If the cell is already visible then the command has no effect; if the cell is near one edge of the window then the tablelist scrolls to bring the cell into view at @@ -9008,13 +10557,13 @@

      Detailed Reference

      pathName selection option args
      -
      This command is used to adjust the selection within a tablelist - widget.  It has several forms, depending on +
      This command is used to adjust the selection within the body of a + tablelist widget.  It has several forms, depending on option:
      -
      pathName selection anchor +
      pathName selection anchor index
      Sets the selection anchor to the item given by @@ -9026,34 +10575,34 @@

      Detailed Reference

      row.  The index anchor may be used to refer to the anchor item.
      -
      pathName selection clear - first last
      - pathName selection clear +
      pathName selection clear + firstIndex lastIndex
      + pathName selection clear indexList
      -
      If any of the items between first and - last (inclusive) or corresponding to the +
      If any of the items between firstIndex and + lastIndex (inclusive) or corresponding to the indices specified by the list indexList contain at least one selected cell, they are deselected.  The selection state is not changed for items outside the range given in the first form of the command or different from those specified by the index list given in its second form.
      -
      pathName selection - includes index
      +
      pathName selection includes + index
      Returns 1 if the item indicated by index contains at least one selected cell, 0 if it doesn't.
      -
      pathName selection set - first last
      - pathName selection set +
      pathName selection set + firstIndex lastIndex
      + pathName selection set indexList
      Selects all of the selectable items in the range between - first and last, inclusive, - or corresponding to the indices specified by the list + firstIndex and lastIndex, + inclusive, or corresponding to the indices specified by the list indexList, without affecting the selection state of any other items.
      @@ -9092,6 +10641,22 @@

      Detailed Reference

      "#showseparators">-showseparators
      configuration option.
      +
      pathName + setbusycursor
      + +
      Saves the current value of the -cursor + configuration option and then sets this option to the name of a + windowing system-specific busy cursor (watch or + wait).  Since this subcommand is designed to + be invoked just before starting an operation that can take a long time + to complete, it also makes sure that the new cursor will immediately + get visible, by calling  update + idletasks.  In the rare but possible case that, as a + side effect of this invocation, the tablelist widget gets destroyed by + some application-specific action scheduled for execution at idle time, + the command returns the boolean value 0, otherwise the + value 1.
      +
      pathName showtargetmark before|inside index
      @@ -9107,21 +10672,21 @@

      Detailed Reference

      end is interpreted as indicating the widget's last item. -
      This command is designed to be used during a drag & - drop operation for which the tablelist widget (or its body component) - was registered as a drop target.  See the DRAG & DROP SUPPORT section for - details and examples.
      +
      This command is designed to be used during a drag & drop + operation for which the tablelist widget (or its body component) was + registered as a drop target.  See the DRAG & DROP SUPPORT section for details + and examples.
      pathName size
      -
      Returns the total number of items in the tablelist widget.
      +
      Returns the total number of items in the tablelist body.
      pathName sort ?-increasing|-decreasing?
      -
      Sorts the items in increasing or decreasing order, as specified by - the optional argument.  The default is +
      Sorts the body items in increasing or decreasing order, as + specified by the optional argument.  The default is -increasing.  Uses the value of the -sortcommand widget configuration option as comparison command.  @@ -9134,14 +10699,14 @@

      Detailed Reference

      cell being edited is brought into view; (b) else, if exactly one item is selected then the view is shifted to bring that item into view; (c) else, if the tablelist's body is the most recent window to have the - input focus among all the windows in the same top-level as the widget + input focus among all the windows in the same toplevel as the widget itself then the currently active item is brought into view.
      pathName sortbycolumn columnIndex ?-increasing|-decreasing?
      -
      Sorts the items based on the elements of the column given by +
      Sorts the body items based on the elements of the column given by columnIndex, in increasing or decreasing order, as specified by the optional argument.  The default is -increasing.  The sorting process is @@ -9161,8 +10726,8 @@

      Detailed Reference

      side, with the exception of Windows Vista, 7, 8, and 10, where the arrow will be shown horizontally centered in the header label and attached to its top edge.  After sorting the items, the vertical - view is adjusted in the same way as in the case of the sort subcommand.
      + view is adjusted in the same way as in the case of the + sort subcommand.
      The actions described above are only performed if the specified column's Detailed Reference sortbycolumnlist columnIndexList ?sortOrderList? -
      Sorts the items based on the elements of the columns given by the - columnIndexList argument, which must be a list of - distinct column indices.  Only those elements of this list are +
      Sorts the body items based on the elements of the columns given by + the columnIndexList argument, which must be a list + of distinct column indices.  Only those elements of this list are considered significant that identify columns whose -showlinenumbers option hasn't been set to true.
      @@ -9311,16 +10876,17 @@

      Detailed Reference

      restrict the value of the first list element to before and inside, respectively.  If the option -vertical was - specified and no tablelist item contains the given y-position, then the - return value is the list  {inside -1}.  - The coordinate y is expected to be relative to the - tablelist window itself (not its body component). + specified and no item of the tablelist's body contains the given + y-position, then the return value is the list  + {inside -1}.  The coordinate + y is expected to be relative to the tablelist + window itself (not its body component). -
      This command is designed to be used during a drag & - drop operation for which the tablelist widget (or its body component) - was registered as a drop target.  See the DRAG & DROP SUPPORT section for - details and examples.
      +
      This command is designed to be used during a drag & drop + operation for which the tablelist widget (or its body component) was + registered as a drop target.  See the DRAG & DROP SUPPORT section for details + and examples.
      pathName togglecolumnhide firstColumn lastColumn
      @@ -9337,30 +10903,30 @@

      Detailed Reference

      columns whose visibility is to be toggled.  Returns an empty string.  After toggling the hidden state of the specified columns, the <<TablelistColHiddenStateChanged>> - virtual event is generated.  For Tk versions 8.5 or higher, this + virtual event is generated.  For Tk versions 8.5 and higher, this virtual event is generated with its -data option set to a list consisting of the numerical column indices of the columns whose -hide option was toggled.  The main advantage of using this command instead of invoking columnconfigure for each of the specified columns is that it causes only one redisplay of the widget's - contents, thus being significantly faster. + content, thus being significantly faster.
      pathName - togglerowhide first last
      + togglerowhide firstIndex lastIndex

      pathName togglerowhide indexList
      Toggles the value of the -hide option for one or more rows of the - tablelist widget.  In the first form of the command, - first and last are indices - specifying the first and last rows in the range whose visibility is to - be toggled.  The command's second form accepts a list - indexList of indices specifying the rows whose + tablelist widget's body.  In the first form of the command, + firstIndex and lastIndex are + indices specifying the first and last rows in the range whose + visibility is to be toggled.  The command's second form accepts a + list indexList of indices specifying the rows whose visibility is to be toggled.  Returns an empty string.  After toggling the hidden state of the specified rows, the <<TablelistRowHiddenStateChanged>> - virtual event is generated.  For Tk versions 8.5 or higher, this + virtual event is generated.  For Tk versions 8.5 and higher, this virtual event is generated with its -data option set to a list consisting of the numerical row indices of the rows whose -hide option was toggled.  Just like the @@ -9408,14 +10974,16 @@

      Detailed Reference

      index.  Returns an empty string.
      pathName - viewablerowcount ?first last?
      + viewablerowcount ?firstIndex + lastIndex?
      Returns the number of viewable rows in - the index range given by first and - last.  If these optional indices are not - specified then first defaults to 0 and - last defaults to one less the total number of - items, i.e., the index range comprises all rows.
      + the index range given by firstIndex and + lastIndex.  If these optional indices are not + specified then firstIndex defaults to + 0 and lastIndex defaults to one less + the total number of body items, i.e., the index range comprises all + rows of the tablelist's body.
      pathName windowpath cellIndex
      @@ -9462,7 +11030,7 @@

      Detailed Reference

      window.  Character positions are defined by the width of the character 0. -
      pathName xview moveto +
      pathName xview moveto fraction
      Adjusts the view in the window so that @@ -9471,7 +11039,7 @@

      Detailed Reference

      fraction must be a fraction between 0 and 1.
      -
      pathName xview scroll +
      pathName xview scroll number what
      This command shifts the view in the window left or right @@ -9522,7 +11090,7 @@

      Detailed Reference

      equals units viewable rows is displayed at the top of the window.
      -
      pathName yview moveto +
      pathName yview moveto fraction
      Adjusts the view in the window so that the Detailed Reference the viewable item one-third the way through the tablelist, and so on.
      -
      pathName yview scroll +
      pathName yview scroll number what
      This command shifts the view in the window up or down according @@ -9554,6 +11122,407 @@

      Detailed Reference

      +
      HEADER-RELATED SUBCOMMANDS
      + +
      + The header tablelist command, + used to invoke various operations on the header items, has the following + general form: + +
      +
      +pathName header option ?arg arg ...?
      +
      +
      +
      + +
      option and the args determine + the exact behavior of the command.  The following subcommands are + supported for the tablelist header:
      + +
      +
      +
      pathName header bbox + headerIndex
      + +
      Similar to the bbox command + for the tablelist body.
      + +
      pathName header + cellattrib headerCellIndex ?name? ?value + name value ...?
      + +
      Similar to the cellattrib command for the tablelist + body.
      + +
      pathName header + cellbbox headerCellIndex
      + +
      Similar to the cellbbox + command for the tablelist body.
      + +
      pathName header + cellcget headerCellIndex option
      + +
      Similar to the cellcget + command for the tablelist body.  option may + have any of the values accepted by the  header cellconfigure  + subcommand.
      + +
      pathName header + cellconfigure headerCellIndex ?option? value + option value ...?
      + +
      Similar to the cellconfigure command for the tablelist + body.  Each option may have any of the values + described in the CELL CONFIGURATION OPTIONS + IN THE TABLELIST HEADER section.
      + +
      pathName header + cellindex headerCellIndex
      + +
      Similar to the cellindex command for the tablelist + body.
      + +
      pathName header + configcelllist headerCellConfigSpecList
      + +
      + Similar to the configcelllist command for the + tablelist body.  The argument + headerCellConfigSpecList must be a list of the + form + +
      +
      +headerCellIndex option value headerCellIndex option value ...
      +
      +
      +
      + +
      where each option may have any of the values + described in the CELL CONFIGURATION OPTIONS + IN THE TABLELIST HEADER section.
      + +
      pathName header + configcells ?headerCellIndex option value + headerCellIndex option value ...?
      + +
      Similar to the configcells command for the tablelist + body.  Each option may have any of the values + described in the CELL CONFIGURATION OPTIONS + IN THE TABLELIST HEADER section.
      + +
      pathName header + configrowlist headerRowConfigSpecList
      + +
      + Similar to the configrowlist command for the + tablelist body.  The argument + headerRowConfigSpecList must be a list of the + form + +
      +
      +headerIndex option value headerIndex option value ...
      +
      +
      +
      + +
      where each option may have any of the values + described in the ROW CONFIGURATION OPTIONS + IN THE TABLELIST HEADER section.
      + +
      pathName header + configrows ?headerIndex option value + headerIndex option value ...?
      + +
      Similar to the configrows command for the tablelist + body.  Each option may have any of the values + described in the ROW CONFIGURATION OPTIONS + IN THE TABLELIST HEADER section.
      + +
      pathName header + containing y
      + +
      Similar to the containing command for the tablelist + body.
      + +
      pathName header + containingcell x y
      + +
      Similar to the containingcell command for the + tablelist body.
      + +
      pathName header + delete firstHeaderIndex lastHeaderIndex
      + pathName header delete + headerIndexList
      + +
      Similar to the delete + command for the tablelist body.
      + +
      pathName + header embedcheckbutton headerCellIndex + ?command?
      + +
      Similar to the embedcheckbutton command for the + tablelist body.
      + +
      pathName + header embedcheckbuttons columnIndex + ?command?
      + +
      Similar to the embedcheckbuttons command for the + tablelist body.  Logically equivalent to invoking  + header + embedcheckbutton  for all header cells of the + column specified by columnIndex.
      + +
      pathName + header embedttkcheckbutton headerCellIndex + ?command?
      + +
      Similar to the embedttkcheckbutton command for + the tablelist body.
      + +
      pathName + header embedttkcheckbuttons columnIndex + ?command?
      + +
      Similar to the embedttkcheckbutton command for + the tablelist body.  Logically equivalent to invoking  + header + embedttkcheckbutton  for all header cells of the + column specified by columnIndex.
      + +
      pathName header + fillcolumn columnIndex text
      + +
      Similar to the fillcolumn command for the tablelist + body.
      + +
      pathName header + findrowname name
      + +
      Similar to the findrowname command for the tablelist + body.  Returns the header row index of the first header item whose + name equals name.
      + +
      pathName header get + firstHeaderIndex lastHeaderIndex
      + pathName header get + headerIndexList
      + +
      Similar to the get command + for the tablelist body.
      + +
      pathName header + getcells firstHeaderCell lastHeaderCell
      + pathName header getcells + headerCellIndexList
      + +
      Similar to the getcells + command for the tablelist body.
      + +
      pathName header + getcolumns firstColumn lastColumn
      + pathName header getcolumns + columnIndexList
      + +
      Similar to the getcolumns command for the tablelist + body.
      + +
      pathName header + getformatted firstHeaderIndex + lastHeaderIndex
      + pathName header getformatted + headerIndexList
      + +
      Similar to the getformatted command for the tablelist + body.
      + +
      pathName + header getformattedcells firstHeaderCell + lastHeaderCell
      + pathName header getformattedcells + headerCellIndexList
      + +
      Similar to the getformattedcells command for the + tablelist body.
      + +
      pathName + header getformattedcolumns firstColumn + lastColumn
      + pathName header getformattedcolumns + columnIndexList
      + +
      Similar to the getformattedcolumns command for + the tablelist body.
      + +
      pathName header + getfullkeys firstHeaderIndex + lastHeaderIndex
      + pathName header getfullkeys + headerIndexList
      + +
      Similar to the getfullkeys command for the tablelist + body.  Remember that the full keys of the header items start with + hk.
      + +
      pathName header + getkeys firstHeaderIndex lastHeaderIndex
      + pathName header getkeys + headerIndexList
      + +
      Similar to the getkeys + command for the tablelist body.
      + +
      pathName header + hascellattrib headerCellIndex name
      + +
      Similar to the hascellattrib command for the tablelist + body.
      + +
      pathName header + hasrowattrib headerIndex name
      + +
      Similar to the hasrowattrib command for the tablelist + body.
      + +
      pathName header + imagelabelpath headerCellIndex
      + +
      Similar to the imagelabelpath command for the + tablelist body.
      + +
      pathName header index + headerIndex
      + +
      Similar to the index + command for the tablelist body.
      + +
      pathName header + insert headerIndex ?item item ...?
      + +
      Similar to the insert + command for the tablelist body.
      + +
      pathName header + insertlist headerIndex itemList
      + +
      Similar to the insertlist command for the tablelist + body.
      + +
      pathName header + iselemsnipped headerCellIndex + fullTextName
      + +
      Similar to the iselemsnipped command for the tablelist + body.
      + +
      pathName header + itemlistvar
      + +
      Similar to the itemlistvar command for the tablelist + body.
      + +
      pathName header + nearest y
      + +
      Similar to the nearest + command for the tablelist body.
      + +
      pathName header + nearestcell x y
      + +
      Similar to the nearestcell command for the tablelist + body.
      + +
      pathName header + rowattrib headerIndex ?name? ?value + name value ...?
      + +
      Similar to the rowattrib command for the tablelist + body.
      + +
      pathName header + rowcget index option
      + +
      Similar to the rowcget + command for the tablelist body.  option may + have any of the values accepted by the  header rowconfigure  + subcommand.
      + +
      pathName header + rowconfigure headerIndex ?option? ?value + option value ...?
      + +
      Similar to the rowconfigure command for the tablelist + body.  Each option may have any of the values + described in the ROW CONFIGURATION OPTIONS + IN THE TABLELIST HEADER section.
      + +
      pathName header + size
      + +
      Similar to the size command + for the tablelist body.
      + +
      pathName header + unsetcellattrib headerCellIndex name
      + +
      Similar to the unsetcellattrib command for the + tablelist body.
      + +
      pathName header + unsetrowattrib headerIndex name
      + +
      Similar to the unsetrowattrib command for the + tablelist body.
      + +
      pathName header + windowpath headerCellIndex
      + +
      Similar to the windowpath command for the tablelist + body.
      +
      +
      +
      DEFAULT AND INDIVIDUAL BINDINGS FOR THE TABLELIST BODY
      @@ -9623,11 +11592,13 @@

      Detailed Reference

      -bind [.tbl bodytag] <Button-1> {printClickedCell %W %x %y}
      +bind [.tbl bodytag] <Button-1> {printClickedCell %W %x %y}
      proc printClickedCell {w x y} { foreach {tbl x y} [tablelist::convEventFields $w $x $y] {} - puts "clicked on cell [$tbl containingcell $x $y]" + puts "clicked on cell [$tbl containingcell $x $y]"
      @@ -9662,7 +11633,7 @@

      Detailed Reference

      toggled with the aid of Control-Button-1, Control-space, and Control-Select (see below). - +
      BINDINGS FOR THE SELECTION TYPE @@ -9766,8 +11737,7 @@

      Detailed Reference

      mode is single or browse and the selection state of the element changes from unselected to selected then any other selected elements will be deselected, just as if button - 1 had been pressed without the Control key - down. + 1 had been pressed without the Control key down.
    • Again, if tablelist::strictTk is false, then Control-space and Control-Select @@ -9787,7 +11757,7 @@

      Detailed Reference

    • Control-a behaves the same as Control-slash, i.e., it selects everything in the - widget, except in single and + widget's body, except in single and browse modes, in which case it selects the active item or element (depending on the selection type) and deselects everything else. @@ -9814,8 +11784,8 @@

      Detailed Reference

      Tk fails to recognize the Control-backslash key sequence (for which one has to press Control, AltGr, and a third key: _ on a French and ß - on a German keyboard).  Moreover, on many keyboards it is quite - difficult (if not even impossible) to generate the + on a German keyboard).  Moreover, on many keyboards it is quite + difficult (if not even impossible) to generate the Control-backslash key sequence, fact which makes the support for this alternative shortcut even more useful on both X11 and Windows.

      @@ -9837,8 +11807,8 @@

      Detailed Reference

      generated independently of the selection type.
    • - LOCAL DRAG & DROP:  The following binding associated with - the binding tag TablelistBody is only valid if the + LOCAL DRAG & DROP:  The following binding associated with the + binding tag TablelistBody is only valid if the selection mode is single or multiple: @@ -9853,7 +11823,7 @@

      Detailed Reference

      aid of a gap placed before the target row or a bar placed inside the latter (depending on the current mouse position), indicating whether the source item would be moved before this row or become a child of - it.  This local drag & drop operation ends when mouse + it.  This local drag & drop operation ends when mouse button 1 is released, and can be canceled by pressing the Escape key.  In both cases, the mouse cursor is reset to its original value, specified by the -cursor @@ -9861,7 +11831,7 @@

      Detailed Reference

      presence of a valid target, the source item is moved before the target row or just before the latter's first child, and the virtual event <<TablelistRowMoved>> is - generated.  For Tk versions 8.5 or higher, this virtual event is + generated.  For Tk versions 8.5 and higher, this virtual event is generated with its -data option set to a list of length 3, whose elements are derived from the arguments passed to the second form of the move @@ -9873,55 +11843,55 @@

      Detailed Reference

      move subcommand.

      Notice that, depending on the current mouse position during the - local drag & drop, there can be a corresponding potential target - row or not.  For instance, a tree item cannot become a sibling of - one of its descendants, and not all items might be allowed to have - children or to become top-level ones (example: in a file manager, - regular file items cannot be parents of other items and should not be - allowed to become top-level ones).  To decide whether the row - corresponding to the y-coordinate of the current mouse position - represents a valid potential target, the Tablelist code first checks - whether moving the source item before that row or making it a child of - the latter is allowed from the point of view of the general tree - structure.  If this is the case and the move operation would - change the source item's parent (and the Tk version is at least 8.3), - and the command specified as the value of the -acceptchildcommand configuration option is a nonempty string, then this command is concatenated with the - name of the tablelist widget, the node index of the would-be new parent - node, and the row index of the dragged item, the resulting script is - evaluated in the global scope, and if the return value (which must be a - boolean) is false, then the source item will not be allowed to be moved - to the current mouse position.  Likewise, if the command specified - as the value of the -acceptdropcommand configuration option is a nonempty string, then this command is concatenated with the - name of the tablelist widget, the row index of the would-be new target - row, and the row index of the dragged item, the resulting script is - evaluated in the global scope, and if the return value (which must be a - boolean) is false, then the source item will not be allowed to be moved - to the current mouse position.

      + path name of the tablelist widget, the row index of the would-be new + target row, and the row index of the dragged item, the resulting script + is evaluated in the global scope, and if the return value (which must + be a boolean) is false, then the source item will not be allowed to be + moved to the current mouse position.

      Recall that if the selection mode is multiple then pressing mouse button 1 on a selected item or element normally deselects that item or element (depending on the selection type).  However, if in addition the value of the -movablerows configuration option is true - then the clicked row is a potential drag source for the local drag - & drop operation described above, and for this reason the clicked - item or element will only be deselected when releasing mouse - button 1 over the same item or element.

      + then the clicked row is a potential drag source for the local drag & + drop operation described above, and for this reason the clicked item or + element will only be deselected when releasing mouse button 1 + over the same item or element.

      DRAG SOURCE SUPPORT FOR GLOBAL - DRAG & DROP:  Besides the local drag & drop, the default - bindings also support the TkDND compiled extension and the drag & drop - framework included in BWidget, as well as custom drag & drop - implementations.  A tablelist widget is viewed as a drag source for - mouse button 1 if its body component was registered as such via - the  tkdnd::drag_source register  or the - BWidget DragSite::register command, or the tablelist's + DRAG & DROP:  Besides the local drag & drop, the default bindings + also support the TkDND compiled extension and the drag & drop framework + included in BWidget, as well as custom drag & drop implementations.  A + tablelist widget is viewed as a drag source for mouse button 1 if + its body component was registered as such via the  + tkdnd::drag_source register  or the BWidget + DragSite::register command, or the tablelist's -customdragsource option was set to true.  The default bindings provide drag source support as described below:
      @@ -9979,11 +11949,47 @@

      Detailed Reference

      +
      DEFAULT AND INDIVIDUAL BINDINGS FOR + THE HEADER ITEMS
      + +
      The hedaer items are contained in a text widget whose binding tag + Text is replaced with a new binding tag called + TablelistHeader.  This tag replaces also the + binding tag Message of the message widgets used to + display multi-line header elements, as well as the binding tag + Label of the label widgets used to display embedded + images in the header cells.  This makes sure that the default handling + of the mouse events on the multi-line cells and embedded images in the + tablelist's header is the same as in the rest of the header text + widget.
      + +
      + Header items are designed for display purposes only, they are not + intended to be interactive.  For this reason, the only default + bindings associated with the binding tag + TablelistHeader are the ones used internally by + Tablelist for tooltip support.  You can, however, define individual + bindings for the header component, like in the following example (which + requires Tk 8.5 or later): + +
      +
      +bind [.tbl headertag] <Button-1> {printClickedCell %W %x %y}
      +proc printClickedCell {w x y} { + foreach {tbl x y} [tablelist::convEventFields $w $x $y] {} + puts "clicked on header cell [$tbl header containingcell $x $y]" +
      +
      +
      +
      DEFAULT AND INDIVIDUAL BINDINGS FOR THE HEADER LABELS
      -
      The tablelist::tablelist command automatically - creates the following bindings for the header labels:
      +
      Tablelist automatically creates the following bindings for the header + labels of a tablelist widget:
        @@ -10006,7 +12012,7 @@

        Detailed Reference

        finished, the virtual event <<TablelistColumnResized>> is generated, with its -data option set to the - numerical column index for Tk versions 8.5 or higher. + numerical column index for Tk versions 8.5 and higher.
      1. If mouse button 1 is pressed over a header label but outside the resize area described above and then dragged outside the @@ -10024,7 +12030,7 @@

        Detailed Reference

        mouse button 1, the source column is moved before the one indicated by the gap mentioned above and the virtual event <<TablelistColumnMoved>> is - generated.  For Tk versions 8.5 or higher, this virtual event is + generated.  For Tk versions 8.5 and higher, this virtual event is generated with its -data option set to a list of length 4, whose first two elements are identical to the two numerical column indices passed to the Detailed Reference outside the resize area described above and later released over the same label, and the command specified by the -labelcommand option is a nonempty - string, then this command is concatenated with the name of the + string, then this command is concatenated with the path name of the tablelist widget and the column index of the respective label, and the resulting script is evaluated in the global scope.  If another nonempty label command was specified at column level by using the @@ -10068,7 +12074,7 @@

        Detailed Reference

        and the virtual event <<TablelistColumnResized>> is generated, with its -data option set to the - numerical column index for Tk versions 8.5 or higher.  The same + numerical column index for Tk versions 8.5 and higher.  The same action is triggered by double-clicking the resize area of a header label.
      2. @@ -10085,12 +12091,62 @@

        Detailed Reference

        set to its last static width (if any) and the virtual event <<TablelistColumnResized>> is generated, with its -data option set to the - numerical column index for Tk versions 8.5 or higher.  The same + numerical column index for Tk versions 8.5 and higher.  The same action is triggered by double-clicking the resize area of a header label with the Shift key held down.
      +
      BINDINGS FOR COLUMN-WISE CELL + SELECTION:  If the selection type is cell then + a few further bindings apply to the header labels.  In the description + below the Alt key can be replaced with Meta; on + Mac OS Classic and Mac OS X Aqua the Command key is used + instead of Alt and Meta.  Notice also that + you can restrict the set of cells that will be selected when these bindings + perform a column-wise cell selection:  If the command specified by the + -selectfiltercommand + option is a nonempty string then this command is concatenated with the path + name of the tablelist widget and the numerical index of the respective + column, and the resulting script is evaluated in the global scope.  If + another nonempty command was specified as the value of the option of the + same name at column level then that column-specific command will be used + instead of the global one.  In both cases, only those cells contained + in that column will be selected whose row numbers are contained in the list + returned by the script.
      + +
      +
        +
      1. Pressing mouse button 1 on a header label with the + Alt key down selects the cells of the corresponding + column, deselects everything else, and sets the anchor to the first + viewable selected cell of that column; dragging the mouse with button 1 + down extends the selection to include all the columns between the + anchor and the column under the mouse, inclusive.
      2. + +
      3. If the anchor column contains at least one selected cell + then the range of selected columns can be adjusted by pressing button 1 + on a header label with the Alt and Shift keys + down: this modifies the selection to consist of the cells of the + columns between the anchor and the one under the mouse, + inclusive.  The un-anchored end of this new column-wise cell + selection can also be dragged with the button down.
      4. + +
      5. Pressing button 1 on a header label with the + Alt and Control keys down starts a toggle + operation: the cells of the column corresponding to the clicked label + will be deselected if at least one of them was selected before, and + selected otherwise; in the first case the anchor is set to the first + viewable cell of that column, while in the second case to the column's + first viewable selected cell.  The selection state of other cells + is not changed.  If subsequently the mouse is dragged with button + 1 down, then the selection state of the cells between the anchor column + and the one under the mouse is set to match the toggled state of the + anchor column; the selection state of all other cells remains what it + was before the toggle operation began.
      6. +
      +
      +
      If the tablelist's state is disabled then none of the above actions occur: the labels are completely insensitive.
      @@ -10121,10 +12177,10 @@

      Detailed Reference

      DEFAULT BINDINGS FOR INTERACTIVE CELL EDITING
      -
      The tablelist::tablelist command extends and - partially redefines the bindings of some of the components of the temporary - embedded widget used for interactive cell editing, which is started by - pressing mouse button 1 in an editable cell (see the Tablelist extends and partially redefines the bindings of some of the + components of the temporary embedded widget used for interactive cell + editing, which is started by pressing mouse button 1 in an editable cell + (see the -editselectedonly option for details) or using keyboard navigation to move from one editable cell into another.  If the selection type is cell and the @@ -10179,10 +12235,10 @@

      Detailed Reference

      When editing a cell that is not the only editable cell of the tablelist widget, Tab and Shift-Tab terminate the editing in the current cell, move the edit window into - the next/previous editable cell of the tablelist, select the contents + the next/previous editable cell of the tablelist, select the content of the edit window's first entry or entry-like component (if any), and set the insertion cursor to its end.  If the new edit window - is a text or ctext widget then its contents are left unselected. + is a text or ctext widget then its content is left unselected.

      Notice that these bindings replace the common inter-widget navigation via Tab and Shift-Tab with @@ -10203,10 +12259,10 @@

      Detailed Reference

      (Command-Left/Command-Right on Mac OS Classic and Mac OS X Aqua) terminates the editing in the current cell, moves the edit window into the previous/next editable cell of the row, - selects the contents of the edit window's first entry or entry-like + selects the content of the edit window's first entry or entry-like component (if any), and sets the insertion cursor to its end.  If - the new edit window is a text or ctext widget then its contents are - left unselected.  The key sequence + the new edit window is a text or ctext widget then its content is left + unselected.  The key sequence Meta-Left/Meta-Right has the same effect as Alt-Left/Alt-Right.  If tk_strictMotif is false and the edit window is not @@ -10220,13 +12276,12 @@

      Detailed Reference

      cell within its column, Alt-Up/Alt-Down (Command-Up/Command-Down on Mac OS Classic and Mac OS X Aqua) terminates the editing in the current cell, moves - the edit window one line up/down within the column, selects the - contents of the edit window's first entry or entry-like component (if - any), and sets the insertion cursor to its end.  If the new edit - window is a text or ctext widget then its contents are left - unselected.  The key sequence - Meta-Up/Meta-Down has the same effect as - Alt-Up/Alt-Down.  If + the edit window one line up/down within the column, selects the content + of the edit window's first entry or entry-like component (if any), and + sets the insertion cursor to its end.  If the new edit window is a + text or ctext widget then its content is left unselected.  The key + sequence Meta-Up/Meta-Down has the same + effect as Alt-Up/Alt-Down.  If tk_strictMotif is false and the edit window is not a text or ctext widget or an Iwidgets combobox, then Control-p and Control-n behave the same as @@ -10242,9 +12297,9 @@

      Detailed Reference

      (Command-Prior/Command-Next on Mac OS Classic and Mac OS X Aqua) terminates the editing in the current cell, moves the edit window up/down by one page within the column, selects the - contents of the edit window's first entry or entry-like component (if + content of the edit window's first entry or entry-like component (if any), and sets the insertion cursor to its end.  If the new edit - window is a text or ctext widget then its contents are left + window is a text or ctext widget then its content is left unselected.  The key sequence Meta-Prior/Meta-Next has the same effect as Alt-Prior/Alt-Next.  If the edit window @@ -10259,10 +12314,10 @@

      Detailed Reference

      (Command-Home/Command-End on Mac OS Classic and Mac OS X Aqua) terminates the editing in the current cell, moves the edit window into the first/last editable cell of the tablelist, - selects the contents of the edit window's first entry or entry-like + selects the content of the edit window's first entry or entry-like component (if any), and sets the insertion cursor to its end.  If - the new edit window is a text or ctext widget then its contents are - left unselected.  The key sequence + the new edit window is a text or ctext widget then its content is left + unselected.  The key sequence Meta-Home/Meta-End has the same effect as Alt-Home/Alt-End.  If tk_strictMotif is false and the edit window is not diff --git a/modules/tablelist/doc/tileWidgets.png b/modules/tablelist/doc/tileWidgets.png index 87cb2340..1007e295 100644 Binary files a/modules/tablelist/doc/tileWidgets.png and b/modules/tablelist/doc/tileWidgets.png differ diff --git a/modules/tablelist/pkgIndex.tcl b/modules/tablelist/pkgIndex.tcl index 5da061d2..aad87383 100644 --- a/modules/tablelist/pkgIndex.tcl +++ b/modules/tablelist/pkgIndex.tcl @@ -1,28 +1,28 @@ #============================================================================== # Tablelist and Tablelist_tile package index file. # -# Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # # Regular packages: # -package ifneeded tablelist 5.17 \ +package ifneeded tablelist 6.6 \ [list source [file join $dir tablelist.tcl]] -package ifneeded tablelist_tile 5.17 \ +package ifneeded tablelist_tile 6.6 \ [list source [file join $dir tablelist_tile.tcl]] # # Aliases: # -package ifneeded Tablelist 5.17 \ - [list package require -exact tablelist 5.17] -package ifneeded Tablelist_tile 5.17 \ - [list package require -exact tablelist_tile 5.17] +package ifneeded Tablelist 6.6 \ + [list package require -exact tablelist 6.6] +package ifneeded Tablelist_tile 6.6 \ + [list package require -exact tablelist_tile 6.6] # # Code common to all packages: # -package ifneeded tablelist::common 5.17 \ +package ifneeded tablelist::common 6.6 \ "namespace eval ::tablelist { proc DIR {} {return [list $dir]} } ;\ source [list [file join $dir tablelistPublic.tcl]]" diff --git a/modules/tablelist/scripts/mwutil.tcl b/modules/tablelist/scripts/mwutil.tcl index 109efb84..db24904d 100644 --- a/modules/tablelist/scripts/mwutil.tcl +++ b/modules/tablelist/scripts/mwutil.tcl @@ -5,11 +5,10 @@ # - Namespace initialization # - Public utility procedures # -# Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== -package require Tcl 8 -package require Tk 8 +package require Tk 8 # # Namespace initialization @@ -20,8 +19,13 @@ namespace eval mwutil { # # Public variables: # - variable version 2.8 - variable library [file dirname [info script]] + variable version 2.13 + variable library + if {$::tcl_version >= 8.4} { + set library [file dirname [file normalize [info script]]] + } else { + set library [file dirname [info script]] ;# no "file normalize" yet + } # # Public procedures: @@ -30,7 +34,8 @@ namespace eval mwutil { defineKeyNav processTraversal focusNext focusPrev \ configureWidget fullConfigOpt fullOpt enumOpts \ configureSubCmd attribSubCmd hasattribSubCmd \ - unsetattribSubCmd getScrollInfo + unsetattribSubCmd getScrollInfo hasFocus \ + genMouseWheelEvent windowingSystem currentTheme # # Make modified versions of the procedures tk_focusNext and @@ -45,10 +50,10 @@ namespace eval mwutil { # # Build the procedures focusNext and focusPrev # - foreach direction {Next Prev} { - set procBody [info body tk_focus$direction] + foreach dir {Next Prev} { + set procBody [info body tk_focus$dir] regsub -all {winfo children} $procBody {getChildren $class} procBody - proc focus$direction {w class} $procBody + proc focus$dir {w class} $procBody } } makeFocusProcs @@ -141,7 +146,7 @@ proc mwutil::defineKeyNav class { # # Processes the given traversal event for the mega-widget of the specified # class containing the widget w if that mega-widget is not the only widget -# receiving the focus during keyboard traversal within its top-level widget. +# receiving the focus during keyboard traversal within its toplevel widget. #------------------------------------------------------------------------------ proc mwutil::processTraversal {w class event} { set win [getAncestorByClass $w $class] @@ -153,9 +158,9 @@ proc mwutil::processTraversal {w class event} { } if {[string compare $target $win] != 0} { - set focus [focus] - if {[string length $focus] != 0} { - event generate $focus <> + set focusWin [focus -displayof $win] + if {[string length $focusWin] != 0} { + event generate $focusWin <> } focus $target @@ -180,7 +185,7 @@ proc mwutil::configureWidget {win configSpecsName configCmd cgetCmd \ # Process the command-line arguments # set cmdLineOpts {} - set savedVals {} + set savedOptValPairs {} set failed 0 set count [llength $optValPairs] foreach {opt val} $optValPairs { @@ -195,7 +200,7 @@ proc mwutil::configureWidget {win configSpecsName configCmd cgetCmd \ } set opt $result lappend cmdLineOpts $opt - lappend savedVals [eval $cgetCmd [list $win $opt]] + lappend savedOptValPairs $opt [eval $cgetCmd [list $win $opt]] if {[catch {eval $configCmd [list $win $opt $val]} result] != 0} { set failed 1 break @@ -207,7 +212,7 @@ proc mwutil::configureWidget {win configSpecsName configCmd cgetCmd \ # # Restore the saved values # - foreach opt $cmdLineOpts val $savedVals { + foreach {opt val} $savedOptValPairs { eval $configCmd [list $win $opt $val] } @@ -491,7 +496,8 @@ proc mwutil::getScrollInfo argList { wrongNumArgs "moveto fraction" } - set fraction [format "%f" [lindex $argList 1]] + set fraction [lindex $argList 1] + format "%f" $fraction ;# floating-point number check with error message return [list moveto $fraction] } elseif {[string first $opt "scroll"] == 0} { if {$argCount != 3} { @@ -511,3 +517,67 @@ proc mwutil::getScrollInfo argList { return -code error "unknown option \"$opt\": must be moveto or scroll" } } + +#------------------------------------------------------------------------------ +# mwutil::hasFocus +# +# Returns a boolean value indicating whether the focus window is (a descendant +# of) the widget w. +#------------------------------------------------------------------------------ +proc mwutil::hasFocus w { + return [expr {[string first $w. [focus -displayof $w].] == 0}] +} + +#------------------------------------------------------------------------------ +# mwutil::genMouseWheelEvent +# +# Generates a mouse wheel event with the given root coordinates and delta on +# the widget w. +#------------------------------------------------------------------------------ +proc mwutil::genMouseWheelEvent {w event rootX rootY delta} { + set needsFocus [expr {[package vcompare $::tk_patchLevel "8.6b2"] < 0 && + [string compare $::tcl_platform(platform) "windows"] == 0}] + + if {$needsFocus} { + set focusWin [focus -displayof $w] + focus $w + } + + event generate $w $event -rootx $rootX -rooty $rootY -delta $delta + + if {$needsFocus} { + focus $focusWin + } +} + +#------------------------------------------------------------------------------ +# mwutil::windowingSystem +# +# Returns the current windowing system ("x11", "win32", "classic", or "aqua"). +#------------------------------------------------------------------------------ +proc mwutil::windowingSystem {} { + if {[catch {tk windowingsystem} winSys] != 0} { + switch $::tcl_platform(platform) { + unix { set winSys x11 } + windows { set winSys win32 } + macintosh { set winSys classic } + } + } + + return $winSys +} + +#------------------------------------------------------------------------------ +# mwutil::currentTheme +# +# Returns the current tile theme. +#------------------------------------------------------------------------------ +proc mwutil::currentTheme {} { + if {[info exists ::ttk::currentTheme]} { + return $::ttk::currentTheme + } elseif {[info exists ::tile::currentTheme]} { + return $::tile::currentTheme + } else { + return "" + } +} diff --git a/modules/tablelist/scripts/repair.tcl b/modules/tablelist/scripts/repair.tcl index c6ef4557..20624ebc 100755 --- a/modules/tablelist/scripts/repair.tcl +++ b/modules/tablelist/scripts/repair.tcl @@ -10,7 +10,7 @@ # 8.4a2), which causes excessive memory use when calling "info exists" on # non-existent array elements. # -# Copyright (c) 2001-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2001-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== set procDef { diff --git a/modules/tablelist/scripts/tablelistBind.tcl b/modules/tablelist/scripts/tablelistBind.tcl index 136edc36..dc066d6b 100644 --- a/modules/tablelist/scripts/tablelistBind.tcl +++ b/modules/tablelist/scripts/tablelistBind.tcl @@ -6,9 +6,10 @@ # - Binding tag Tablelist # - Binding tag TablelistWindow # - Binding tag TablelistBody +# - Binding tag TablelistHeader # - Binding tags TablelistLabel, TablelistSubLabel, and TablelistArrow # -# Copyright (c) 2000-2017 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) +# Copyright (c) 2000-2019 Csaba Nemethi (E-mail: csaba.nemethi@t-online.de) #============================================================================== # @@ -53,6 +54,158 @@ proc tablelist::convEventFields {w x y} { return [mwutil::convEventFields $w $x $y Tablelist] } +#------------------------------------------------------------------------------ +# tablelist::delaySashPosUpdates +# +# Overrides the Tk or Ttk library procedure ::tk::panedwindow::DragSash or +# ::ttk::panedwindow::Drag with a version in which the "sash place ..." or +# "sashpos ..." invocations for the (ttk::)panedwindow widget w are delayed by +# ms milliseconds. +#------------------------------------------------------------------------------ +proc tablelist::delaySashPosUpdates {w ms} { + # + # Check the first argument + # + if {![winfo exists $w]} { + return -code error "bad window path name \"$w\"" + } + set class [winfo class $w] + switch $class { + Panedwindow { + if {[llength [info commands ::tk::panedwindow::DragSash]] == 0} { + return -code error "window \"$w\" is not a panedwindow widget" + } + } + + TPanedwindow { + if {[llength [info commands ::ttk::panedwindow::Drag]] != 0} { + set namesp ::ttk::panedwindow + } else { + return -code error \ + "window \"$w\" is not a ttk::panedwindow widget" + } + } + + TPaned { + if {[llength [info commands ::ttk::paned::Drag]] != 0} { + set namesp ::ttk::paned + } elseif {[llength [info commands ::tile::paned::Drag]] != 0} { + set namesp ::tile::paned + } else { + return -code error "window \"$w\" is not a ttk::paned widget" + } + } + + default { + return -code error \ + "window \"$w\" is not a (ttk::)panewindow widget" + } + } + + # + # Check the second argument + # + if {[catch {format "%d" $ms} result] != 0} { ;# integer check with error msg + return -code error $result + } + set ms $result + if {$ms < 0} { + # + # Forget the sash position update delay for the given widget + # + if {[info exists ::tablelist::sashPosUpdateDelays($w)]} { + unset ::tablelist::sashPosUpdateDelays($w) + } + return "" + } + + # + # Remember the sash position update delay for the given widget + # + set ::tablelist::sashPosUpdateDelays($w) $ms + + bind $w {+ + # + # Forget the sash position update delay for the given widget + # + if {[info exists ::tablelist::sashPosUpdateDelays(%W)]} { + unset ::tablelist::sashPosUpdateDelays(%W) + } + } + + # + # Override the Tk or Ttk library procedure + # ::tk::panedwindow::DragSash or ${namesp}::Drag + # + if {[string compare [winfo class $w] "Panedwindow"] == 0} { + proc ::tk::panedwindow::DragSash {w x y proxy} { + variable ::tk::Priv + if {![info exists Priv(sash)]} { return } + + if {[$w cget -opaqueresize]} { + set proxy 0 + } + + if {$proxy} { + $w proxy place [expr {$x + $Priv(dx)}] [expr {$y + $Priv(dy)}] + } elseif {[info exists ::tablelist::sashPosUpdateDelays($w)]} { + set Priv(newSashX) [expr {$x + $Priv(dx)}] + set Priv(newSashY) [expr {$y + $Priv(dy)}] + + if {![info exists Priv(sashPosId)]} { + set Priv(sashPosId) \ + [after $::tablelist::sashPosUpdateDelays($w) \ + [list ::tk::panedwindow::UpdateSashPos $w $Priv(sash)]] + } + } else { + $w sash place $Priv(sash) \ + [expr {$x + $Priv(dx)}] [expr {$y + $Priv(dy)}] + } + } + + proc ::tk::panedwindow::UpdateSashPos {w index} { + variable ::tk::Priv + unset Priv(sashPosId) + + if {[winfo exists $w]} { + $w sash place $index $Priv(newSashX) $Priv(newSashY) + } + } + + } else { + proc ${namesp}::Drag {w x y} [format { + variable State + if {!$State(pressed)} { return } + + switch -- [$w cget -orient] { + horizontal { set delta [expr {$x - $State(pressX)}] } + vertical { set delta [expr {$y - $State(pressY)}] } + } + + if {[info exists ::tablelist::sashPosUpdateDelays($w)]} { + set State(newSashPos) [expr {$State(sashPos) + $delta}] + + if {![info exists State(sashPosId)]} { + set State(sashPosId) \ + [after $::tablelist::sashPosUpdateDelays($w) \ + [list %s::UpdateSashPos $w $State(sash)]] + } + } else { + $w sashpos $State(sash) [expr {$State(sashPos) + $delta}] + } + } $namesp] + + proc ${namesp}::UpdateSashPos {w index} { + variable State + unset State(sashPosId) + + if {[winfo exists $w]} { + $w sashpos $index $State(newSashPos) + } + } + } +} + # # Binding tag Tablelist # ===================== @@ -100,16 +253,18 @@ proc tablelist::removeActiveTag win { #------------------------------------------------------------------------------ proc tablelist::cleanup win { # - # Cancel the execution of all delayed handleMotion, updateKeyToRowMap, - # adjustSeps, makeStripes, showLineNumbers, stretchColumns, updateColors, - # updateScrlColOffset, updateHScrlbar, updateVScrlbar, updateView, - # synchronize, displayItems, moveTo, autoScan, horizAutoScan, forceRedraw, - # doCellConfig, redisplay, redisplayCol, and destroyWidgets commands + # Cancel the execution of all delayed (hdr_)handleMotion, updateKeyToRowMap, + # adjustSeps, makeStripes, showLineNumbers, stretchColumns, + # (hdr_)updateColors, updateScrlColOffset, updateHScrlbar, updateVScrlbar, + # updateView, synchronize, displayItems, horizMoveTo, vertMoveTo, + # vertScroll, dragTo, autoScan, horizAutoScan, forceRedraw, + # reconfigWindows, redisplay, and redisplayCol commands # upvar ::tablelist::ns${win}::data data - foreach id {motionId mapId sepsId stripesId lineNumsId stretchId colorsId - offsetId hScrlbarId vScrlbarId viewId syncId dispId moveToId - afterId redrawId reconfigId} { + foreach id {motionId hdr_motionId mapId sepsId stripesId lineNumsId + stretchId colorsId hdr_colorsId offsetId hScrlbarId vScrlbarId + viewId syncId dispId horizMoveToId vertMoveToId scrollId + dragToId afterId redrawId reconfigId} { if {[info exists data($id)]} { after cancel $data($id) } @@ -117,31 +272,26 @@ proc tablelist::cleanup win { foreach name [array names data *redispId] { after cancel $data($name) } - foreach destroyId $data(destroyIdList) { - after cancel $destroyId - } # # If there is a list variable associated with the # widget then remove the trace set on this variable # - upvar #0 $data(-listvariable) var - if {$data(hasListVar) && [info exists var]} { + if {$data(hasListVar) && + [uplevel #0 [list info exists $data(-listvariable)]]} { + upvar #0 $data(-listvariable) var trace vdelete var wu $data(listVarTraceCmd) } # - # Destroy any existing bindings for data(bodyTag), - # data(labelTag), and data(editwinTag) + # Destroy any existing bindings for the tags data(bodyTag), + # data(headerTag), data(labelTag), and data(editwinTag) # - foreach event [bind $data(bodyTag)] { - bind $data(bodyTag) $event "" - } - foreach event [bind $data(labelTag)] { - bind $data(labelTag) $event "" - } - foreach event [bind $data(editwinTag)] { - bind $data(editwinTag) $event "" + foreach tag [list $data(bodyTag) $data(headerTag) \ + $data(labelTag) $data(editwinTag)] { + foreach event [bind $tag] { + bind $tag $event "" + } } # @@ -153,7 +303,7 @@ proc tablelist::cleanup win { } set imgNames [image names] for {set col 0} {$col < $data(colCount)} {incr col} { - set w $data(hdrTxtFrCanv)$col + set w $data(hdrTxtFrmCanv)$col foreach shape {triangleUp darkLineUp lightLineUp triangleDn darkLineDn lightLineDn} { if {[lsearch -exact $imgNames $shape$w] >= 0} { @@ -162,7 +312,7 @@ proc tablelist::cleanup win { } } - destroy $data(corner) + destroy $data(cornerFrm-ne) $data(cornerFrm-sw) namespace delete ::tablelist::ns$win catch {rename ::$win ""} @@ -192,11 +342,11 @@ proc tablelist::updateConfigSpecs win { # # This might be an "after idle" callback; check whether the window exists # - if {![array exists ::tablelist::ns${win}::data]} { + if {[destroyed $win]} { return "" } - set currentTheme [getCurrentTheme] + set currentTheme [mwutil::currentTheme] upvar ::tablelist::ns${win}::data data if {[string compare $currentTheme $data(currentTheme)] == 0} { if {[string compare $currentTheme "tileqt"] == 0} { @@ -216,36 +366,50 @@ proc tablelist::updateConfigSpecs win { } } - # - # Populate the array tmp with values corresponding to the old theme - # and the array themeDefaults with values corresponding to the new one - # - array set tmp $data(themeDefaults) - setThemeDefaults + variable usingTile + if {$usingTile} { + # + # Populate the array tmp with values corresponding to the old theme + # and the array themeDefaults with values corresponding to the new one + # + array set tmp $data(themeDefaults) + setThemeDefaults - # - # Set those configuration options whose values equal the old - # theme-specific defaults to the new theme-specific ones - # - variable themeDefaults - foreach opt {-background -foreground -disabledforeground -stripebackground - -selectbackground -selectforeground -selectborderwidth -font - -labelforeground -labelfont -labelborderwidth -labelpady - -treestyle} { - if {[string compare $data($opt) $tmp($opt)] == 0} { - doConfig $win $opt $themeDefaults($opt) + # + # Set those configuration options whose values equal the old + # theme-specific defaults to the new theme-specific ones + # + variable themeDefaults + foreach opt {-background -foreground -disabledforeground + -stripebackground -selectbackground -selectforeground + -selectborderwidth -font -labelforeground -labelfont + -labelborderwidth -labelpady -treestyle} { + if {[string compare $data($opt) $tmp($opt)] == 0} { + doConfig $win $opt $themeDefaults($opt) + } } - } - if {[string compare $data(-arrowcolor) $tmp(-arrowcolor)] == 0 && - [string compare $data(-arrowstyle) $tmp(-arrowstyle)] == 0} { - foreach opt {-arrowcolor -arrowdisabledcolor -arrowstyle} { - doConfig $win $opt $themeDefaults($opt) + if {[string compare $data(-arrowcolor) $tmp(-arrowcolor)] == 0 && + [string compare $data(-arrowstyle) $tmp(-arrowstyle)] == 0} { + foreach opt {-arrowcolor -arrowdisabledcolor -arrowstyle} { + doConfig $win $opt $themeDefaults($opt) + } + } + foreach opt {-background -foreground} { + doConfig $win $opt $data($opt) ;# sets the bg color of the seps } + updateCanvases $win } - foreach opt {-background -foreground} { - doConfig $win $opt $data($opt) ;# sets the bg color of the separators + + # + # Destroy and recreate the label images + # + for {set col 0} {$col < $data(colCount)} {incr col} { + if {[info exists data($col-labelimage)]} { + set val $data($col-labelimage) + doColConfig $col $win -labelimage "" + doColConfig $col $win -labelimage $val + } } - updateCanvases $win # # Destroy and recreate the edit window if present @@ -253,13 +417,23 @@ proc tablelist::updateConfigSpecs win { if {[set editCol $data(editCol)] >= 0} { set editRow $data(editRow) saveEditData $win - destroy $data(bodyFr) + destroy $data(bodyFrm) doEditCell $win $editRow $editCol 1 } # # Destroy and recreate the embedded windows # + for {set row 0} {$row < $data(hdr_itemCount)} {incr row} { + for {set col 0} {$col < $data(colCount)} {incr col} { + set key [lindex $data(hdr_keyList) $row] + if {[info exists data($key,$col-window)]} { + set val $data($key,$col-window) + doCellConfig h$row $col $win -window "" + doCellConfig h$row $col $win -window $val + } + } + } if {$data(winCount) != 0} { for {set row 0} {$row < $data(itemCount)} {incr row} { for {set col 0} {$col < $data(colCount)} {incr col} { @@ -274,7 +448,6 @@ proc tablelist::updateConfigSpecs win { } set data(currentTheme) $currentTheme - set data(themeDefaults) [array get themeDefaults] if {[string compare $currentTheme "tileqt"] == 0} { set data(widgetStyle) [tileqt_currentThemeName] if {[info exists ::env(KDE_SESSION_VERSION)] && @@ -287,6 +460,9 @@ proc tablelist::updateConfigSpecs win { set data(widgetStyle) "" set data(colorScheme) "" } + if {$usingTile} { + set data(themeDefaults) [array get themeDefaults] + } } # @@ -297,17 +473,24 @@ proc tablelist::updateConfigSpecs win { #------------------------------------------------------------------------------ # tablelist::cleanupWindow # -# This procedure is invoked when a window aux embedded into a tablelist widget -# is destroyed. It invokes the cleanup script associated with the cell -# containing the window, if any. +# This procedure is invoked when a window embedded into a tablelist widget is +# destroyed. It invokes the cleanup script associated with the cell containing +# the window, if any. #------------------------------------------------------------------------------ proc tablelist::cleanupWindow aux { - regexp {^(.+)\.body\.frm_(k[0-9]+),([0-9]+)$} $aux dummy win key col - upvar ::tablelist::ns${win}::data data + regexp {^(.+)\.(hdr\.t|body)\.frm_(h?k[0-9]+),([0-9]+)$} $aux \ + dummy win textWidget key col + upvar ::tablelist::ns${win}::data data \ + ::tablelist::ns${win}::checkStates checkStates + if {[info exists data($key,$col-windowdestroy)]} { set row [keyToRow $win $key] uplevel #0 $data($key,$col-windowdestroy) [list $win $row $col $aux.w] } + + if {[info exists checkStates($key,$col)]} { + unset checkStates($key,$col) + } } # @@ -347,6 +530,9 @@ proc tablelist::defineTablelistBody {} { if {[winfo exists %W]} { foreach {tablelist::W tablelist::x tablelist::y} \ [tablelist::convEventFields %W %x %y] {} + if {$tablelist::y < [winfo y [$tablelist::W bodypath]]} { + continue + } set tablelist::priv(x) $tablelist::x set tablelist::priv(y) $tablelist::y @@ -367,10 +553,6 @@ proc tablelist::defineTablelistBody {} { } else { tablelist::condEditContainingCell $tablelist::W \ $tablelist::x $tablelist::y - set tablelist::priv(row) \ - [$tablelist::W nearest $tablelist::y] - set tablelist::priv(col) \ - [$tablelist::W nearestcolumn $tablelist::x] tablelist::condBeginMove $tablelist::W $tablelist::priv(row) tablelist::beginSelect $tablelist::W \ $tablelist::priv(row) $tablelist::priv(col) 1 @@ -381,6 +563,9 @@ proc tablelist::defineTablelistBody {} { if {[winfo exists %W]} { foreach {tablelist::W tablelist::x tablelist::y} \ [tablelist::convEventFields %W %x %y] {} + if {$tablelist::y < [winfo y [$tablelist::W bodypath]]} { + continue + } if {[$tablelist::W cget -editselectedonly]} { tablelist::condEditContainingCell $tablelist::W \ @@ -417,6 +602,10 @@ proc tablelist::defineTablelistBody {} { if {[winfo exists %W]} { foreach {tablelist::W tablelist::x tablelist::y} \ [tablelist::convEventFields %W %x %y] {} + if {$tablelist::y < [winfo y [$tablelist::W bodypath]] && + [string length $tablelist::priv(afterId)] == 0} { ;# no autoscan + continue + } set tablelist::priv(x) "" set tablelist::priv(y) "" @@ -446,6 +635,9 @@ proc tablelist::defineTablelistBody {} { bind TablelistBody { foreach {tablelist::W tablelist::x tablelist::y} \ [tablelist::convEventFields %W %x %y] {} + if {$tablelist::y < [winfo y [$tablelist::W bodypath]]} { + continue + } tablelist::beginExtend $tablelist::W \ [$tablelist::W nearest $tablelist::y] \ @@ -454,6 +646,9 @@ proc tablelist::defineTablelistBody {} { bind TablelistBody { foreach {tablelist::W tablelist::x tablelist::y} \ [tablelist::convEventFields %W %x %y] {} + if {$tablelist::y < [winfo y [$tablelist::W bodypath]]} { + continue + } tablelist::beginToggle $tablelist::W \ [$tablelist::W nearest $tablelist::y] \ @@ -562,7 +757,6 @@ proc tablelist::defineTablelistBody {} { foreach event {
      number Specifies the item as a numerical index, where 0 - corresponds to the first item in the tablelist.
      knumberSpecifies the item by its full key, composed of the letter + Specifies the item by its full key, composed of the prefix k and the sequence number associated with the item.  You can use the getkeys widget command to get this sequence @@ -6631,22 +7727,23 @@

      Detailed Reference

      topIndicates the topmost item visible in the tablelist window.Indicates the topmost body item visible in the tablelist + window.
      bottomIndicates the bottommost item visible in the tablelist + Indicates the bottommost body item visible in the tablelist window.
      @x,yIndicates the item that covers the point in the tablelist window - specified by x and y (in - pixel coordinates).  If no item covers that point, then the + Indicates the body item that covers the point in the tablelist + window specified by x and y + (in pixel coordinates).  If no item covers that point, then the closest item to that point is used.  The coordinates x and y are expected to be relative to the tablelist window itself (not its body @@ -6667,8 +7764,8 @@

      Detailed Reference

      In the widget command descriptions below, arguments named - index, first, - last, sourceIndex, and + index, firstIndex, + lastIndex, sourceIndex, and targetIndex always contain row indices in one of the above forms.
      @@ -6787,7 +7884,7 @@

      Detailed Reference

      Many of the widget commands for tablelist widgets take one or more cell indices as arguments.  A cell index specifies a particular cell of the - tablelist, in any of the following ways:
      + tablelist's body component, in any of the following ways:
      @@ -6844,10 +7941,10 @@

      Detailed Reference

      - @@ -6856,9 +7953,150 @@

      Detailed Reference

      In the widget command descriptions below, arguments named - cellIndex, firstCell, and - lastCell always contain cell indices in one of the - above forms.
      + cellIndex, firstCell, and + lastCell always contain cell indices in one of the + above forms. + +
      HEADER ROW INDICES
      + +
      Many of the subcommands of the header tablelist widget command take one or more + header row indices as arguments.  A header row index specifies a + particular item of the tablelist's header component, in any of the + following ways:
      + +
      +
      @x,yIndicates the cell that covers the point in the tablelist window - specified by x and y (in - pixel coordinates).  If no cell covers that point, then the - closest cell to that point is used.  The coordinates + Indicates the body cell that covers the point in the tablelist + window specified by x and y + (in pixel coordinates).  If no body cell covers that point, then + the closest body cell to that point is used.  The coordinates x and y are expected to be relative to the tablelist window itself (not its body component).
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      numberSpecifies the header item as a numerical index, where + 0 corresponds to the first item in the tablelist's + header.
      hknumberSpecifies the header item by its full key, composed of the prefix + hk and the sequence number associated with the + item.  You can use the  header getkeys  widget command to + get this sequence number, or the  header getfullkeys  widget + command to retrieve the full key.  In addition, the  + header insert  + and  header + insertlist  subcommands return the list of full + keys associated with the header items just inserted.
      endIndicates the end of the tablelist's header.  For most + commands this refers to the last item in the header component, but + for a few commands such as  header + indexheader + insert,  and  header insertlist  it refers to + the header item just after the last one.
      lastIndicates the last header item of the tablelist.
      @x,yIndicates the header item that covers the point in the tablelist + window specified by x and y + (in pixel coordinates).  If no header item covers that point, + then the closest header item to that point is used.  The + coordinates x and y are + expected to be relative to the tablelist window itself (not its + header component).
      nameSpecifies the header row by the value of its -name configuration option.  + name must be different from all the above header + row indices, and should be unique (if several header rows have the + same name then this value is considered to indicate the first + matching header row).
      +
      + +
      In the widget command descriptions below, arguments named + headerIndex, firstHeaderIndex, and + lastHeaderIndex always contain header row indices in + one of the above forms.
      + +
      HEADER CELL INDICES
      + +
      Many of the subcommands of the header tablelist widget command take one or more + header cell indices as arguments.  A header cell index specifies a + particular cell of the tablelist's header component, in any of the + following ways:
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + +
      headerRow,colIndicates the cell having the header row index + headerRow and column index + colheaderRow may be a + number, a full key (of the form hknumber), + end (where the latter indicates the last header + row in the tablelist), last, or a header row + name.  col may be a number, + active, anchor, + end, last, + left, right, or a column + name.
      endIndicates the last cell in the last row of the tablelist's + header.
      lastIndicates the last cell in the last row of the tablelist's header + (same as end).
      @x,yIndicates the header cell that covers the point in the tablelist + window specified by x and y + (in pixel coordinates).  If no header cell covers that point, + then the closest header cell to that point is used.  The + coordinates x and y are + expected to be relative to the tablelist window itself (not its body + component).
      +
      + +
      In the widget command descriptions below, arguments named + headerCellIndex, firstHeaderCell, + and lastHeaderCell always contain header cell indices + in one of the above forms.
      WIDGET COMMAND
      @@ -6996,6 +8234,93 @@

      Detailed Reference

      handling scripts that are valid not only for the tablelist's body but also for the separators, multi-line cells, and embedded images. +
      For example, to register the body of a tablelist widget + $tbl as a drag source for mouse button 1 in such a way + that the drag works also for the separators, multi-line cells, and + embedded images, you can proceed like in the following code samples: + +
      + TkDND EXAMPLE: + +
      +
      +package require tkdnd 2.7
      +
      +bind [$tbl bodytag] <Button-1> { registerDragSrc %W }
      +
      +proc registerDragSrc w {
      +    # $w can be the tablelist's body, a separator, a message widget
      +    # displaying a multi-line element, or a label widget displaying an
      +    # image.  Register this widget as a drag source for mouse button 1
      +    tkdnd::drag_source register $w DND_Text 1
      +    bind $w <<DragInitCmd>> { onTblDragInit %W }
      +    bind $w <<DragEndCmd>>  { onTblDragEnd %W %A }
      +}
      +
      +proc onTblDragInit w {
      +    set tbl [tablelist::getTablelistPath $w]
      +    . . .
      +}
      +
      +proc onTblDragEnd {w action} {
      +    if {![string equal $action "refuse_drop"]} {        ;# drop accepted
      +        set tbl [tablelist::getTablelistPath $w]
      +        . . .
      +    }
      +}
      +
      +# Make sure to register the tablelist's body explicitly as a drag source:
      +registerDragSrc [$tbl bodypath]
      +
      +
      +
      + +
      + BWidget EXAMPLE: + +
      +
      +package require BWidget
      +
      +bind [$tbl bodytag] <Button-1> { registerDragSrc %W }
      +
      +proc registerDragSrc w {
      +    # $w can be the tablelist's body, a separator, a message widget
      +    # displaying a multi-line element, or a label widget displaying an
      +    # image.  Register this widget as a drag source for mouse button 1
      +    DragSite::register $w -dragevent 1 \
      +        -draginitcmd tblDragInitCmd -dragendcmd tblDragEndCmd
      +}
      +
      +proc tblDragInitCmd {dragSrc rootX rootY top} {
      +    set tbl [tablelist::getTablelistPath $dragSrc]
      +    . . .
      +}
      +
      +proc tblDragEndCmd {dragSrc dropTarget op dataType data result} {
      +    if {$result != 0} {                                 ;# drop accepted
      +        set tbl [tablelist::getTablelistPath $dragSrc]
      +        . . .
      +    }
      +}
      +
      +# Make sure to register the tablelist's body explicitly as a drag source:
      +registerDragSrc [$tbl bodypath]
      +
      +
      +
      + +
      In both examples above we also invoke the procedure + registerDragSrc explicitly for the tablelist's body, + because the widget registered as a drag source by its invocation on a + <Button-1> event can be different from the body + component, and the default bindings need the information whether + the tablelist's body was registered as a drag source.
      +
      pathName canceledediting
      @@ -7017,11 +8342,11 @@

      Detailed Reference

      pathName cancelediting
      -
      This subcommand cancels the interactive editing of the contents of +
      This subcommand cancels the interactive editing of the content of the cell whose index was passed to the editcell subcommand, destroys the temporary widget embedded into the cell, and restores the original cell - contents.  This command enables you to cancel the interactive cell + content.  This command enables you to cancel the interactive cell editing from within the Tcl command specified by the -editstartcommand configuration option if that pre-edit callback encounters an error when preparing the @@ -7031,7 +8356,7 @@

      Detailed Reference

      Immediately before returning this value, the command generates the virtual event <<TablelistCellRestored>>.  For Tk - versions 8.5 or higher, this virtual event is generated with its + versions 8.5 and higher, this virtual event is generated with its -data option set to a list consisting of the numerical row and column indices of the cell whose content is being edited.  If no cell was being edited when the command was invoked @@ -7100,8 +8425,8 @@

      Detailed Reference

      specified, then the command modifies the given cell option(s) to have the given value(s); in this case the return value is an empty string.  option may have any of the values - described in the CELL CONFIGURATION OPTIONS - section.
      + described in the CELL CONFIGURATION OPTIONS IN + THE TABLELIST BODY section.
      pathName cellindex cellIndex
      @@ -7114,14 +8439,14 @@

      Detailed Reference

      pathName cellselection option args
      -
      This command is used to adjust the cell selection within a - tablelist widget.  It has several forms, depending on +
      This command is used to adjust the cell selection within the body + of a tablelist widget.  It has several forms, depending on option:
      -
      pathName cellselection - anchor cellIndex
      +
      pathName cellselection anchor + cellIndex
      Sets the cell selection anchor to the element given by cellIndex.  If @@ -7134,9 +8459,9 @@

      Detailed Reference

      anchor may be used to refer to the anchor element.
      -
      pathName cellselection - clear firstCell lastCell
      - pathName cellselection clear +
      pathName cellselection clear + firstCell lastCell
      + pathName cellselection clear cellIndexList
      If any of the elements between firstCell @@ -7148,16 +8473,16 @@

      Detailed Reference

      different from those specified by the cell index list given in its second form.
      -
      pathName cellselection - includes cellIndex
      +
      pathName cellselection includes + cellIndex
      Returns 1 if the element indicated by cellIndex is currently selected, 0 if it isn't.
      -
      pathName cellselection - set firstCell lastCell
      - pathName cellselection set +
      pathName cellselection set + firstCell lastCell
      + pathName cellselection set cellIndexList
      Selects all of the selectable elements in the range @@ -7209,28 +8534,28 @@

      Detailed Reference

      widget.
      pathName collapse - index ?-fully|-partly?
      + indexList ?-fully|-partly?
      -
      This subcommand collapses the specified row of a tablelist used as - a tree widget, i.e., elides all its descendants.  The optional +
      This subcommand collapses the specified rows of a tablelist used as + a tree widget, i.e., elides all their descendants.  The optional argument -fully (which is the default) indicates that the command will be performed recursively, i.e., all of the - descendants of the node specified by index will be - collapsed, so that a subsequent invocation of the non-recursive version - of the expand(all) subcommand - will only display the row's children but no further descendants of - it.  The -partly option (which is used by the - default bindings) restricts the operation to just one hierarchy level, - implying that by a subsequent invocation of the non-recursive version - of the expand(all) subcommand exactly the same - descendants will be displayed again that were visible prior to - collapsing the row.
      + descendants of the nodes specified by indexList + will be collapsed, so that a subsequent invocation of the non-recursive + version of the expand(all) + subcommand will only display their children but no further descendants + of them.  The -partly option (which is used by + the default bindings) restricts the operation to just one hierarchy + level, implying that by a subsequent invocation of the non-recursive + version of the expand(all) subcommand exactly the + same descendants will be displayed again that were visible prior to + collapsing the rows.
      Before hiding the descendants of a row, the command specified as the value of the -collapsecommand option (if any) is - automatically concatenated with the name of the tablelist widget and - the row index, and the resulting script is evaluated in the global + automatically concatenated with the path name of the tablelist widget + and the row index, and the resulting script is evaluated in the global scope.
      For technical reasons (the use of the @@ -7238,6 +8563,11 @@

      Detailed Reference

      row), this subcommand is not supported for Tk versions earlier than 8.3.
      +
      REMARK:  If you want to collapse several + rows, it is much more efficient to do it by invoking this subcommand + for the list of their indices than by invoking it in a loop, for the + individual rows.
      +
      pathName collapseall ?-fully|-partly?
      @@ -7248,7 +8578,7 @@

      Detailed Reference

      descendants of the top-level nodes will be collapsed, so that a subsequent invocation of the non-recursive version of the expandall subcommand will - only display ther children but no further descendants of them.  + only display their children but no further descendants of them.  The -partly option restricts the operation to just one hierarchy level, implying that by a subsequent invocation of the non-recursive version of the expandall subcommand @@ -7258,8 +8588,8 @@

      Detailed Reference

      Before hiding the descendants of a row, the command specified as the value of the -collapsecommand option (if any) is - automatically concatenated with the name of the tablelist widget and - the row index, and the resulting script is evaluated in the global + automatically concatenated with the path name of the tablelist widget + and the row index, and the resulting script is evaluated in the global scope.
      For technical reasons (the use of the @@ -7373,8 +8703,9 @@

      Detailed Reference

      where each option may have any of the values - described in the CELL CONFIGURATION OPTIONS - section.  The return value is an empty string.
      + described in the CELL CONFIGURATION OPTIONS IN + THE TABLELIST BODY section.  The return value is an empty + string.
      This command has the same effect as @@ -7397,8 +8728,8 @@

      Detailed Reference

      and value, the command modifies the given option of the given cell to have the given value.  Each option may have any of the values described in the - CELL CONFIGURATION OPTIONS section.  - The return value is an empty string.
      + CELL CONFIGURATION OPTIONS IN THE TABLELIST + BODY section.  The return value is an empty string.
      pathName configcolumnlist columnConfigSpecList
      @@ -7462,8 +8793,9 @@

      Detailed Reference

      where each option may have any of the values - described in the ROW CONFIGURATION OPTIONS - section.  The return value is an empty string.
      + described in the ROW CONFIGURATION OPTIONS IN + THE TABLELIST BODY section.  The return value is an empty + string.
      This command has the same effect as @@ -7486,8 +8818,8 @@

      Detailed Reference

      value, the command modifies the given option of the given row to have the given value.  Each option may have any of the values described in the - ROW CONFIGURATION OPTIONS section.  The - return value is an empty string.
      + ROW CONFIGURATION OPTIONS IN THE TABLELIST + BODY section.  The return value is an empty string.
      pathName configure ?option? ?value option value @@ -7513,7 +8845,7 @@

      Detailed Reference

      y
      Given a y-coordinate within the tablelist window, this command - returns the index of the tablelist item containing that + returns the index of the tablelist body item containing that y-coordinate.  If no corresponding item is found then the return value is -1.  The coordinate y is expected to be relative to the tablelist window itself (not its body @@ -7523,9 +8855,9 @@

      Detailed Reference

      containingcell x y
      Given an x- and a y-coordinate within the tablelist window, this - command returns the index of the tablelist cell containing the point - having these coordinates.  If no corresponding cell is found then - the row or column component (or both) of the return value is + command returns the index of the tablelist body cell containing the + point having these coordinates.  If no corresponding cell is found + then the row or column component (or both) of the return value is -1.  The coordinates x and y are expected to be relative to the tablelist window itself (not its body component).
      @@ -7543,83 +8875,180 @@

      Detailed Reference

      pathName cornerlabelpath
      -
      Returns the path name of the label widget contained in the corner - frame (see the cornerpath - subcommand.  When using Tablelist_tile, the return value will be a - ttk::label widget of the same style as the header labels.  The - global visual options set for the header labels are automatically - applied to this (ttk::)label widget, too.
      +
      Returns the path name of the label widget contained in the + north-east corner frame (see the cornerpath subcommand.  When using + Tablelist_tile, the return value will be a ttk::label widget of the + same style as the header labels.  The global visual options set + for the header labels are automatically applied to this (ttk::)label + widget, too.
      pathName - cornerpath
      - -
      Returns the path name of a frame widget that is a sibling of the - tablelist and is automatically created and destroyed together with the - latter's header.  This frame is called the corner frame, - because it is designed to be shown to the right of the tablelist - widget's top-right corner when managing the vertical scrollbar on Mac - OS X Aqua (see below).  The corner frame contains a label or - ttk::label widget, depending on whether the package Tablelist or - Tablelist_tile is being used (see the cornerlabelpath subcommand).  - Whenever the height of the tablelist's header changes, the height of - the corner frame as well as that of the above-mentioned (ttk::)label - widget is updated accordingly.
      + cornerpath ?-ne|-sw? + +
      Returns the path name of one out of two frame widgets that are + siblings of the tablelist and are automatically created and destroyed + together with the latter.  One of the two frames corresponds to + the tablelist's north-east corner and the other one to its south-west + corner.  The corner is specified by means of the optional + argument: -ne (which is the default) stands for + north-east and -sw stands for south-west.
      + +
      If the corner specification has the value + -ne then the command returns the path name of the + north-east corner frame, which is designed to be shown to the + right of the tablelist widget's top-right corner when managing the + vertical scrollbar on Mac OS X Aqua or X11 (see Remark 1 below).  + This corner frame contains a label or ttk::label widget, depending on + whether the package Tablelist or Tablelist_tile is being used (see the + cornerlabelpath + subcommand).  The height of this corner frame is automatically + kept in sync with that of the tablelist's header component, and the + height of the above-mentioned (ttk::)label widget is automatically kept + in sync with that of the header labels.  Whenever the (requested) + height of the tablelist's header (and thus that of the north-east + corner frame) changes, the + <<TablelistHeaderHeightChanged>> + virtual event is generated, with its -data option + set to the (requested) height of the header for Tk versions 8.5 and + higher.
      + +
      If the corner was specified as -sw + then the return value is the path name of the south-west corner + frame, which is designed to be shown just below the tablelist's + lower-left corner when managing the horizontal scrollbar if the value + of the -titlecolumns + option is positive (see Remark 2 below).  The width of this corner + frame is automatically kept in sync with the total width of the + non-hidden title columns.  When using Tablelist_tile, the + south-west corner frame will be a ttk::frame widget.labels.  + Whenever the total width of the non-hidden title columns (and thus the + requested width of the south-west corner frame) changes, the + <<TablelistTitleColsWidthChanged>> + virtual event is generated, with its -data option + set to the total width of the non-hidden title columns for Tk versions + 8.5 and higher.
      - REMARK:  This subcommand enables you to manage the + REMARK 1:  This subcommand enables you to manage the vertical scrollbar (if any) to appear below the tablelist widget's - header, thus respecting the native look & feel on Mac OS X - Aqua.  As shown in the following example, it is recommended to - always create a scrolled tablelist along with the scrollbar(s) as - children of a (ttk::)frame widget: + header, thus respecting the native look & feel on Mac OS X Aqua and + on many modern Linux systems.  As shown in the following + example, it is recommended to always create a scrolled tablelist + along with the scrollbar(s) as children of a (ttk::)frame widget:
       # Add some entries to the Tk option database
      -set winSys [tk windowingsystem]
      -if {[string compare $winSys "x11"] != 0} {
      -    option add *ScrollArea.borderWidth                  1
      -    option add *ScrollArea.relief                       sunken
      -    option add *ScrollArea.Tablelist.borderWidth        0
      -    option add *ScrollArea.Tablelist.highlightThickness 0
      -}
      +option add *ScrollArea.borderWidth                      1
      +option add *ScrollArea.relief                           sunken
      +option add *ScrollArea.Tablelist.borderWidth            0
      +option add *ScrollArea.Tablelist.highlightThickness     0
       
       . . .
       
       # Create the tablelist and the scrollbars as
      -# children of a frame of class ScrollArea
      +# children of a frame of the class ScrollArea
       set frm [(ttk::)frame ... -class ScrollArea]
       set tbl $frm.tbl
       set vsb $frm.vsb
       set hsb $frm.hsb
       tablelist::tablelist $tbl ... \
           -xscrollcommand [list $hsb set] -yscrollcommand [list $vsb set]
      -scrollbar $vsb -orient vertical   -command [list $tbl yview]
      -scrollbar $hsb -orient horizontal -command [list $tbl xview]
      +(ttk::)scrollbar $vsb -orient vertical   -command [list $tbl yview]
      +(ttk::)scrollbar $hsb -orient horizontal -command [list $tbl xview]
       
       . . .
       
       # Manage the widgets within the frame
       grid $tbl -row 0 -rowspan 2 -column 0 -sticky news
      -if {[string compare $winSys "aqua"] == 0} {
      +if {[string compare [tk windowingsystem] "win32"] == 0} {
      +    grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns
      +} else {
           grid [$tbl cornerpath] -row 0 -column 1 -sticky ew
           grid $vsb              -row 1 -column 1 -sticky ns
      -} else {
      -    grid $vsb -row 0 -rowspan 2 -column 1 -sticky ns
       }
       grid $hsb -row 2 -column 0 -sticky ew
       grid rowconfigure    $frm 1 -weight 1
       grid columnconfigure $frm 0 -weight 1
       
       # Manage the frame
      -pack $frm -expand yes -fill both
      +pack $frm -expand yes -fill both -padx 10 -pady 10
      +
      +
      +
      + +
      + REMARK 2:  This subcommand also enables you to manage the + horizontal scrollbar (if any) to start to the right of the tablelist + widget's non-scrollable title column area if the value of the + -titlecolumns option + is positive.  In the above example, this can be achieved by + modifying its second half as follows: + +
      +
      +. . .
      +
      +# Manage the widgets within the frame
      +grid $tbl -row 0 -rowspan 2 -column 0 -columnspan 2 -sticky news
      +if {[string compare [tk windowingsystem] "win32"] == 0} {
      +    grid $vsb -row 0 -rowspan 2 -column 2 -sticky ns
      +} else {
      +    grid [$tbl cornerpath] -row 0 -column 2 -sticky ew
      +    grid $vsb              -row 1 -column 2 -sticky ns
      +}
      +grid [$tbl cornerpath -sw] -row 2 -column 0 -sticky ns
      +grid $hsb                  -row 2 -column 1 -sticky ew
      +grid rowconfigure    $frm 1 -weight 1
      +grid columnconfigure $frm 1 -weight 1
      +
      +# Manage the frame
      +pack $frm -expand yes -fill both -padx 10 -pady 10
      +
      + +

      For a tablelist widget having two header rows and one title + column, the scrollbars of the modified example will appear like in + the screenshot below (on Windows this is only valid for the + horizontal scrollbar):

      + +

      Scrollbars

      +
      +
      + +
      + REMARK 3:  You can greatly simplify the creation of + scrolled tablelists (and other scrolled widgets) by using a scrollarea + widget, which is part of the Scrollutil package.  It + supports both static and dynamic scrollbars and respects the header + component and title columns of tablelist widgets.  With the aid + of the scrollarea widget, the rather technical code in the above + example can be replaced with just a few lines: + +
      +
      +package require scrollutil(_tile)
      +
      +. . .
      +
      +# Create the tablelist within a scrollarea
      +set sa [scrollutil::scrollarea ...]
      +set tbl $sa.tbl
      +tablelist::tablelist $tbl ...
      +$sa setwidget $tbl
      +
      +. . .
      +
      +# Manage the scrollarea
      +pack $sa -expand yes -fill both -padx 10 -pady 10
       
      -
      pathName - curcellselection +
      pathName curcellselection ?-all|-nonhidden|-viewable?
      Returns a list containing the canonical indices (of the form @@ -7656,18 +9085,18 @@

      Detailed Reference

      "#isviewable">viewable ones.
      pathName delete - first last
      + firstIndex lastIndex

      pathName delete indexList
      Deletes one or more items of the tablelist if its state is not disabled.  In the first form of the command, - first and last are indices - specifying the first and last items in the range to delete.  The - command's second form accepts a list indexList of - indices specifying the items to be deleted.  In both cases, all - descendants of the specified items will be deleted, too.  The - return value is an empty string.
      + firstIndex and lastIndex are + indices specifying the first and last items in the range to + delete.  The command's second form accepts a list + indexList of indices specifying the items to be + deleted.  In both cases, all descendants of the specified items + will be deleted, too.  The return value is an empty string.
      pathName deletecolumns firstColumn lastColumn
      @@ -7699,8 +9128,8 @@

      Detailed Reference

      root then the return value will be the number of items of the tablelist widget. -
      pathName - dicttoitem dictionary
      +
      pathName dicttoitem + dictionary
      Returns a tablelist item corresponding to the dictionary indicated by dictionary.  Each key in the specified @@ -7709,7 +9138,7 @@

      Detailed Reference

      (e.g., a number or a column name).  The values corresponding to the keys will be interpreted as the elements of the resulting tablelist item.  If the number of distinct numerical equivalents of the keys - (see the columnindex + (see the columnindex subcommand) is less than the number of columns then the elements corresponding to the missing column indices will be set to empty strings.
      @@ -7725,14 +9154,16 @@

      Detailed Reference

      the same dictionary, the subcommand will return the list  {Black Joe {}}. -
      For technical reasons (the use of the - dict command), this subcommand is not supported for - Tcl versions earlier than 8.5.
      +
      This subcommand is only available in the presence of the + dict command, which is the case when using Tcl + version 8.5 or later, or one of the alternative, Tcl-only dict + implementations.
      pathName editcell cellIndex
      -
      Starts the interactive editing of the cell's contents if the +
      Starts the interactive editing of the cell's content if the tablelist's state is not disabled and the cell is viewable and editable.  Returns an empty @@ -7795,7 +9226,70 @@

      Detailed Reference

      -
      pathName entrypath
      +
      pathName embedcheckbutton + cellIndex ?command?
      + +
      Sets the -window + option of the cell indicated by cellIndex to a + procedure that creates a frame with a checkbutton child having its + -variable option set to a global variable whose + name is private to Tablelist and is initialized with the cell's + internal value (which should be the boolean 0 or + 1).  Any change in the checkbutton's check state will + automatically set the cell's internal value to the corresponding + boolean value 0 or 1.  If the optional + command argument is a nonempty string then the + checkbutton's -command option will be set to a + script that concatenates this argument with the path name of the + tablelist widget and the cell's row and column indices and then invokes + the resulting script at idle time, thus making sure that at the time of + its invocation the cell's internal value will already be updated to + reflect the checkbutton's check state.
      + +
      REMARK 1:  Remember that the + windowpath subcommand + will return the path name of the embedded window, which is a frame; to + get the checkbutton's path name, append .ckbtn to + the frame's one.
      + +
      REMARK 2:  As described above, the + checkbutton's initial check state will reflect the cell's + internal value, and any change in the checkbutton's check state will + automatically update the cell.  On the other hand, if you change + the cell's internal value programmatically then it is your + responsibility to synchronize the checkbutton's check state.  To + this end you will have to retrieve the checkbutton's path name as + described above, get the name of its associated variable via  + cget -variable,  and set this variable to the + cell's internal value.
      + +
      pathName + embedcheckbuttons columnIndex + ?command?
      + +
      This command is logically equivalent to invoking embedcheckbutton for all body cells + of the column specified by columnIndex.
      + +
      pathName + embedttkcheckbutton cellIndex + ?command?
      + +
      Similar to embedcheckbutton, with the only + difference that the frame embedded into the cell will contain a + ttk::checkbutton child.
      + +
      pathName + embedttkcheckbuttons columnIndex + ?command?
      + +
      This command is logically equivalent to invoking embedttkcheckbutton for all body + cells of the column specified by columnIndex.
      + +
      pathName + entrypath
      Returns the path name of the entry or entry-like component of the temporary embedded widget used for interactive cell editing, created by @@ -7813,24 +9307,24 @@

      Detailed Reference

      configuration options.
      pathName expand - index ?-fully|-partly?
      + indexList ?-fully|-partly? -
      This subcommand expands the specified row of a tablelist used as a - tree widget, i.e., makes all its children visible.  The optional +
      This subcommand expands the specified rows of a tablelist used as a + tree widget, i.e., makes all their children visible.  The optional argument -fully (which is the default) indicates that the command will be performed recursively, i.e., all of the - descendants of the node specified by index will be - displayed.  The -partly option (which is used - by the default bindings) restricts the operation to just one hierarchy - level, indicating that only the children of the specified node will be - displayed, without changing the expanded/collapsed state of the child - nodes.
      + descendants of the nodes specified by indexList + will be displayed.  The -partly option (which + is used by the default bindings) restricts the operation to just one + hierarchy level, indicating that only the children of the specified + nodes will be displayed, without changing the expanded/collapsed state + of the child nodes.
      Before displaying the children of a row, the command specified as the value of the -expandcommand option (if any) is - automatically concatenated with the name of the tablelist widget and - the row index, and the resulting script is evaluated in the global + automatically concatenated with the path name of the tablelist widget + and the row index, and the resulting script is evaluated in the global scope.  This enables you to insert a tree node's children on demand, just before expanding it.
      @@ -7839,6 +9333,11 @@

      Detailed Reference

      row), this subcommand is not supported for Tk versions earlier than 8.3. +
      REMARK:  If you want to expand several rows, + it is much more efficient to do it by invoking this subcommand for the + list of their indices than by invoking it in a loop, for the individual + rows.
      +
      pathName expandall ?-fully|-partly?
      @@ -7855,8 +9354,8 @@

      Detailed Reference

      Before displaying the children of a row, the command specified as the value of the -expandcommand option (if any) is - automatically concatenated with the name of the tablelist widget and - the row index, and the resulting script is evaluated in the global + automatically concatenated with the path name of the tablelist widget + and the row index, and the resulting script is evaluated in the global scope.  This enables you to insert a tree node's children on demand, just before expanding it.
      @@ -7873,8 +9372,8 @@

      Detailed Reference

      pathName fillcolumn columnIndex text
      -
      Sets all the elements of the specified column to the value - text.
      +
      Sets all the elements of the specified column in the tablelist body + to the value text.
      pathName findcolumnname name
      @@ -7905,20 +9404,20 @@

      Detailed Reference

      finishediting
      This subcommand attempts to terminate the interactive editing of - the contents of the cell whose index was passed to the - editcell subcommand by - destroying the temporary widget embedded into the cell and updating the - cell's contents.  The exact steps involved are as follows:  - First, the widget's final text is compared to its original one.  - If they are equal then the edit window is destroyed and the cell's - original contents are restored.  If the two strings are different - and the value of the editcell subcommand by destroying the + temporary widget embedded into the cell and updating the cell's + content.  The exact steps involved are as follows:  First, + the widget's final text is compared to its original one.  If they + are equal then the edit window is destroyed and the cell's original + content is restored.  If the two strings are different and the + value of the -editendcommand configuration option is a nonempty string, then the widget's final text is passed to that command as its last argument (following the tablelist's path name as well as the cell's row and column indices), the resulting script is evaluated in the global scope, and the return value becomes the cell's - new contents after destroying the edit window.  However, if from + new content after destroying the edit window.  However, if from within this script the rejectinput subcommand was invoked then the cell's value is not changed and the embedded widget remains @@ -7927,7 +9426,7 @@

      Detailed Reference

      1.  Immediately before returning the value 1, the command generates the virtual event <<TablelistCellUpdated>>.  For Tk - versions 8.5 or higher, this virtual event is generated with its + versions 8.5 and higher, this virtual event is generated with its -data option set to a list consisting of the numerical row and column indices of the cell whose content is being edited.  If no cell was being edited when the command was invoked @@ -7968,12 +9467,13 @@

      Detailed Reference

      specified as the value of the -formatcommand column configuration option.  It returns a three-element list containing information - about the tablelist cell whose content is being formatted with the aid - of that command.  The first element of the list is the full key - (of the form knumber) associated with the + about the body or header cell whose content is being formatted with the + aid of that command.  The first element of the list is the full + key (of the form knumber or + hknumber) associated with the body or header item containing the tablelist element that is being formatted.  - The second and third elements are the cell's row and column - indices.
      + The second and third list elements are the cell's row (or header row) + and column indices.
      REMARK:  This subcommand is needed in cases where the @@ -7999,13 +9499,13 @@

      Detailed Reference

      -
      pathName get first - last
      +
      pathName get firstIndex + lastIndex
      pathName get indexList
      The first form of the command returns a list whose elements are all of the tablelist items (i.e., row contents) between - first and last, + firstIndex and lastIndex, inclusive.  The value returned by the second form depends on the number of elements in the list indexList: if the latter contains exactly one index then the return value is the @@ -8037,25 +9537,25 @@

      Detailed Reference

      lists themselves, where each of the sublists corresponds to exactly one column between firstColumn and lastColumn, inclusive, and consists of all of the - tablelist elements contained in that column.  The value returned - by the second form depends on the number of elements in the list - columnIndexList: if the latter contains exactly one - column index then the return value is a list consisting of all of the - tablelist elements contained in the column indicated by that column - index; otherwise the command returns a list whose elements are lists - themselves, where each of the sublists corresponds to exactly one - column index in columnIndexList and consists of all - of the tablelist elements contained in that column.
      + tablelist body elements contained in that column.  The value + returned by the second form depends on the number of elements in the + list columnIndexList: if the latter contains + exactly one column index then the return value is a list consisting of + all of the tablelist body elements contained in the column indicated by + that column index; otherwise the command returns a list whose elements + are lists themselves, where each of the sublists corresponds to exactly + one column index in columnIndexList and consists of + all of the tablelist body elements contained in that column.
      pathName - getformatted first last
      + getformatted firstIndex lastIndex
      pathName getformatted indexList
      The first form of the command returns a list whose elements are all of the formatted tablelist items (i.e., - formatted row contents) between first and - last, inclusive.  The value returned by the - second form depends on the number of elements in the list + formatted row contents) between firstIndex and + lastIndex, inclusive.  The value returned by + the second form depends on the number of elements in the list indexList: if the latter contains exactly one index then the return value is the formatted tablelist item indicated by that index (or an empty string if the index refers to a non-existent item); @@ -8089,24 +9589,25 @@

      Detailed Reference

      lists themselves, where each of the sublists corresponds to exactly one column between firstColumn and lastColumn, inclusive, and consists of all of the - formatted tablelist elements contained in - that column.  The value returned by the second form depends on the - number of elements in the list columnIndexList: if - the latter contains exactly one column index then the return value is a - list consisting of all of the formatted tablelist elements contained in - the column indicated by that column index; otherwise the command - returns a list whose elements are lists themselves, where each of the - sublists corresponds to exactly one column index in - columnIndexList and consists of all of the - formatted tablelist elements contained in that column.
      + formatted tablelist body elements + contained in that column.  The value returned by the second form + depends on the number of elements in the list + columnIndexList: if the latter contains exactly one + column index then the return value is a list consisting of all of the + formatted tablelist body elements contained in the column indicated by + that column index; otherwise the command returns a list whose elements + are lists themselves, where each of the sublists corresponds to exactly + one column index in columnIndexList and consists of + all of the formatted tablelist body elements contained in that + column.
      pathName - getfullkeys first last
      + getfullkeys firstIndex lastIndex
      pathName getfullkeys indexList
      The first form of the command returns a list whose elements are all of the full keys associated with the tablelist items between - first and last, + firstIndex and lastIndex, inclusive.  The value returned by the second form depends on the number of elements in the list indexList: if the latter contains exactly one index then the return value is the full key @@ -8124,12 +9625,12 @@

      Detailed Reference

      k to these internal item IDs.
      pathName getkeys - first last
      + firstIndex lastIndex
      pathName getkeys indexList
      The first form of the command returns a list whose elements are all of the sequence numbers associated with the tablelist items between - first and last, + firstIndex and lastIndex, inclusive.  The value returned by the second form depends on the number of elements in the list indexList: if the latter contains exactly one index then the return value is the sequence @@ -8172,6 +9673,39 @@

      Detailed Reference

      for the row given by index exists and 0 otherwise.
      + + +
      This command is only supported for Tk versions 8.5 and later.  + It is used to invoke various operations on the items in the widget's + header component.  The supported subcommnds are described in the + HEADER-RELATED SUBCOMMANDS section.
      + +
      pathName + headerpath
      + +
      This command is only supported for Tk versions 8.5 and later.  + It returns the path name of the text widget containing the header + items.
      + +
      pathName + headertag
      + +
      This command is only supported for Tk versions 8.5 and later.  + It returns the name of a binding tag whose name depends on the path + name of the tablelist widget and which is associated with the text + widget containing the header items, as well as the message and label + widgets used for displaying multi-line elements and images, + respectively in the header cells.  This binding tag precedes the + tag TablelistHeader + in the list of binding tags of the tablelist descendants mentioned + above, and is designed to be used when defining individual binding + scripts for tablelist widgets.  The main advantage of using this + tag instead of the path name of the text widget containing the header + items is that it enables you to write event handling scripts that are + valid not only for the above-mentioned text widget but also for the + multi-line cells and embedded images contained in it.
      +
      pathName hidetargetmark
      @@ -8180,11 +9714,11 @@

      Detailed Reference

      command.  No error is generated if the target indicator is not visible at the time the command is invoked. -
      This command is designed to be used during a drag & - drop operation for which the tablelist widget (or its body component) - was registered as a drop target.  See the DRAG & DROP SUPPORT section for - details and examples.
      +
      This command is designed to be used during a drag & drop + operation for which the tablelist widget (or its body component) was + registered as a drop target.  See the DRAG & DROP SUPPORT section for details + and examples.
      pathName imagelabelpath cellIndex
      @@ -8209,13 +9743,14 @@

      Detailed Reference

      -bind [.tbl bodytag] <Button-1> {printClickedImage %W %x %y}
      +bind [.tbl bodytag] <Button-1> {printClickedImage %W %x %y}
      proc printClickedImage {w x y} { foreach {tbl x y} [tablelist::convEventFields $w $x $y] {} set cellIdx [$tbl containingcell $x $y] scan $cellIdx "%d,%d" row col - if {$row >= 0 && $col >= 0 && + if {$row >= 0 && $col >= 0 && [string compare $w [$tbl imagelabelpath $cellIdx]] == 0} { puts "clicked the image of cell $cellIdx" } @@ -8224,7 +9759,7 @@

      Detailed Reference

      -
      pathName index +
      pathName index index
      Returns the integer row index value that corresponds to @@ -8436,7 +9971,7 @@

      Detailed Reference

      0 otherwise.  In both cases, the full (unsnipped) cell text is stored in the variable having the name given by fullTextName; this full text can be the cell's - contents or the string obtained from the latter by using the + content or the string obtained from the latter by using the -formatcommand option of the cell's column.  The most common invocation of this command occurs within the procedure specified as the value of the @@ -8479,10 +10014,10 @@

      Detailed Reference

      itemlistvar
      - Returns the name of a variable used by Tablelist to hold the widget's - internal list.  The recommended way to use this variable is to - create a link to it with the aid of the upvar - command, like in the following example: + Returns the name of a variable used by Tablelist to hold the internal + list associated with the widget's body.  The recommended way to + use this variable is to create a link to it with the aid of the + upvar command, like in the following example:
      @@ -8492,11 +10027,11 @@ 

      Detailed Reference

      In this example, the value of the variable itemList - will be the internal list of the tablelist widget - .tbl.  Each element of the widget's internal list - corresponds to one item, and it is in turn a list whose elements - correspond to the elements of that item, except that it has one - additional element, holding the item's full key.
      + will be the internal list associated with the body of the tablelist + widget .tbl.  Each element of the list corresponds to + one item, and it is in turn a list whose elements correspond to the + elements of that item, except that it has one additional element, + holding the item's full key.
      REMARK:  The itemlistvar command provides an efficient way for accessing this internal list, @@ -8509,18 +10044,18 @@

      Detailed Reference

      etc.  This should, however, be a strictly readonly access; otherwise the results will be unpredictable!
      -
      pathName - itemtodict item
      +
      pathName itemtodict + item
      Returns a dictionary built from the tablelist item indicated by item.  The dictionary's keys will be column numbers or names, and the values will be the corresponding elements of the given item.  For each column number col, if the corresponding column name (returned by  - pathName columncget col -name)  is a - nonempty string then this name will be used as dictionary key, - otherwise the numerical column index col.
      + pathName columncget + col -name)  is a nonempty string then this name will + be used as dictionary key, otherwise the numerical column index + col.
      For example, if your tablelist widget has 3 columns, of which the @@ -8547,9 +10082,11 @@

      Detailed Reference

      -
      For technical reasons (the use of the dict - command), this subcommand is not supported for Tcl versions earlier - than 8.5.
      +
      This subcommand is only available in the presence of the + dict command, which is the case when using Tcl + version 8.5 or later, or one of the alternative, Tcl-only dict + implementations.
      pathName labelpath columnIndex
      @@ -8627,7 +10164,7 @@

      Detailed Reference

      Given a y-coordinate within the tablelist window, this command returns the index of the viewable tablelist - item nearest to that y-coordinate.  The coordinate + body item nearest to that y-coordinate.  The coordinate y is expected to be relative to the tablelist window itself (not its body component).
      @@ -8636,10 +10173,10 @@

      Detailed Reference

      Given an x- and a y-coordinate within the tablelist window, this command returns the index of the viewable - tablelist cell nearest to the point having these coordinates.  The - coordinates x and y are - expected to be relative to the tablelist window itself (not its body - component).
      + tablelist body cell nearest to the point having these + coordinates.  The coordinates x and + y are expected to be relative to the tablelist + window itself (not its body component).
      pathName nearestcolumn x
      @@ -8695,7 +10232,7 @@

      Detailed Reference

      If invoked from within the Tcl command specified by the -editendcommand configuration option, then this subcommand prevents the termination of - the interactive editing of the contents of the cell whose index was + the interactive editing of the content of the cell whose index was passed to the editcell subcommand.  It invokes the seecell subcommand to make sure the @@ -8703,7 +10240,7 @@

      Detailed Reference

      and sets the focus to the temporary widget embedded into the cell.  This command enables you to reject the widget's text during the final validation of the string intended to become the new cell - contents.  The return value is an empty string.
      + content.  The return value is an empty string.
      pathName resetsortinfo
      @@ -8722,6 +10259,18 @@

      Detailed Reference

      "#sortbycolumnlist">sortbycolumnlist
      .  The return value is an empty string. +
      pathName + restorecursor
      + +
      Sets the -cursor configuration option to the + value that it had before invoking the setbusycursor subcommand and returns + the boolean value 1.  If there was no previous + setbusycursor invocation or this is not the first + restorecursor invocation since the most recent call + to setbusycursor, then the command returns the + value 0, without attempting to restore the cursor.
      +
      pathName rowattrib index ?name? ?value name value ...?
      @@ -8769,8 +10318,8 @@

      Detailed Reference

      specified, then the command modifies the given row option(s) to have the given value(s); in this case the return value is an empty string.  option may have any of the values - described in the ROW CONFIGURATION OPTIONS - section. + described in the ROW CONFIGURATION OPTIONS IN + THE TABLELIST BODY section.
      pathName scan option args
      @@ -8815,7 +10364,7 @@

      Detailed Reference

      searchcolumn columnIndex pattern ?options? -
      This subcommand searches the elements of the column given by +
      This subcommand searches the body elements of the column given by columnIndex to see if one of them matches pattern.  If a match is found, the row index of the first matching element is returned as result (unless the option @@ -8838,7 +10387,7 @@

      Detailed Reference

      -backwards The search will proceed backward through the given column's - elements.