Ritesh
unread,Sep 29, 2009, 6:46:38 PM9/29/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to curses-ui
Hi all,
It would be nice if we could have formatted text (bold, underline,
etc) in the TextViewer just as we do in Label, Listbox, etc.
Wondering if I could achieve that using shell escape codes as we do
for the shell prompt, I tried the following:
use constant {
txt_boldO => "\033[1m",
txt_boldC => "\033[22m",
txt_italicO => "\033[4m",
txt_italicC => "\033[24m",
};
my $msg = "The application has encountered an error " .
"You can either try again, or send an automated email message to " .
"Support via the ".txt_boldO." Email Support ".txt_boldC." option " .
"under the ".txt_boldO." Help ".txt_boldC." Menu.";
my $tv_info = $win_info->add(
'tv_info', 'TextViewer',
-title => "Information",
-height => 6,
-x => 0,
-width => 55,
-border => 1,
-bfg => 'red',
-wrapping => 1,
-vscrollbar => 'right',
-text => $msg,
);
However, instead of making the enclosed text bold, the escape codes
are appearing verbatim. I'm using Mac OS X terminal with TERM set to
xterm-color.
Also, hitting the Tab key is not doing the expected action, that is to
move focus to the widget that was added after the current widget to
the top level $cui. However, the Tab key is working correctly in the
example scripts that are bundled with the Curses::UI distribution. So
that rules out the possibility that the problem is due to the
terminal. The level of nesting in my application is as follows: $cui->
$window->$widget where $widget is one of TextViewer, Radiobox, etc.
Help much appreciated,
Ritesh