Perl Curses :: UIウィンドウはすべてのウィジェットを描画しません
-
29-10-2019 - |
質問
Perlの呪い:: UIを使用して、かなりシンプルなスクリプトのUIを構築しています。しかし、私がウィンドウに追加するすべてのものが描かれているわけではありません。描画されるのは2つだけ、最初のウィジェットが追加され、フォーカスを得る最初のウィジェットが何であれ。以下のコードを実行すると、最初のTextViewerとボタンが描画されます。 2番目と3番目のTextViewers(両方のウィンドウ用)は描画されていません。私がそれらをフォーカブルにしてから、それらにタブにすると、彼らは描かれます。私は何が間違っているのですか?
#!/usr/bin/perl -w
use Curses::UI;
my $cui = new Curses::UI;
my $win = $cui->add(
'window','Window',
-border => 1,
-title => 'Test Big Window'
);
$win->add(
'test0','TextViewer',
-x => 1,
-y => 1,
-text => 'test0',
-focusable => 0
);
$win->add(
'test1','TextViewer',
-x => 1,
-y => 2,
-text => 'test1',
-focusable => 0
);
$win->add(
'test2','TextViewer',
-x => 1,
-y => 3,
-text => 'test2',
-focusable => 0
);
$win->add(
'winButtons','Buttonbox',
-x => 1,
-y => 4,
-buttons => [{-label=>'sub_window',-onpress=>sub{show_win2($win);}}]
);
sub show_win2 {
$win = shift;
my $win2 = $win->add(
'window2','Window',
-border => 1,
-title => 'Test Little Window',
-centered => 1,
-height => 20,
-width => 40
);
$win2->add(
'test3','TextViewer',
-x => 1,
-y => 1,
-text => 'test3',
-focusable => 0
);
$win2->add(
'test4','TextViewer',
-x => 1,
-y => 2,
-text => 'test4',
-focusable => 0
);
$win2->add(
'test5','TextViewer',
-x => 1,
-y => 3,
-text => 'test5',
-focusable => 0
);
my $buttons = $win2->add(
'addOutputButtons','Buttonbox',
-buttonalignment => 'right',
-bg => -1,
-fg => -1,
-y => 4,
-buttons => [{-label=>'Exit',-onpress=>sub{exit(0);}}]
);
$win2->modalfocus();
}
$cui->mainloop();
$win->modalfocus();
PS各行の前に4つのスペースを手動で追加することに加えて、そのようなコードブロックを挿入する簡単な方法はありますか?
正しい解決策はありません
所属していません StackOverflow