CPAN::Forum
Curses-UI - Notebook widget bug or my mistake ?
| Posted on Thu Feb 22 14:23:22 2007 by justice8 |
| Notebook widget bug or my mistake ? |
|
Hi,
I have a little issue with notebook widget and size which lead to loose border of it.
To illustrate this, I use demo-notebook provided with Debian package (see below).
just change
my $notebook = $main->add(
undef, 'Notebook',
-height => $main->height - 1,
);
by:
my $notebook = $main->add(
undef, 'Notebook',
#-y => 2,
-x => 5,
-height => $main->height / 2,
-width => $main->width / 2,
);
lead to display this nice notebook without vertical borders, it seems these borders come from main window borders and note notebook widget itself as they are not displayed even if just change x/y coordinates.
Anyone have a clue ?
Regards.
Initial demo-notebook code:
#!/usr/bin/perl -w
# $Id: demo-notebook,v 1.1 2004/10/22 16:37:30 mthies2s Exp $
use strict;
use File::Temp qw( :POSIX );
use lib "../lib";
# make KEY_BTAB (shift-tab) working in XTerm
# and also at the same time enable colors
#$ENV{TERM} = "xterm-vt220" if ($ENV{TERM} eq 'xterm');
my $debug = 0;
if (@ARGV and $ARGV[0] eq '-d') {
$debug = 1;
} else {
# We do not want STDERR to clutter our screen.
my $fh = tmpfile();
open STDERR, ">&fh";
}
use FindBin;
use lib "$FindBin::RealBin/../lib";
use Curses::UI;
# Create the root object and main window.
my $cui = new Curses::UI (
-clear_on_exit => 1,
-debug => $debug,
);
$cui->set_binding( sub { exit(0); } , "\cQ");
my $main = $cui->add(
undef, 'Window',
-title => 'Main Window',
);
$main->add(
undef, 'Label',
-y => $main->height - 1,
-width => $main->width,
-text => '<PageUp> / <PageDown> cycles through pages; <Ctrl>-Q exits',
-textalignment => 'middle',
-bold => 1,
);
# Create notebook and a couple of pages.
my $notebook = $main->add(
undef, 'Notebook',
-height => $main->height - 1,
);
my @quotes = (
"Forsan et haec olim meminisse iuvabit.\n(And perhaps someday it will be pleasant to remember t
+hese things.)\n\n - Vergil",
"Yankee, n: In Europe, an American.\nIn the Northern States of our Union, a New Englander.\nIn
+the Southern States the word is unknown. (See DAMYANK.)\n\n - Ambrose Bierce, \"Th
+e Devil's Dictionary\" 1911",
"I must not fear. Fear is the mind-killer. Fear is the little-death that\nbrings total oblitera
+tion. I will face my fear. I will permit it to pass\nover me and through me. And when it has gone
+past I will turn the inner\neye to see its path. Where the fear has gone there will be nothing.\nO
+nly I will remain.\n\n - Frank Herbert, \"Dune\", 1965",
"El amor es un camino que de repente aparece\ny de tanto caminarlo se te pierde.\n\n -
+Victor Jara, \"El Amor es un Camino\"",
"Who knows for what we live, and struggle, and die? ...\nWise men write many books, in words to
+o hard to understand.\nBut this, the purpose of our lives, the end of all our struggle,\nis beyond
+ all human wisdom.\n\n - Alan Paton, \"Cry, The Beloved Country\", 1948",
);
my @pages;
for (my $i = 1; $i <= 5; ++$i) {
$pages[$i] = $notebook->add_page("Page $i");
$pages[$i]->add(
undef, 'TextViewer',
-x => 1,
-y => 5,
-text => $quotes[$i-1],
);
}
$notebook->focus;
# Let user play.
$cui->mainloop;
|
| Write a response |
(4)
]