Hello fellow monks,
I'm following Curses::UI::Tutorial on CPAN with the following code:
#!/usr/bin/env perl
use strict;
use Curses::UI;
my $cui = new Curses::UI( -color_support => 1 );
my @menus = (
{
-label => 'File',
-submenu => [
{ -label => 'Exit', -value => \&exit_dialog }
]
}
);
sub exit_dialog {
my $ret = $cui->dialog(
-message => "Quit?",
-title => "Quit",
-buttons => [ 'yes', 'no' ]
);
exit(0) if $ret;
}
my $menu = $cui->add(
'menu', 'Menubar',
-menu => \@menus,
);
my $win1 = $cui->add(
'win1', 'Window',
-border => 0,
-y => 1
);
my $texteditor = $win1->add(
'text', 'TextEditor',
-text => "Line1\n"."Line2\n"
);
$cui->set_binding(sub { $menu->focus() }, "\cx");
$cui->set_binding( \&exit_dialog, "\cq");
$texteditor->focus();
$cui->mainloop();
The menubar will loose its focus when it receives an escape keystroke. When I run the program, it takes a full second to respond. According to ncurses(3), the default delay for escape keystroke is 1000ms and could be changed by ESCDELAY variable or c function set_escdelay(3X). However, I didn't see any method/function corresponding to set_escdelay in the CPAN documentation.
Is there any method, other than to change ESCDELAY, to change the escape keystroke delay?
Feel free to correct any of my mistakes. Thanks in advance.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.