Subject: | popupmenu draws listbox in wrong place when drawn in nested windows |
If you nest 2 or more windows, any popupmenu widgets drawn in those windows will have the
activated listbox appear relative to the root window, not the parent window. The attached .pl file
demonstrates the bug: the first popup works normally, the second popup is shifted left one
column, and the third popup is drawn relative to the root window and is off by a dozen columns
or more.
The attached .patch provides a fix for this behavior.
Subject: | Curses-UI-Popupmenu.pm-patch |
Message body not shown because it is not plain text.
Subject: | curses-ui-popupmenu-bug.pl |
#!/usr/bin/env perl
use strict;
use warnings;
use Curses::UI;
my $cui = new Curses::UI;
$cui->set_binding( sub { exit }, "q" );
## create first window
my $win1 = $cui->add( win1 => 'Window', -border => 1 );
$win1->add( help => 'Label', -text => "'q' to quit");
$win1->add( pop1 => 'Popupmenu',
-x => 3, -y => 3,
-border => 1,
-values => [qw(eenie meenie minie moe)],
-selected => 3 );
## create second window
my $win2 = $win1->add( win2 => 'Window',
-x => 20, -y => 10,
-width => 50, -height => 20,
-border => 1);
$win2->add( pop2 => 'Popupmenu',
-x => 4, -y => 2,
-border => 1,
-values => [qw(fee fie fo fum)],
-selected => 1 );
## create third window
my $win3 = $win2->add( win3 => 'Window',
-x => 5, -y => 5,
-width => 20,
-height => 10,
-border => 1 );
$win3->add( pop3 => 'Popupmenu',
-x => 2, -y => 2,
-border => 1,
-values => [qw(foo bar baz blech)],
-selected => 2 );
$cui->mainloop;
exit;