my ($screenw, $screenh) = ($main->screenwidth, $main->screenheight); $main->withdraw(); $main->geometry($screenw."x".$screenh."+0+0"); $main->deiconify(); $main->raise();
my $pv = new pvoicecommon( program_title => "pVoice 0.02.1 development", bgcolor => 'white', active_bgcolor => 'red', sounddir => "./data", current_category=> "", current_page => 1, indexfile => "index.txt", catfile => "cat.txt", sound_ext => "wav", img_ext => "jpg", border_width => 10, cellpadding => 4, columns => 4, rows => 4, selected_button => 0 ); $pv->mainframe($main->Frame(-background => $pv->bgcolor())->pack());
# Right mouseclick means select next item $main->bind('', sub { $pv->buttons()->[$pv->selected_button()]->configure( -state => 'normal'); if ($pv->selected_button() < @{$pv->buttons()} -1) {$pv->selected_button($pv->selected_button()+1)} else {$pv->selected_button(0)} $pv->buttons()->[$pv->selected_button()]->configure( -state => 'active'); } ); # Left mouseclick means execute current item $main->bind(' ', sub { $pv->buttons()->[$pv->selected_button()]->invoke(); } );