Subject: | Listbox focus broken |
The Listbox focus method occasionally fails to set '-focus' on the object. In the attached
example you can see that the listbox has the proper focus (you can change the selection), but
the display isn't being drawn correctly until you tab out of the listbox then back in.
If you uncomment the $radio->{'-focus'} = 1; line the display will draw correctly without
tabbing out of the listbox.
Subject: | cui-bug.pl |
#!/usr/bin/perl
#
use Curses::UI;
my $cui = Curses::UI->new( '-color_support' => 1);
$cui->set_binding( sub { exit; }, 'q', "\cC" );
my $win = $cui->add(
'Window1' => 'Window',
'-border' => 1,
'-y' => 1,
'-fg' => 'blue',
'-bfg' => 'green',
'-tfg' => 'green',
'-sfg' => 'green',
'-title' => 'Window 1',
);
$win->set_binding( sub { exit; }, 'q', "\cC" );
my $radio = $win->add(
'Window1.radiobox' => 'Listbox',
'-radio' => 1,
'-height' => 3,
'-values' => [ 'this', 'that', 'another' ],
'-selected' => 1,
'-y' => 3,
'-x' => 2,
);
$win->add(
'Window1.nextbutton' => 'Buttonbox',
'-buttonalignment' => 'middle',
'-padbottom' => 0,
'-buttons' => [ { '-label' => '[Next]', '-onpress' => sub { shift->parent->loose_focus; }, }, ],
'-y' => 7
);
$radio->focus();
### Why doesn't -focus get set properly? ###
# $radio->{'-focus'} = 1;
$win->onFocus( sub { $radio->focus() } );
$win->modalfocus();
$cui->delete('Window1');
exit;