微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Perl GUI 未完待续

  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 }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