FAQ
I've gotta be missing something simple here.

How is it possible to store the values of multiple checkbuttons in an array?
The code below acts like I've created a single checkbutton: for example, selecting
one of ten selects all ten.


for ($x = 0; $x <= $file_counter-1; $x++) {
$win_ckbox_array[$x] =

$right2->Checkbutton(-background=>'blue',-variable=>\$ckbox_stat[\$x])->pack(pady=>2);
}


Not storing the checkbutton variable in an array works fine. That's great for one
or two checkbuttons, but that won't work in this instance.

Search Discussions

  • Nikola Janceski at Feb 6, 2002 at 8:07 pm
    for ($x = 0; $x <= $file_counter-1; $x++) {
    $win_ckbox_array[$x] =

    $right2->Checkbutton(-background=>'blue',-variable=>\$ckbox_stat[\$x])->pack
    (pady=>2);
    }

    ## you got backslash happy I think shouldn't it be:
    $right2->Checkbutton(-background=>'blue',-variable=>\$ckbox_stat[$x])->pack(
    pady=>2);

    ## -variable wants the reference to the var only

    -----Original Message-----
    From: Kurt Werth
    Sent: Wednesday, February 06, 2002 3:00 PM
    To: beginners@perl.org
    Subject: perl/tk: checkbutton value in array?



    I've gotta be missing something simple here.

    How is it possible to store the values of multiple checkbuttons in an array?
    The code below acts like I've created a single checkbutton: for example,
    selecting
    one of ten selects all ten.


    for ($x = 0; $x <= $file_counter-1; $x++) {
    $win_ckbox_array[$x] =

    $right2->Checkbutton(-background=>'blue',-variable=>\$ckbox_stat[\$x])->pack
    (pady=>2);
    }


    Not storing the checkbutton variable in an array works fine. That's great
    for one
    or two checkbuttons, but that won't work in this instance.

    --
    To unsubscribe, e-mail: beginners-unsubscribe@perl.org
    For additional commands, e-mail: beginners-help@perl.org

    ----------------------------------------------------------------------------
    --------------------
    The views and opinions expressed in this email message are the sender's
    own, and do not necessarily represent the views and opinions of Summit
    Systems Inc.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedFeb 6, '02 at 7:59p
activeFeb 6, '02 at 8:07p
posts2
users2
websiteperl.org

2 users in discussion

Kurt Werth: 1 post Nikola Janceski: 1 post

People

Translate

site design / logo © 2022 Grokbase