加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Perl GUI (未完待续)

发布时间:2020-12-15 21:02:17 所属栏目:大数据 来源:网络整理
导读:? use Win32::GUI; ? use Win32::GUI qw(CW_USEDEFAULT); ? use Win32::GUI::DIBitmap; ? use Win32::GUI::DropFiles; ? my $size = 20; ? ? $W = new Win32::GUI::Window ( ????????????? -title??? = "lis文件分析", ????????????? -pos????? = [100,100],

? use Win32::GUI;
? use Win32::GUI qw(CW_USEDEFAULT);
? use Win32::GUI::DIBitmap;
? use Win32::GUI::DropFiles;
? my $size = 20;
?
? $W = new Win32::GUI::Window (
????????????? -title??? => "lis文件分析",
????????????? -pos????? => [100,100],
????????????? -size???? => [400,400],
????????????? -name???? => "Window",
????????????? );

$W->AddTextfield(
??? -name => 'inputsize',
??? -text => 25,
??? -prompt => [ "RAM/ROM值(k):",80],
??? -pos => [10,10],
??? -size => [40,20],
??? -align => 'right',
??? -number => 1,
);

#得到当前选的那个选项
print $W->inputsize->GetLine(0),"n";
?
$W->AddLabel(
??? -name => 'chooselabel',
??? -left => 10,
??? -top? => $W->inputsize->Top()+33,
??? -text => "选择类型:"
);
?
$W->AddCombobox(
??? -name => 'tpyechoose',
??? -dropdownlist => 1,
??? -left => $W->chooselabel->Left()+ $W->chooselabel->Width()+5,
??? -top? => $W->inputsize->Top()+30,
??? -width => 60,
??? -height => 100,
);
$W->tpyechoose->Add('ROM','RAM');
$W->tpyechoose->Select(0);??
??
#得到当前选的那个选项
#print $W->tpyechoose->GetCurSel(),"n";
?? ?
?? ?
# Add a load button.
$W->AddButton (
??? -name??? => "Load",
??? -left => $W->chooselabel->Left(),
??? -top? => $W->chooselabel->Top() + $W->chooselabel->Height +30,
??? -text??? => "&Load...",
??? -default => 1,
??? -tabstop => 1,
??? -group?? => 1,??????????????????????? # You can use :
??? #-onClick => &;LoadLisFile,??????????? #? a reference sub
??? -onClick? => 'LoadLisFile',?????????? #? a string name sub
);??

sub LoadLisFile {
? # Use GetOpenFile for search a avi file
? my $file = Win32::GUI::GetOpenFileName(
?????????????????? -owner? => $Window,??????????????????? # Main window for modal dialog
?????????????????? -title? => "Open a lis file",????????? # Dialog title
?????????????????? -filter => [?????????????????????????? # Filter file
?????????????????????? 'Lis file (*.lis)' => '*.lis',
?????????????????????? 'All files' => '*.*',
??????????????????? ],
?????????????????? -directory => ".",???????????????????? # Use current directory
?????????????????? );
a
? # Have select a file ?
? if ($file) {
???? # Load file to animation control?? do what u want

????? &listfile($file);
? }
? # Or an error messagebox with error.
? elsif (Win32::GUI::CommDlgExtendedError()) {
???? Win32::GUI::MessageBox (0,"ERROR : ".Win32::GUI::CommDlgExtendedError(),
??????????????????????????? "GetOpenFileName Error");
? }
}
??

sub listfile{
?my $file = @_[0];
?
?my $value = $W->inputsize->GetLine(0)*1024;
?my $type? = $W->tpyechoose->GetCurSel();

? #省去

} ?? ? $W->Show(); ? Win32::GUI::Dialog(); ? sub Window_Terminate { -1 }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读