Perl Curses::UI

Posted by user353211 on Stack Overflow See other posts from Stack Overflow or by user353211
Published on 2010-05-28T19:36:41Z Indexed on 2010/05/28 19:42 UTC
Read the original article Hit count: 638

Filed under:
|
|

I am trying to use the library Curses:UI from http://search.cpan.org/dist/Curses-UI/ to build a UI on linux karmic.

I can create a simple user interface e.g.:

#!usr/usr/bin/perl

use strict;

use Curses;

use Curses::UI;

$ui = new Curses::UI(-color_support=>1,-clear_on_exit=>1,-intellidraw=>1);

my $window = $ui->add('window', 'Window',intellidraw=>1);

my $message = $window->add(-text=>"Hello!",-intellidraw=>1);

$window->focus();

$ui->mainloop();

Question: I need some way to communicate informatio to the UI i.e. I have a loop which will wait for message to come and change the text in window. Once this message comes a popup will be displayed. Attempt:

my $ui = new Curses::UI(-color_support=>1,-clear_on_exit=>1,-intellidraw=>1);

my $window = $ui->add('window', 'Window',intellidraw=>1);

my $message = $window->add(-text=>"Hello!",-intellidraw=>1);

pseudocode while(true) #implemented a function to wait {

popup($window->text("Hello how are you?"));

}

$window->focus();

$ui->mainloop();

Problem: The above does not work. I am given a dark screen where my message is displayed. I have read the documentation and when I relocate : $ui->mainloop() above the while loop I am given the user interface but now nothing communicates to the window.

Coincise Question: I need some way of displaying the user interface wait for inputs and display messages.

Could anyone please help me on this? Thank you!

© Stack Overflow or respective owner

Related posts about perl

Related posts about ui