Tk-Contrib

 view release on metacpan or  search on metacpan

lib/Tk/Dial.pm  view on Meta::CPAN

package Tk::Dial;
use strict;
require Tk::Frame;

use vars qw($VERSION @ISA);
$VERSION = substr(q$Revision: 1.5 $, 10) + 1;

@ISA = qw(Tk::Derived Tk::Frame);           

my $pi = atan2(1, 1) * 4;

Construct Tk::Widget 'Dial';

=head1 NAME

Tk::Dial - An alternative to the Scale widget

=for category Derived Widgets

=head1 SYNOPSIS

    use Tk::Dial;

    $dial = $widget->Dial(-margin =>  20,
		          -radius =>  48,
		          -min    =>   0,
		          -max    => 100,
		          -value  =>   0,
		          -format => '%d');


    margin - blank space to leave around dial
    radius - radius of dial
    min, max - range of possible values
    value  - current value
    format - printf-style format for displaying format

Values shown above are defaults.


=head1 DESCRIPTION

A dial looks like a speedometer: a 3/4 circle with a needle indicating
the current value.  Below the graphical dial is an entry that displays
the current value, and which can be used to enter a value by hand.

The needle is moved by pressing button 1 in the canvas and dragging. The
needle will follow the mouse, even if the mouse leaves the canvas, which
allows for high precision. Alternatively, the user can enter a value in
the entry space and press Return to set the value; the needle will be
set accordingly.

=head1 TO DO

 Configure
 Tick marks
 Step size

=head1 AUTHORS

Roy Johnson <rjohnson@shell.com>

Based on a similar widget in XV, a program by
John Bradley <bradley@cis.upenn.edu>

=head1 HISTORY 
 
August 1995: Released for critique by pTk mailing list



( run in 0.420 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )