I got it to work using Curses::UI::POE, here the (slight) rewrite:
#!/usr/bin/perl use Curses::UI::POE; my $ModemList; sub init_cui { my ($cui) = @_; ############################################################ ### ### Build the main Menu bar ### ############################################################ my @menu = ( { -label => 'File', -submenu => [ { -label => 'Exit ^Q', -value => \&exit_dialog } ] }, ); my $menu = $cui->add('menu','Menubar', -menu => \@menu, -fg => "black", ); ########################################################## ## ## Define base layout of windows ## ########################################################## my $width = $cui->width() / 2; my $hist_height = ($cui->height() )/2 ; ########################################################### ### RX Power Spectrum my $rxSpec = $cui->add( 'rxSpec', 'Window', -border => 1, -bfg => 'red', -width => $width, -y => 1, -height => $hist_height ); my $rxHistogram = $rxSpec->add("RxHisto", "TextViewer", -text => "Here is some text\n" . "And some more"); ########################################################### ### TX Power Spectrum my $txSpec = $cui->add( 'txSpec', 'Window', -border => 1, -y => $hist_height + 1, -width => $width, -bfg => 'red' ); my $TxHistogram = $txSpec->add("TxHisto", "TextViewer", -text => "Here is some text\n" . "And some more"); ########################################################### ### List of active modems my $List = $cui->add( 'List', 'Window', -border => 1, -y => 1, -x => $width, -width => $width, -bfg => 'red' ); $ModemList = $List->add("Modems", "TextViewer", -text => "Here is some text\n" . "And some more"); 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; } ############################################################## ### ### Key Bindings ### ############################################################### $cui->set_binding(sub {$menu->focus()}, "\cX"); $cui->set_binding( \&exit_dialog , "\cQ"); } ######################################### ### Do some stuff my $i = 1; my $cui = new Curses::UI::POE -color_support => 1, inline_states => { _start => sub { &init_cui( $_[HEAP] ); $_[KERNEL]->delay( timer1 => 2, 0 ); }, timer1 => sub { my $text .= "$i\n"; $ModemList->text($text); $ModemList->draw(); $i++; $_[KERNEL]->delay( timer1 => 2, $_[ARG0] + 1 ); }, }; $cui->mainloop;
Cheers

In reply to Re: Simple Curses Question by observer111
in thread Simple Curses Question by vortmax

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.