Here's another frames-within-frames approach.
tk_multi_check_2.pl:

use strict; use warnings; # use Data::Dump qw(dd); # for debug use Tk; my $MW = tkinit; my $checkboxes_label = $MW->Label(-text => "Presence Check")->pack; my $checkboxes_frame = $MW->Frame->pack; use constant CB_FRAME_COL_PACKER => qw(-side left); use constant CB_FRAME_COL_PROPS => qw(-relief groove -borderwidth 2) +; my $checkboxes_frame_col_A = $checkboxes_frame->Frame( CB_FRAME_COL_PROPS )->pack(CB_FRAME_COL_PACKER); my $checkboxes_frame_col_B = $checkboxes_frame->Frame( CB_FRAME_COL_PROPS )->pack(CB_FRAME_COL_PACKER); my %check_boxes = ( 'a' => { -text => 'Document A (docx, pdf)', -onvalue => + 'APRESENT', -offvalue => 'AABSENT', }, 'b' => { -text => 'Document B (xlsx)', -onvalue => + 'BPRESENT', -offvalue => 'BABSENT', }, 'c' => { -text => 'C specification', -onvalue => + 'CPRESENT', -offvalue => 'CABSENT', }, 'aspec' => { -text => 'A-Specification', -onvalue => + 'ASPECPRESENT', -offvalue => 'ASPECSABSENT', }, 'report' => { -text => 'Important Report', -onvalue => + 'REPORTPRESENT', -offvalue => 'REPORTSABSENT', }, 'handbook' => { -text => 'Handbook', -onvalue => + 'HANDBOOKPRESENT', -offvalue => 'HANDBOOKABSENT', }, 'spreadsheet' => { -text => 'Data Spreadsheet', -onvalue => + 'DATAPRESENT', -offvalue => 'DATAABSENT', }, 'dfile' => { -text => 'D file', -onvalue => + 'DFILEPRESENT', -offvalue => 'DFILEABSENT', }, 'xxdoc' => { -text => 'xx doc', -onvalue => + 'XXDOCPRESENT', -offvalue => 'XXDOCABSENT', }, 'yydoc' => { -text => 'yy Doc', -onvalue => + 'YYDOCPRESENT', -offvalue => 'YYDOCABSENT', }, ); use constant COL_A_CB_ORDER => qw(a b c aspec report); use constant COL_B_CB_ORDER => qw(handbook spreadsheet dfile xxdoc yyd +oc); add_checkboxes_to_frame($checkboxes_frame_col_A, \%check_boxes, COL_A_ +CB_ORDER); add_checkboxes_to_frame($checkboxes_frame_col_B, \%check_boxes, COL_B_ +CB_ORDER); my $exit_button = $MW->Button( -text => 'Exit', -command => \&exit_button, )->pack; MainLoop(); exit; # subroutines ###################################################### sub exit_button { print map "'$_' ", grep $check_boxes{$_}{-variable} eq $check_boxes{$_}{-onvalue} +, grep defined $check_boxes{$_}{-variable}, COL_A_CB_ORDER, COL_B_CB_ORDER ; print "\n"; $MW->destroy; } sub add_checkboxes_to_frame { my ($frame, # frame into which to add checkbox subframes $hr_box_info, # info on all checkboxes @boxes, # id strings of checkboxes to add to this frame ) = @_; CHECKBOX: for my $cb_id (@boxes) { my $hr_cb = $hr_box_info->{$cb_id}; my $cb_frame = $hr_cb->{cb_frame_widget} = $frame->Frame->pack(qw(-expand 1 -fill both)); $hr_cb->{cb_label_widget} = $cb_frame->Label( -text => $hr_cb->{-text}, )->pack(qw(-side left)); $hr_cb->{cb_checkbutton_widget} = $cb_frame->Checkbutton( -onvalue => $hr_cb->{-onvalue}, -offvalue => $hr_cb->{-offvalue}, -variable => \ $hr_cb->{-variable}, # reference to value )->pack(qw(-side right)); } # end for CHECKBOX }


Give a man a fish:  <%-{-{-{-<


In reply to Re: PERL tk module handling by AnomalousMonk
in thread PERL tk module handling by michael99

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.