Hi all,

I am trying to build a text-based interface for a Perl program.

I discovered Curses::UI on CPAN, which looks very handy. I tried http://search.cpan.org/~mdxi/Curses-UI-0.9605/lib/Curses/UI/Tutorial.pod and encountered some problems.

My cui and window are displayed correctly, but I'm unable to use any keyboard key, for example to quit the application.

In used the set_binding() method to define key, but I still cannot interact with the application.

I wonder if I made a mistake, or if this module is compatible with Win32.

Here is the short code I tried:

#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use Curses::UI; my $cui = new Curses::UI( -color_support => 1 ); my @menu = ( { -label => 'File', -submenu => [ { -label => 'Exit ^Q', -value => \&exit_dialog } ] }, ); sub exit_dialog() { my $return = $cui->dialog( -message => "Do you really want to quit?", -title => "Are you sure???", -buttons => ['yes', 'no'], ); exit(0) if $return; } my $menu = $cui->add( 'menu','Menubar', -menu => \@menu, -fg => "blue", ); my $win1 = $cui->add( 'win1', 'Window', -border => 1, -y => 1, -bfg => 'red', ); my $texteditor = $win1->add("text", "TextEditor", -text => "Here is some text\n" . "And some more"); $cui->set_binding(sub {$menu->focus()}, "\cX"); $cui->set_binding( \&exit_dialog , "\cQ"); $texteditor->focus(); $cui->mainloop();

Has anybody got some documentation about Curses::UI? I tried CPAN but I never managed to interact with any Curses app.

How do you bind key with Curses::UI? :)

Thank you in advance for any help,

Cheers from France.

asphyx/Logofactory^Coolphat^Superior Art Creations^ACiD Productions^Remorse^The Loop http://www.asphyx.fr

In reply to Curses::UI binding problem on Perl v5.8.8 built for MSWin32-x86-multi-thread by asphyx

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.