Skip Menu |
 

This queue is for tickets about the Curses-UI CPAN distribution.

Report information
The Basics
Id: 27034
Status: open
Priority: 0/
Queue: Curses-UI

People
Owner: Nobody in particular
Requestors: john [...] nixnuts.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.95
Fixed in: (no value)



Subject: Listbox focus broken
Download (untitled) / with headers
text/plain 394b
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
Download cui-bug.pl
text/x-perl 1k
#!/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;
... 11 years later, I got the same problem. No maintainer there for this greate module?
Subject: This fixes this issue
Download (untitled) / with headers
text/plain 837b
root@wawicwdev:/opt/server# diff -U 5 /usr/local/share/perl/5.24.1/Curses/UI/Container.pm.org /usr/local/share/perl/5.24.1/Curses/UI/Container.pm --- /usr/local/share/perl/5.24.1/Curses/UI/Container.pm.org 2018-05-16 20:07:52.262476330 +0200 +++ /usr/local/share/perl/5.24.1/Curses/UI/Container.pm 2018-05-16 20:08:04.654679126 +0200 @@ -409,11 +409,11 @@ } } # Change the draworder if a focusable objects was found. - if ($forced or defined $new_obj and $new_obj ne $cur_obj) + if ($forced or ((defined $new_obj) and (($new_obj ne $cur_obj) or (!$new_obj->{-focus})))) { my $idx = $this->draworder_id2idx($new_id); my $move = splice(@{$this->{-draworder}}, $idx, 1); push @{$this->{-draworder}}, $move; root@wawicwdev:/opt/server#


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.