use strict; use Curses::UI; my $cui = new Curses::UI( -color_support => 1 ); ############################################################ #### ### Build the main Menu bar ### ## ############################################################### my @menu = ( { -label => 'File', -submenu => [ { -label => 'Exit ^Q', -value => \&e +xit_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 => "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' ); my $ModemList = $List->add("Modems", "TextViewer", -text => "Here is some text\n" . "And some more"); ############################################################## ### ### ### Key Bindings ### ############################################################### $cui->set_binding(sub {$menu->focus()}, "\cX"); $cui->set_binding( \&exit_dialog , "\cQ"); ######################################### ### Do some stuff while(1){ my $i = 1; my $text .= "$i\n"; $ModemList->text($text); $ModemList->draw(); $i++; sleep(2); } $cui->mainloop();
In reply to Simple Curses Question by vortmax
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |