head	1.9;
access;
symbols
	core-8-5-9:1.8
	core-8-5-8:1.8
	macosx-cocoa-merge:1.9
	macosx-cocoa-premerge:1.9
	macosx-carbon-freeze:1.9
	core-8-5-7:1.8
	core-8-5-6:1.8
	core-8-6-b1:1.9
	core-8-6-a3:1.8
	core-8-5-5:1.8
	core-8-6-a2:1.8
	core-8-5-4:1.8
	core-8-5-3:1.8
	core-8-6-a1:1.8
	core-8-4-19:1.3
	core-8-5-branch:1.8.0.2
	core-8-5-2:1.8
	core-8-4-18:1.3
	core-8-5-1:1.8
	core-8-4-17:1.3
	core-8-5-0:1.8
	core-8-5-b3:1.7
	core-8-5-b2:1.6
	core-8-4-16:1.3
	core-8-5-b1:1.6
	core-stablilizer-merge:1.6
	core-stabilizer-branch:1.6.0.2
	core-stabilizer-merge:1.8
	core-8-4-15:1.3
	core-8-5-a6:1.6
	core-8-5-a5:1.6
	core-8-4-14:1.3
	core-8-5-a4:1.6
	core-8-4-13:1.3
	core-8-4-12:1.3
	core-8-4-11:1.3
	core-8-5-a3:1.6
	core-8-4-10:1.3
	core-8-4-9-branch:1.3.0.4
	core-8-5-a2:1.5
	core-8-4-9:1.3
	core-8-4-8:1.3
	core-8-4-7:1.3
	core-8-5-a1:1.4
	core-8-4-6:1.3
	core-8-4-5:1.3
	mistachkin-dev-branch:1.4.0.2
	core-8-4-4:1.3
	core-8-4-3:1.3
	core-8-4-branch:1.3.0.2
	core-8-4-2:1.3
	core-8-4-1:1.3
	core-8-3-5:1.2
	core-8-4-0:1.3
	macosx-8-4-merge-2002-08-31-trunk:1.3
	macosx-8-4-premerge-2002-08-31-branch:1.2.24.1
	macosx-8-4-premerge-2002-08-31-trunk:1.3
	macosx-8-4-merge-2002-08-30-branch:1.2.24.1
	macosx-8-4-merge-2002-08-30-trunk:1.3
	macosx-8-4-merge-2002-08-20-branch:1.2.24.1
	macosx-8-4-merge-2002-08-20-trunk:1.3
	core-8-4-b2:1.3
	core-8-4-b1:1.3
	macosx-premerge-6-9-02:1.2.24.1
	core-8-4-a4:1.3
	core-8-3-4:1.2
	macosx-8-4-branch:1.2.0.24
	macosx-8-4-branchpoint:1.2
	core-8-4-a3:1.2
	core-8-3-3:1.2
	dgp-privates-into-namespace:1.2.0.22
	tclpro-1-5-0:1.2
	core-8-4-win-speedup:1.2.0.20
	core-8-4-a2:1.2
	tclpro-1-4-1:1.2
	tclpro-1-4-0:1.2
	core-8-3-2:1.2
	ajuba-ajuba2-2-1-base:1.2
	ajuba-ajuba2-2-0:1.2
	core-8-4-a1:1.2
	core-8-3-1-branch:1.2.0.18
	core-8-3-1:1.2
	scriptics-sc-2-0-b5:1.2
	scriptics-sc-2-0-fixed:1.2
	scriptics-sc-2-0-b2:1.2
	scriptics-sc-2-0-b1:1.2
	core-8-3-0:1.2
	core-8-3-b2:1.2
	core-8-3-b1:1.2
	scriptics-sc-1-1:1.2
	scriptics-sc-1-1-b1:1.2
	core-8-2-3:1.2
	scriptics-sc-1-1-branch:1.2.0.16
	scriptics-sc-1-1-base:1.2
	scriptics-sc-1-0:1.2
	scriptics-sc-1-0-branch:1.2.0.14
	scriptics-sc-1-0-base:1.2
	core-8-2-2:1.2
	core-8-2-1:1.2
	scriptics-bc-1-0-b1:1.2
	core-8-2-1-branch:1.2.0.12
	scriptics-tclpro-1-3-0:1.2
	core-8-2-0:1.2
	core-8-2-b3-branch:1.2.0.10
	core-8-2-b3-base:1.2
	scriptics-tclpro-1-3-b4:1.2
	core-8-2-b2:1.2
	scriptics-tclpro-1-3-b3:1.2
	core-8-2-b1:1.2
	scriptics-tclpro-1-3-b2:1.2
	merge-to-mainline-5/21/99:1.2
	scriptics-tclpro-1-3-b2-branch:1.2.0.8
	core-8-1-1:1.2
	scriptics-tclpro-1-3-b1:1.2
	core-8-1-1-base:1.2
	core-8-1-0:1.2
	merge-to-mainline-4-29-99:1.2
	merge-to-mainline-4-23-99:1.2
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.2.0.6
	core-8-0-6-base:1.2
	core-8-0-5:1.2
	core-8-1-b3:1.1.4.1
	core-8-1-b2:1.1.4.1
	dev-8-1-stubs-branch:1.1.4.1.0.2
	dev-stubs-branch:1.2.0.4
	scriptics-tclpro-1-2:1.2
	scriptics-tclpro-1-2-b2:1.2
	core-8-1-merge-2/10/99:1.2
	core-8-0-5-branch:1.2.0.2
	core-8-0-5-base:1.2
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.1
	core-8-0-4:1.2
	core-8-1-a2:1.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@# @;


