head	1.2;
access;
symbols
	rel-6-1-DP:1.1.1.1
	rel-6-0-2:1.1.1.1
	rel-6-0-1-branch:1.1.1.1.0.4
	hartley-6-0-post:1.1.1.1
	hartley-6-0-pre:1.1.1.1
	rel-6-0-1:1.1.1.1
	rel-6-0:1.1.1.1
	rel-5-4:1.1.1.1
	offsite-5-3-pre:1.1.1.1
	rel-5-3:1.1.1.1
	rel-5-1-branch:1.1.1.1.0.2
	windows-6-0-branch:1.1.1.1.0.8
	ansi-6-0-branch:1.1.1.1.0.6
	tk8-3:1.1.1.1
	scriptics:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2003.03.13.19.13.43;	author jra;	state dead;
branches;
next	1.1;

1.1
date	2000.12.06.21.34.18;	author bparker;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.12.06.21.34.18;	author bparker;	state Exp;
branches
	1.1.1.1.6.1
	1.1.1.1.8.1;
next	;

1.1.1.1.6.1
date	2004.03.17.07.31.33;	author morrison;	state dead;
branches;
next	;

1.1.1.1.8.1
date	2004.03.15.17.37.12;	author morrison;	state dead;
branches;
next	;


desc
@@


1.2
log
@*** empty log message ***
@
text
@#!/bin/sh
# the next line restarts using wish \
exec wish "$0" "$@@"

# square --
# This script generates a demo application containing only a "square"
# widget.  It's only usable in the "tktest" application or if Tk has
# been compiled with tkSquare.c. This demo arranges the following
# bindings for the widget:
# 
# Button-1 press/drag:		moves square to mouse
# "a":				toggle size animation on/off
#
# RCS: @@(#) $Id: square,v 1.1 2000/12/06 21:34:18 bparker Exp $

square .s
pack .s -expand yes -fill both
wm minsize . 1 1

bind .s <1> {center %x %y}
bind .s <B1-Motion> {center %x %y}
bind .s a animate
focus .s

# The procedure below centers the square on a given position.

proc center {x y} {
    set a [.s size]
    .s position [expr $x-($a/2)] [expr $y-($a/2)]
}

# The procedures below provide a simple form of animation where
# the box changes size in a pulsing pattern: larger, smaller, larger,
# and so on.

set inc 0
proc animate {} {
    global inc
    if {$inc == 0} {
	set inc 3
	timer
    } else {
	set inc 0
    }
}

proc timer {} {
    global inc
    set s [.s size]
    if {$inc == 0} return
    if {$s >= 40} {set inc -3}
    if {$s <= 10} {set inc 3}
    .s size [expr {$s+$inc}]
    after 30 timer
}
@


1.1
log
@Initial revision
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: square,v 1.2 1998/09/14 18:23:30 stanton Exp $
@


1.1.1.1
log
@Import tk8.3
@
text
@@


1.1.1.1.6.1
log
@sync branch with HEAD
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: square,v 1.1.1.1 2000/12/06 21:34:18 bparker Exp $
@


1.1.1.1.8.1
log
@sync with HEAD -- libtk8.3 is now libtk8.4
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: square,v 1.1.1.1 2000/12/06 21:34:18 bparker Exp $
@

