App-SeismicUnixGui
view release on metacpan or search on metacpan
lib/App/SeismicUnixGui/misc/check_buttons.pm view on Meta::CPAN
AUTHOR: Juan Lorenzo
DATE: June 23 2017
DESCRIPTION:
Create
many empty values
and empty value-entry spaces
USED FOR:
BASED ON:
NEEDS:
=cut
=head2 private hash references
=cut
my $check_buttons = {
_first_idx => '',
_index => '',
_length => '',
_frame_href => '',
_buttons_w_aref => '',
};
=head2 sub make
make generic switches
print("check_buttons, make, frame widget hash: $$frame_aref\n");
=cut
sub make {
my ( $self, $switch_aref ) = @_;
my @button_w = ();
my ( $first, $last, $frame_aref );
my @variable;
$first = $check_buttons->{_first_idx};
$last = $check_buttons->{_length};
$frame_aref = $check_buttons->{_frame_href};
@variable = @$switch_aref;
for ( my $i = $first ; $i < $last ; $i++ ) {
# print("check_buttons,make, variable is $variable[$i]\n");
$button_w[$i] = $$frame_aref->Checkbutton(
-onvalue => $on,
-offvalue => $off,
-command => [ \&private_test, $i, \$variable[$i] ],
-variable => \$variable[$i],
-borderwidth => $var->{_no_borderwidth},
-text => '',
-selectcolor => 'green',
-activebackground => 'red',
-background => 'red',
-relief => 'flat',
);
}
$check_buttons->{_buttons_w_aref} = \@button_w;
}
# -command => [\&private_error_check_labelsNparams],
sub private_error_check_labelsNparams {
# print("check_buttons,private_error_check_labelsNparams, check button changed\n")
}
=head2
TODO
=cut
sub private_test {
my ( $check_button_index, $on_or_off_ref ) = @_;
# print("check_buttons,test selected a checkbutton\n");
# print("the current value of the button is $$on_or_off_ref -- weird\n");
# print("the current checkbutton index = $check_button_index\n");
return ();
}
=head2 sub set_index
which parameter is chosen for a program
=cut
sub set_index {
my ( $self, $index ) = @_;
$check_buttons->{_index} = $index;
# print("check_buttons,set_index:$check_buttons->{_index} \n");
return ();
}
sub set_switch {
my ( $self, $on_off_aref ) = @_;
my $variable;
my @button_w = @{ $check_buttons->{_buttons_w_aref} };
my $index = $check_buttons->{_index};
#for (my $i = $first; $i<$last; $i++) {
$variable = @$on_off_aref[$index];
# print("check_buttons,switches_on_off,variable $variable\n");
$button_w[$index]->configure( -variable => \$variable, );
#}
}
( run in 1.772 second using v1.01-cache-2.11-cpan-f56aa216473 )