1
我有一個對話框,我在激活事件中填充元素(標籤)。 我想在窗口停用時刪除這些元素(標籤)。像:它的主要錯誤代碼片段,但解釋]perl win32 :: gui刪除元素
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; }
但問題是,「在這裏」中停用多次調用和異常拋出之後[無法找到自動/ wchR_.al在@INC .... line n]中。凍結主窗口,唯一的選擇是通過任務管理器結束進程。
請幫我一把。 爲什麼「這裏」被多次打印? 如何永久移除元素? 謝謝