1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| #!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::FileSelect;
use Tk::EntryCheck;
use Date::Calc qw(:all);
# Partie graphique
my $w_top = new MainWindow;
$w_top->configure( -title => "Saisie" );
my $w_frame = $w_top->Frame->grid;
# bloc choix du type
my $type = "";
my $lbl_type = $w_frame->Label( -text => "Type " )->grid( -row => 0, -column => 0 );
my $rdb_m = $w_frame->Radiobutton(
-text => "Action",
-value => "Action",
-variable => \$type
)->grid( -row => 0, -column => 1 );
my $rdb_f = $w_frame->Radiobutton(
-text => "Info",
-value => "Info",
-variable => \$type
)->grid( -row => 0, -column => 2 );
# libellée de la tache
$w_frame->Label( -text => 'Nom' )->grid( -row => 1, -column => 0, -sticky => 'e' );
my $w_entry1 = $w_frame->Entry(
-relief => 'sunken',
-width => 30
)->grid( -padx => 10, -pady => 10, -row => 1, -column => 1 );
$w_entry1->focus;
# bloc choix de la periode de rappel
$w_frame->Label( -text => 'Periode', );
my $rappel = "";
my $nb = ();
my $lbl_rappel = $w_frame->Label( -text => "Rappel " );
my $w_entry2 = $w_frame->EntryCheck(
-maxlength => 2,
-textvariable => \$nb,
-relief => 'sunken',
-width => 2
);
$w_entry2->focus;
my $rdb_J = $w_frame->Radiobutton(
-text => "Jour",
-value => "Jour",
-variable => \$rappel
);
my $rdb_M = $w_frame->Radiobutton(
-text => "Mois",
-value => "Mois",
-variable => \$rappel
);
my $rdb_A = $w_frame->Radiobutton(
-text => "Année",
-value => "Annee",
-variable => \$rappel
);
$w_frame->pack;
# Affichage de la ligne 2 si Action est coché
$rdb_m->configure(
-command => sub {
$lbl_rappel->grid( -row => 2, -column => 0 );
$w_entry2->grid( -row => 2, -column => 1, -padx => 10, -pady => 10, -sticky => 'ew' );
$rdb_J->grid( -row => 2, -column => 2 );
$rdb_M->grid( -row => 2, -column => 3 );
$rdb_A->grid( -row => 2, -column => 4 );
},
);
# Cacher la ligne é sans la supprimer si Info est coché
$rdb_f->configure(
-command => sub {
$lbl_rappel->gridForget( $w_entry2, $rdb_J, $rdb_M, $rdb_A );
},
);
MainLoop; |
Partager