1.9
date	2008.12.10.05.02.51;	author das;	state Exp;
branches;
next	1.8;

1.8
date	2007.12.13.15.27.07;	author dgp;	state Exp;
branches;
next	1.7;

1.7
date	2007.10.30.01.57.55;	author hobbs;	state Exp;
branches;
next	1.6;

1.6
date	2004.12.21.11.56.35;	author dkf;	state Exp;
branches
	1.6.2.1;
next	1.5;

1.5
date	2004.03.17.18.15.45;	author das;	state Exp;
branches;
next	1.4;

1.4
date	2003.08.20.23.02.18;	author hobbs;	state Exp;
branches;
next	1.3;

1.3
date	2001.11.15.11.55.26;	author dkf;	state Exp;
branches;
next	1.2;

1.2
date	98.09.14.18.23.30;	author stanton;	state Exp;
branches
	1.2.20.1
	1.2.24.1;
next	1.1;

1.1
date	98.04.01.09.54.28;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.30.02.17.55;	author stanton;	state Exp;
branches;
next	;

1.2.20.1
date	2002.04.02.20.58.51;	author hobbs;	state Exp;
branches;
next	;

1.2.24.1
date	2002.02.05.02.25.16;	author wolfsuit;	state Exp;
branches;
next	;

1.6.2.1
date	2007.11.01.16.37.22;	author dgp;	state Exp;
branches;
next	;


desc
@@


1.9
log
@TIP #324 IMPLEMENTATION
@
text
@# text.tcl --
#
# This demonstration script creates a text widget that describes
# the basic editing functions.
#
# RCS: @@(#) $Id: text.tcl,v 1.8 2007/12/13 15:27:07 dgp Exp $

if {![info exists widgetDemo]} {
    error "This script should be run from the \"widget\" demo."
}

package require Tk

set w .text
catch {destroy $w}
toplevel $w
wm title $w "Text Demonstration - Basic Facilities"
wm iconname $w "text"
positionWindow $w

## See Code / Dismiss buttons
set btns [addSeeDismiss $w.buttons $w {} \
	{ttk::button $w.buttons.fontchooser -command fontchooserToggle}]
pack $btns -side bottom -fill x

text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \
	-height 30 -undo 1 -autosep 1
scrollbar $w.scroll -command [list $w.text yview]
pack $w.scroll -side right -fill y
pack $w.text -expand yes -fill both

# TIP 324 Demo: [tk fontchooser]
proc fontchooserToggle {} {
    tk fontchooser [expr {[tk fontchooser configure -visible] ?
            "hide" : "show"}]
}
proc fontchooserVisibility {w} {
    $w configure -text [expr {[tk fontchooser configure -visible] ?
            "Hide Font Dialog" : "Show Font Dialog"}]
}
proc fontchooserFocus {w} {
    tk fontchooser configure -font [$w cget -font] \
	    -command [list fontchooserFontSel $w]
}
proc fontchooserFontSel {w font args} {
    $w configure -font [font actual $font]
}
tk fontchooser configure -parent $w
bind $w.text <FocusIn> [list fontchooserFocus $w.text]
fontchooserVisibility $w.buttons.fontchooser
bind $w <<TkFontchooserVisibility>> [list \
	fontchooserVisibility $w.buttons.fontchooser]
