【发布时间】:2010-10-05 12:44:38
【问题描述】:
我有一个对话框,我在激活事件时填充元素(标签)。 我想在停用窗口时删除这些元素(标签)。类似于:[其错误的主要代码片段,但可以解释]
my $wchRW = Win32::GUI::DialogBox->new(
-name => "wchR",
-title => "whed",
-left => CW_USEDEFAULT,
-size => [300, 130],
-parent => $mw,
);
$wchRW->AddGroupbox(
-name => "wchR_gb",
-text => "being watched",
-width => $wchRW->ScaleWidth() - $padding,
-height => 100,
-left => $padding/2,
);
sub wchR_Activate {
my $wchtxt = "sample";
# lbleft, lbtop are calculated here
$wchRW->AddLabel(
-name => "wchR_lb0",
-text => $wchTxt,
-left => $lbLeft,
-top => $lbTop,
);
}
sub gitni_wchR_Deactivate {
print "Here\n";
Win32::GUI::DestroyWindow($wchRW->wchR_lb0); #this is line n
}
#i have a button in main window $mw.
#onclick of this button this dialogbox is shown.
#sub b1_Click { $wchRW->DoModal(); return 0; }
但问题是,deactivate 中的 "Here" 被调用了很多次,然后抛出异常 [can't locate auto/wchR_.al in @INC .... line n]。冻结主窗口,唯一的选择是通过任务管理器结束进程。
请帮帮我。 为什么“这里”被打印了很多次? 如何永久删除元素? 谢谢
【问题讨论】:
标签: perl user-interface winapi win32gui