【发布时间】:2012-12-21 12:27:07
【问题描述】:
我在内部接手了一个 Perl TK 项目。我想知道您如何为使用 BrowseEntry 库的组合框设置默认值。
这是组合框的构造方式。
$tm->ComboBox(
-variable => \$invoice_per_country,
-font => $main::UserPref->{'ListFont'},
-background => 'white',
-relief => 'groove',
-width => 40,
-takefocus => 1,
-listwidth => 60,
-listheight => scalar @invoice_countries,
-forcematch => '',
-options => [ @invoice_countries ],
-buttontakefocus => 0,
-disabledforeground => 'black',
-disabledbackground => 'white'
)
->pack(-side => 'left',
-anchor => 'nw');
invoice_countries 包含两个值:('Canada', 'United States')。
我想知道如何在不切换值顺序的情况下将美国设为默认值(我们将添加更多国家/地区)。
【问题讨论】:
-
它应该反映 $invoice_per_country 中的任何值,只需在打包之前将其设置为“美国”。
-
感谢查尔斯成功了。就在它上面涂上光泽。由于您将其作为评论留下,因此不确定我如何接受您的回答。