focus $w.text

$w.text insert 0.0 \
{This window is a text widget.  It displays one or more lines of text
and allows you to edit the text.  Here is a summary of the things you
can do to a text widget:

1. Scrolling. Use the scrollbar to adjust the view in the text window.

2. Scanning. Press mouse button 2 in the text window and drag up or down.
This will drag the text at high speed to allow you to scan its contents.

3. Insert text. Press mouse button 1 to set the insertion cursor, then
type text.  What you type will be added to the widget.

4. Select. Press mouse button 1 and drag to select a range of characters.
Once you've released the button, you can adjust the selection by pressing
button 1 with the shift key down.  This will reset the end of the
selection nearest the mouse cursor and you can drag that end of the
selection by dragging the mouse before releasing the mouse button.
You can double-click to select whole words or triple-click to select
whole lines.

5. Delete and replace. To delete text, select the characters you'd like
to delete and type Backspace or Delete.  Alternatively, you can type new
text, in which case it will replace the selected text.

6. Copy the selection. To copy the selection into this window, select
what you want to copy (either here or in another application), then
click button 2 to copy the selection to the point of the mouse cursor.

7. Edit.  Text widgets support the standard Motif editing characters
plus many Emacs editing characters.  Backspace and Control-h erase the
character to the left of the insertion cursor.  Delete and Control-d
erase the character to the right of the insertion cursor.  Meta-backspace
deletes the word to the left of the insertion cursor, and Meta-d deletes
the word to the right of the insertion cursor.  Control-k deletes from
the insertion cursor to the end of the line, or it deletes the newline
character if that is the only thing left on the line.  Control-o opens
a new line by inserting a newline character to the right of the insertion
cursor.  Control-t transposes the two characters on either side of the
insertion cursor.  Control-z undoes the last editing action performed,
and }

switch $tcl_platform(platform) {
    "unix" {
	$w.text insert end "Control-Shift-z"
    }
    "windows" {
	$w.text insert end "Control-y"
    }
}

$w.text insert end { redoes undone edits.

7. Resize the window.  This widget has been configured with the "setGrid"
option on, so that if you resize the window it will always resize to an
even number of characters high and wide.  Also, if you make the window
narrow you can see that long lines automatically wrap around onto
additional lines so that all the information is always visible.}
$w.text mark set insert 0.0
@


1.8
log
@merge stable branch onto HEAD
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.6.2.1 2007/11/01 16:37:22 dgp Exp $
d22 2
a23 1
set btns [addSeeDismiss $w.buttons $w]
d31 24
@


