[mplspm]: Perl::Tk::Optionmenu question
Troy Johnson
troy.johnson at myrealbox.com
Tue Apr 30 14:35:07 CDT 2002
Greetings Perl Mongers!
I have a Tk widget that fails for some reason. I think it may be because
'grep' doesn't return a nice list or something, I am not sure.
The code that is commented out does not work, the uncommented code does
work.
The uncommented code does (and should) come up with two slightly
different lists, which I don't want. The "-command" code and the
commented out "-options" code should do the same thing (only at
different times), but the commented out "-options" code causes the
widget to die in mid-creation ("Not a Tk object") when it is used.
Can you not use the list output of 'grep' like this, send a reference to
'grep's output to a subroutine, I mean? Is there an obvious error here I
am missing here?
Thanks in advance for any time spent,
Troy
>>>>>START>>>>>
$undpathlabvalueopt = $sortframe->Optionmenu(
-command => sub
{
@UndeleteList =
sort
{
comparehr($sortfield, $sortorder)
}
@FSData::Missing;
my @undplaboptions =
grep
{
defined $_->{'deleterecord'}
and $_->{'deleterecord'}
}
@UndeleteList;
$undpathlabvalueopt->configure
(
-options =>
[
&unique_values(\@undplaboptions,
'pathlab'),
''
]
);
},
-options =>
[
&unique_values(\@FSData::Missing, 'pathlab'),
''
],
#-options =>
#[
# &unique_values
# (
# [
# grep
# {
# defined $_->{'deleterecord'}
# and $_->{'deleterecord'}
# }
# @FSData::Missing
# ],
# 'pathlab'
# ),
# ''
#],
-variable => \$pathlabvalue,
)->pack();
<<<<<<END<<<<<<
--------------------------------------------------
Minneapolis Perl Mongers mailing list
To unsubscribe, send mail to majordomo at pm.org
with "unsubscribe mpls" in the body of the message.
More information about the Mpls-pm
mailing list