head	1.3;
access;
symbols
	rel-5-2:1.2
	rel-5-1-patches:1.2.0.2
	rel-5-1:1.2
	rel-5-0:1.1
	rel-5-0beta:1.1;
locks; strict;
comment	@# @;


1.3
date	2000.12.06.21.21.38;	author bparker;	state dead;
branches;
next	1.2;

1.2
date	99.10.19.20.02.42;	author jra;	state Exp;
branches
	1.2.2.1;
next	1.1;

1.1
date	98.06.02.19.49.26;	author jra;	state Exp;
branches;
next	;

1.2.2.1
date	2000.12.06.21.26.49;	author bparker;	state dead;
branches;
next	;


desc
@Original
@


1.3
log
@Upgrading to newer version
@
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.2 1999/10/19 20:02:42 jra 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.2
log
@tk 8.2.1 update
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: square,v 1.2 1998/09/14 18:23:30 stanton Exp $
@


1.2.2.1
log
@Upgrading to newer version
@
text
@d14 1
a14 1
# RCS: @@(#) $Id: square,v 1.2 1999/10/19 20:02:42 jra Exp $
@


1.1
log
@Initial revision
@
text
@d14 1
a14 1
# SCCS: @@(#) square 1.7 97/02/24 16:42:31
@

