1#!/bin/sh 2# the next line restarts using tclsh \ 3exec tclsh "$0" "$@" 4 5package require Tk 6 7# Copyright (c) 2005-2007 Keith Nash. 8# 9# See the file "license.terms" for information on usage and redistribution 10# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 12### This is a short, simple example. It shows the difference 13### between a default text widget and one that uses ntext. 14 15### To explore the ntext options, try ntextDemoBindings.tcl 16### To explore ntext indentation, try ntextDemoIndent.tcl 17 18# This string defines the text that will be displayed in each widget: 19set 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." 20} 21# End of string for widget text. 22 23package require ntext 24 25# Whether Shift-Button-1 ignores changes made by the kbd to the insert mark: 26set ::ntext::classicMouseSelect 0 27 28# Whether Shift-Button-1 has a variable or fixed anchor: 29set ::ntext::classicAnchor 0 30 31# Whether to activate certain traditional "extra" bindings 32variable classicExtras 1 33 34# Whether to use new or classic word boundary detection: 35set ::ntext::classicWordBreak 0 36 37pack [text .right ] -side right 38.right configure -width 28 -height 12 -wrap word -font {{Courier} -15} -bg white 39.right insert end " I use the Ntext bindings.\n\n$message" 40 41bindtags .right {.right Ntext . all} 42 43pack [text .left ] -side right 44.left configure -width 28 -height 12 -wrap word -font {{Courier} -15} -bg #FFFFEE 45.left insert end " I use the (default) Text bindings.\n\n$message" 46