我在Perl/tk804.027文本小部件(使用
Scrollable('ROText')
是否有人有一个解决方法或修复程序能够右对齐文本小部件的内容(包括文本和嵌入的条目小部件)和仍然有功能的水平滚动条?
(更新)
下面是一个将重现问题的示例脚本:
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;
对于我的应用程序,我遇到的问题实际上有两个方面,在上面的示例中,这两个问题都被证明不起作用:
-
可水平向右滚动
正当的
-
小部件(两个窗格的父级)
左右窗格一起滚动
一起)。