HELP! Optionmenu used to work, now fails with 'no -label' 
Author Message
 HELP! Optionmenu used to work, now fails with 'no -label'

Greetings folks - I had a rather embarrassing moment this morning,
demonstrating a tool that worked on Friday. I don't think I changed
it, but... who knows.

Here's the situation. The app is a Perl/Tk frontend for a database
application. The error springs up in the second of the following two
Optionmenu declarations:

  my($om_1) = $topline->Optionmenu

     -variable=>\$event->{eventtypeid},
     -textvariable=>\$displayeventtype,
     -command => sub {
       $event->getspecnames;
     }
    )->pack(-side=>'left');

  my($om_2) = $topline->Optionmenu
    (

     -variable=>\$event->{sourceid},
     -textvariable=>\$displayfundingsource
    )->pack(-side=>'left');

As you can see, the two are largely equivalent.  The first one gets
pack()ed fine; the second one fails rather spectacularly. The error
returned is:

---Begin Error Message---
Tk::Error: Can't set -options to `ARRAY(0x3e0d7c)' for Tk::Optionmenu=HASH(0xd50
7c): No -label at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Widget.pm
 line 246
 at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Derived.pm line 290
 Tk::Derived::configure at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/
Derived.pm line 302
 Tk::Widget::new at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Widget.
pm line 194
 Tk::Widget::__ANON__ at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Wi
dget.pm line 246
 main::events_ui at events.pl line 93
 main::drawEventWindow at events.pl line 354
        Tk::Error('MainWindow=HASH(0x42f0a0)', 'Can\'t set -options to `ARRAY(0x
3e0d7c)\' for Tk::Optionmenu=HAS...', 'Tk::Derived::configure at /usr/local/lib/
perl5/site_perl/5.005/s...', 'Tk::Widget::new at /usr/local/lib/perl5/site_perl/
5.005/sun4-sol...', 'Tk::Widget::__ANON__ at /usr/local/lib/perl5/site_perl/5.00
5/sun...', 'main::events_ui at events.pl line 93', 'main::drawEventWindow at eve
nts.pl line 354') called at blib/lib/Tk.pm (autosplit into blib/lib/auto/Tk/idle
tasks.al) line 641
        eval {...} called at blib/lib/Tk.pm (autosplit into blib/lib/auto/Tk/idl
etasks.al) line 641
        Tk::idletasks('Tk::Optionmenu=HASH(0xd507c)') called at /usr/local/lib/p
erl5/site_perl/5.005/sun4-solaris/Tk.pm line 99
        Tk::BackTrace('Tk::Optionmenu=HASH(0xd507c)', 'Can\'t set -options to `A
RRAY(0x3e0d7c)\' for Tk::Optionmenu=HAS...') called at /usr/local/lib/perl5/site
_perl/5.005/sun4-solaris/Tk/Derived.pm line 302
        Tk::Derived::configure('Tk::Optionmenu=HASH(0xd507c)', '-highlightthickn
ess', 1, '-takefocus', 1, '-relief', 'raised', '-indicatoron', ...) called at /u
sr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Widget.pm line 194
        Tk::Widget::new('Tk::Optionmenu', 'Tk::Frame=HASH(0x4e1780)', '-options'
, 'ARRAY(0x3e0d7c)', '-variable', 'SCALAR(0x419960)', '-textvariable', 'SCALAR(0
x3ca7c8)') called at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Widget
.pm line 246
        Tk::Widget::__ANON__('Tk::Frame=HASH(0x4e1780)', '-options', 'ARRAY(0x3e
0d7c)', '-variable', 'SCALAR(0x419960)', '-textvariable', 'SCALAR(0x3ca7c8)') ca
lled at events.pl line 93
        main::events_ui('Tk::Frame=HASH(0x478e18)') called at events.pl line 354
        main::drawEventWindow('MainWindow=HASH(0x42f0a0)', 174) called at events
.pl line 383
Can't set -options to `ARRAY(0x3e0d7c)' for Tk::Optionmenu=HASH(0xd507c): No -la
bel at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Widget.pm line 246
 at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Derived.pm line 290

 at /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Tk/Derived.pm line 302
---End Error Message---



0  ARRAY(0x4c5cbc)
   0  ''
   1  ''
1  ARRAY(0x4f0220)
   0  'Withdrew - Leave only'
   1  43
...

...
34  ARRAY(0x4deb7c)
   0  '93/94 Block grant'
   1  34

Does anyone have ANY idea what's going on?

--
---------------------------------------------------------------------

Department of Demography    -    University of California at Berkeley
2232 Piedmont Avenue #2120  -    Berkeley, California, 94720-2120 USA
http://www.*-*-*.com/ ~aperrin --------------------------SEIU1199



Sat, 24 Aug 2002 03:00:00 GMT  
 HELP! Optionmenu used to work, now fails with 'no -label'
I wrote, earlier today:

Quote:
>... anyone have ANY idea what's going on?

Well, now I do :).  It turns out that if the display variable for an
option in an Optionmenu is undef(), the Optionmenu crashes.  That is,
the following will crash:

