############################################################################## my $pagesize = 10; #elements per page sub setup_pager{ my $arrayref = $_[0]; #pass in @list my $new = $_[1]; #conditional for new %pager=(); #empty pager my $keytot = scalar @{$arrayref}; #print "$keytot\n"; my $key; #setup pages####################### my $count = 1; foreach $key (@{$arrayref}){ push @{$pager{$count}},$key; if(scalar @{$pager{$count}} > ($pagesize - 1) ){$count++} } ################################## if($new){&display_page($count)} else{ &display_page(1) }; } ################################################################################ sub display_page{ $page = shift; my $e = shift || 1; #which entry to display, defaults to 1 #top is admin at 0 $pagetot = scalar(keys %pager); $pagerlab->configure(-text => "Page $page of $pagetot"); #blank previous thumbnail entries foreach(1..$pagesize){$h->hide('entry',$_)} #load page foreach my $key (@{$pager{$page}} ){ $ethumbs{$e}->blank; $ethumbs{$e}->read($info{$key}{'thumbnail'}); $h->itemConfigure ($e, 0, #image is read directly in Photo object above -text => $info{$key}{'comment'}, ); $h->itemConfigure($e, 1, -text => "$info{$key}{'name'}\n$info{$key}{'key'}", ); $h->show('entry',$e); $e++; } }