1.7
log
@	* tests/listbox.test, tests/panedwindow.test, tests/scrollbar.test:
	* library/bgerror.tcl, library/dialog.tcl, library/listbox.tcl:
	* library/msgbox.tcl, library/optMenu.tcl, library/tclIndex:
	* library/tkfbox.tcl, library/demos/floor.tcl, library/demos/rmt:
	* library/demos/tcolor, library/demos/text.tcl:
	* library/demos/twind.tcl, library/demos/widget: Buh-bye Motif look
	* library/ttk/fonts.tcl:    Update of Tk default look in 8.5
	* macosx/tkMacOSXDefault.h: Trims border sizes, cleaner X11 look
	* unix/tkUnixDefault.h:     with minor modifications for Win32/Aqua.
	* win/tkWinDefault.h:       Uses Tk*Font definitions throughout for
	* win/tkWinFont.c:          classic widgets. [Bug #1820344]
	* library/obsolete.tcl (::tk::classic::restore): This restores
	changes made to defaults in 8.5 using the 'option' command,
	segmented into logical groups.
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.6 2004/12/21 11:56:35 dkf Exp $
@


1.6
log
@Coding style improvements for the widget demo. [FRQ 815118]
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.5 2004/03/17 18:15:45 das Exp $
d25 1
a25 1
text $w.text -relief sunken -bd 2 -yscrollcommand "$w.scroll set" -setgrid 1 \
d27 1
a27 1
scrollbar $w.scroll -command "$w.text yview"
@


1.6.2.1
log
@merge updates from HEAD
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.6 2004/12/21 11:56:35 dkf Exp $
d25 1
a25 1
text $w.text -yscrollcommand [list $w.scroll set] -setgrid 1 \
d27 1
a27 1
scrollbar $w.scroll -command [list $w.text yview]
@


1.5
log
@Removed support for Mac OS Classic platform [Patch 918139]
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.4 2003/08/20 23:02:18 hobbs Exp $
d12 2
@


1.4
log
@	* library/demos/widget:      Redo code view dialog, use named fonts,
	* library/demos/arrow.tcl:   add basic see/dismiss routine with
	* library/demos/bind.tcl:    images for better look & feel
	* library/demos/bitmap.tcl:
	* library/demos/button.tcl:
	* library/demos/check.tcl:
	* library/demos/clrpick.tcl:
	* library/demos/colors.tcl:
	* library/demos/cscroll.tcl:
	* library/demos/ctext.tcl:
	* library/demos/entry1.tcl:
	* library/demos/entry2.tcl:
	* library/demos/entry3.tcl:
	* library/demos/filebox.tcl:
	* library/demos/floor.tcl:
	* library/demos/form.tcl:
	* library/demos/hscale.tcl:
	* library/demos/icon.tcl:
	* library/demos/image1.tcl:
	* library/demos/image2.tcl:
	* library/demos/items.tcl:
	* library/demos/label.tcl:
	* library/demos/labelframe.tcl:
	* library/demos/menu.tcl:
	* library/demos/menubu.tcl:
	* library/demos/paned1.tcl:
	* library/demos/paned2.tcl:
	* library/demos/plot.tcl:
	* library/demos/puzzle.tcl:
	* library/demos/radio.tcl:
	* library/demos/ruler.tcl:
	* library/demos/sayings.tcl:
	* library/demos/search.tcl:
	* library/demos/spin.tcl:
	* library/demos/states.tcl:
	* library/demos/style.tcl:
	* library/demos/text.tcl:
	* library/demos/twind.tcl:
	* library/demos/unicodeout.tcl:
	* library/demos/vscale.tcl:
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.3 2001/11/15 11:55:26 dkf Exp $
d71 1
a71 1
    "unix" - "macintosh" {
@


1.3
log
@Minor improvements to undo (demo,docs&bindings)
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.2 1998/09/14 18:23:30 stanton Exp $
d19 3
a21 5
frame $w.buttons
pack $w.buttons -side bottom -fill x -pady 2m
button $w.buttons.dismiss -text Dismiss -command "destroy $w"
button $w.buttons.code -text "See Code" -command "showCode $w"
pack $w.buttons.dismiss $w.buttons.code -side left -expand 1
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d6 1
a6 1
# RCS: @@(#) $Id$
d26 1
a26 1
	-height 30
d69 13
a81 1
insertion cursor.
@


1.2.20.1
log
@sync with head
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.3 2001/11/15 11:55:26 dkf Exp $
d26 1
a26 1
	-height 30 -undo 1 -autosep 1
d69 1
a69 13
insertion cursor.  Control-z undoes the last editing action performed,
and }

switch $tcl_platform(platform) {
    "unix" - "macintosh" {
	$w.text insert end "Control-Shift-z"
    }
    "windows" {
	$w.text insert end "Control-y"
    }
}

$w.text insert end { redoes undone edits.
@


1.2.24.1
log
@Merge with current TOT
Added support for the wm stackorder command
Fixed crash when selecting Menu items in the Application menu that we didn't
put there.
Added first bits of the use of CG for low-level drawing.  The line-drawing works,
the rest doesn't yet.  You have to set the file static useCGDrawing to 1 and
rebuild to activate this code.
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.2 1998/09/14 18:23:30 stanton Exp $
d26 1
a26 1
	-height 30 -undo 1 -autosep 1
d69 1
a69 13
insertion cursor.  Control-z undoes the last editing action performed,
and }

switch $tcl_platform(platform) {
    "unix" - "macintosh" {
	$w.text insert end "Control-Shift-z"
    }
    "windows" {
	$w.text insert end "Control-y"
    }
}

$w.text insert end { redoes undone edits.
@


1.1
log
@Initial revision
@
text
@d6 1
a6 1
# SCCS: @@(#) text.tcl 1.6 97/03/02 16:28:12
@


1.1.4.1
log
@Merged 8.0.3 changes into 8.1
@
text
@d6 1
a6 1
# RCS: @@(#) $Id: text.tcl,v 1.2 1998/09/14 18:23:30 stanton Exp $
@