$foo = Optionmenu(-options=>[['zero',0],['one',1],[undef,2]]);

but the following will not:

$foo = Optionmenu(-options=>[['zero',0],['one',1],['',2]]);

I could not find this documented anywhere, but it does seem to behave
that way.

--
--------------------------------------------------------------
Andrew J. Perrin    -     UC Berkeley, Sociology & Demography
Consulting: Solaris-Linux-NT-Samba-Perl-MS Access-Postgres



Sat, 24 Aug 2002 03:00:00 GMT  
 HELP! Optionmenu used to work, now fails with 'no -label'
Andrew Perrin - Demography schrieb:

Quote:
> Greetings folks - I had a rather embarrassing moment this morning,
> demonstrating a tool that worked on Friday. I don't think I changed
> it, but... who knows.

> Here's the situation. The app is a Perl/Tk frontend for a database
> application. The error springs up in the second of the following two
> Optionmenu declarations:

>   my($om_1) = $topline->Optionmenu

>      -variable=>\$event->{eventtypeid},
>      -textvariable=>\$displayeventtype,
>      -command => sub {
>        $event->getspecnames;
>      }
>     )->pack(-side=>'left');

>   my($om_2) = $topline->Optionmenu
>     (

>      -variable=>\$event->{sourceid},
>      -textvariable=>\$displayfundingsource
>     )->pack(-side=>'left');

> As you can see, the two are largely equivalent.  The first one gets
> pack()ed fine; the second one fails rather spectacularly. The error
> returned is:

I think there is only the '-variable' option available. AFAIK the '-textvariable'
option was replaced by '-variable' in one of the last versions.
I had used '-textvariable' in my app and had to replace this option '-varaibale'.

This does not explain why the first OptionMenu worked.

Ciao, thomas.

----------------------------------------------------
Thomas Schmickl,
Department for zoology
Karl Franzens University Graz, Austria.
----------------------------------------------------
Visit the GPL e:doc-project on http://members.magnet.at/hfbuch/edoc

----------------------------------------------------



Sun, 25 Aug 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Optionmenu's -textvariable dont work

2. Labeled('Widget') - background (long)

3. Labeled('Widget')

4. HELP: Can't get debugger to work - perl can't find perl5db.pl

5. HELP: Can't get debugger to work - perl can't find perl5db.pl

6. http proxy in chroot'ed environment doesn't work - help

7. HELP: Can't get debugger to work - perl can't find perl5db.pl

8. Getting labels and values from Optionmenus

9. GDBM fails 'make test'

10. getopt('x') fails

11. Failed to execute script 'cgi-bin/news/index_home.cgi': Win32 Error Code = 87

12. GD 'make test' failing

 

 
Powered by phpBB® Forum Software