NAME

Tk::TimePick - Perl extension for a graphical user interface to pick timestrings syntax mistake-secure

SYNOPSIS

use Tk;
use Tk::TimePick;
my $mw = MainWindow->new();
my $tp = $mw->TimePick()->pack();
my $b = $mw->Button(
	-text		=> "Time",
	-command	=> sub 
		{
		my $time_as_string = $tp->GetTimeString();
		# my $time_as_string = $tp->GetTime();
		#***
		# Here we do something with the time as string
		#***
		}
	)->pack();
MainLoop();

DESCRIPTION

The module protect the application for syntax-mistakes,
made by users, while insert time specifications.

CONSTRUCTOR AND INITIALIZATION

use Tk;
use Tk::TimePick;
my $mw = MainWindow->new();
my $tp = $mw->TimePick(
	-order		=> "smh", 	# default = "hms"
	-separator	=> "<>",		# default = ':'
	-maxhours	=> 12,		# default = 24
	-seconds		=> 30,		# default = (localtime())[0]
	-minutes		=> 30,		# default = (localtime())[1]
	-hours		=> 12,		# default = (localtime())[2]
	-regextimeformat	=> qr/regex for time-string/ # default =  qr/(\d{1,2})(.+?)(\d{1,2})(.+?)(\d{1,2})/o
	)->pack();
$tp->Subwidget("EntryTime")->configure(
	-font		=> "{Times New Roman} 18 {bold}"
	);
for(qw/
	ButtonSecondsReduce
	ButtonSecondsIncrease
	ButtonMinutesReduce
	ButtonMinutesIncrease
	ButtonHoursReduce
	ButtonHoursIncrease
	/)
	{
	$tp->Subwidget($_)->configure(
		-font		=> "{Times New Roman} 14 {bold}",
		);
	}
for(qw/
	FrameSeconds
	FrameMinutes
	FrameHours
	/)
	{
	$tp->Subwidget($_)->configure(
		-background	=> "#00FF00"
		);
	}
MainLoop();

WIDGET SPECIFIC OPTINOS

-order

The order of hours, minutes and seconds. h = hours, m = minutes, s = seconds "hms" = hours:minutes:seconds (default = "hms")

-separator
char or string between the numbers (default = ':')
-maxhours
times in 24 or 12 hours (default = 24)
-seconds
at the beginning indicated seconds
-minutes
at the beginning indicated minutes
-hours
at the beginning indicated hours
-regextimeformat
a regular expression that fits onto the time format
(default = qr/(\d{1,2})(.+?)(\d{1,2})(.+?)(\d{1,2})/o)

METHODS

all options can be set or get by the following methods

$object->SetOrder("hms")
$object->GetOrder();
$object->SetSeparator(':')
$object->GetSeparator();
$object->SetSeconds(20)
$object->GetSeconds()
$object->SetMinutes(45)
$object->GetMinutes()
$object->SetHours(7)
$object->GetHours()
$object->SetMaxHours(12)
$object->GetMaxHours()
$object->SetRegexTimeFormat(qr/(\d{1,2})(.+?)(\d{1,2})(.+?)(\d{1,2})/o)
$object->GetRegexTimeFormat()

with the following functions the time-string can be set or get

$object->SetTimeString("23:21:55")
$object->GetTimeString()
$object->SetTime(12, 44, 51)
$object->GetTime()

INSERTED WIDGETS

EntryTime
shows the time
no direct user inputs are possible
FrameSeconds
contains the two buttons "ButtonSecondsReduce" and "ButtonSecondsIncrease"
ButtonSecondsReduce
reduce the seconds
ButtonSecondsIncrease
increase the seconds
FrameMinutes
contains the two buttons "ButtonMinutesReduce" and "ButtonMinutesIncrease"
ButtonMinutesReduce
reduce the minutes
ButtonMinutesIncrease
increase the minutes
FrameHours
 contains the two buttons "ButtonHoursReduce" and "ButtonHoursIncrease"
	
ButtonHoursReduce
reduce the hours
ButtonHoursIncrease
increase the hours

EXPORT

None by default.

SEE ALSO

Tk::DatePick
http://www.planet-interkom.de/t.knorr/index.html
torstenknorr@tiscali.de

KEYWORDS

time, user interface,

BUGS

Maybe you'll find some. Please let me know.

AUTHOR

Torsten Knorr, <torstenknorr@tiscali.de>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Torsten Knorr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.9.2 or, at your option, any later version of Perl 5 you may have available.

8 POD Errors

The following errors were encountered while parsing the POD:

Around line 568:

'=item' outside of any '=over'

Around line 598:

You forgot a '=back' before '=head1'

Around line 602:

'=item' outside of any '=over'

Around line 630:

You forgot a '=back' before '=head2'

Around line 632:

'=item' outside of any '=over'

Around line 640:

You forgot a '=back' before '=head1'

Around line 642:

'=item' outside of any '=over'

Around line 683:

You forgot a '=back' before '=head2'