我遇到了一个我相信 Perl/Tk 804.027 Text Widget 的错误(使用Scrollable('ROText')
)。当我添加一个全选标签并应用配置更改以向右对齐时,滚动条不会显示。如果我注释掉我向右对齐的 tagConfigure,滚动条就会回来。
有没有人有一种解决方法或修复方法来正确证明文本小部件的内容(包括文本和嵌入式条目小部件)并且仍然具有功能性水平滚动条?
(更新)
这是一个将重现该问题的示例脚本:
use Tk;
$mw = MainWindow->new;
$mw->title("Testing");
$mw->geometry();
$pw = $mw->Scrolled('Panedwindow',-showhandle=>0, -sashwidth=>0, -sashpad=>0, -scrollbars=>'e');
$pw->pack(qw/-side top -expand yes -fill both -pady 2 -padx 2m/);
$t1 = $pw->Scrolled("Text", -scrollbars => 'os', -bg=>"red", -width => 40, -wrap => "none", -relief=>"flat");
$t2 = $pw->Scrolled("Text", -scrollbars => 'os', -bg=>"blue", -width => 20, -wrap => "none", -relief=>"flat");
$pw->add($t1,$t2);
# this loop is only to demonstrate the second problem: vertical scrolling
# on parent widget not working
foreach my $ct (1..50) {
$t1->insert("end","abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef-abcdef\n");
}
$t1->tagAdd("content", '1.0', 'end');
# this is the justify right & loose horizontal scrolling problem:
# change the justify from left to right and the scrollbars will not show up
$t1->tagConfigure("content", -justify=>"left");
MainLoop;
对于我的应用程序来说,我遇到的问题实际上是双重的,并且在上面的示例中都证明它们都不起作用:
- 我需要窗格的左侧水平滚动和右对齐
- 我需要 Paned Window 小部件(两个窗格的父级)可以垂直滚动(左右窗格一起滚动)。