Hi Perlers,

I've run into a bug in Curses::UI that means I have to abandon it if I can't find a solution. I've got an entry mask and I'm enforcing some rules, such as that particular fields may not be left empty. I'm using "-onblur" on TextEntry widgets to call a function which checks validity, and if the content is invalid:
1) calls "$root->dialog()" to notify the user and
2) sets focus back to the widget that was just left.

This works fine if the following widget is another TextEntry, but if the next is a Popupmenu widget, the Popupmenu widget gets highlighted, while the actual focus is still in the TextEntry widget, but with no cursor. This is totally misleading for a user and unacceptable.

The mainainer doesn't return emails. Does anyone have any suggestions? I include a reproducer below.

cheers,

Munichunixguy

#!/usr/bin/perl use Curses::UI; my $Cui = new Curses::UI ( -color_support => 1, -clear_on_exit => 1, -debug => 0, ); my $win = $Cui->add('win', 'Window', -title => 'Title', -border => 1,) +; #------------------------------------------------------ # username #------------------------------------------------------ $win->add('unlab', 'Label', -x => 0, -y => 1, -text => 'Username', -bold => 1, -bg => 'blue'); $win->add('unte', 'TextEntry', -x => 10, -y => 1, -width => 10, # add a binding to reset focus to pwte if field is empty -onblur => \&check_username); #------------------------------------------------------ # type #------------------------------------------------------ $win->add('tylab', 'Label', -x => 25, -y => 1, -text => 'Type', -bold => 1, -bg => 'blue'); $win->add('typom', 'Popupmenu', -x => 30, -y => 1, -values => [ 1, 2, 3 ], -labels => { 1 => 'one', 2 => 'two', 3 => 'three' }, -width => 7, ); #------------------------------------------------------ # password #------------------------------------------------------ $win->add('pwlab', 'Label', -x => 40, -y => 1, -text => 'Password', -bold => 1, -bg => 'blue'); $win->add('pwte', 'TextEntry', -x => 50, -y => 1, -width => 10); # add a binding to quit $win->set_binding( sub { exit; }, "\cQ"); $Cui->mainloop; # subs sub check_username { my $this = shift; if (!length($this->get)) { $this->root->dialog( -message => 'Username cannot be empty', -title => 'Error', ); $this->focus; return; } }

In reply to is Curses::UI hopelessly broken? by munichunixguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.