IUP - Timer

回复
头像
523066680
Administrator
Administrator
帖子: 573
注册时间: 2016年07月19日 12:14
联系:

IUP - Timer

帖子 523066680 »

use utf8; use IUP ':all'; use Date::Format; use Time::HiRes qw/gettimeofday/; STDOUT->autoflush(1); my @label; my @timer; for my $id ( 0 .. 2 ) { $label[$id] = IUP::Label->new( TITLE => "", FONT => "Microsoft YaHei", FONTSIZE=>"18", EXPAND => "HORIZONTAL", ); $timer[$id] = IUP::Timer->new( TIME => 100,# + $id*100, RUN => "YES", ACTION_CB => sub { my $msec = sprintf "%03d", int((gettimeofday)[1]/1000); $label[$id]->TITLE( time2str("%c ", time()) .$msec ); } ); } my $bt_change = IUP::Button->new( TITLE => "Change", BUTTON_CB => sub { # 要使修改的时间间隔生效,必须先暂停 timer $timer[1]->RUN("NO"); $timer[1]->TIME("500"); $timer[1]->RUN("YES"); } ); my $dlg = IUP::Dialog->new( child => IUP::Vbox->new( child => [@label, $bt_change] ), TITLE => "IupTimer", SIZE => "300x100", ); $dlg->Show(); IUP->MainLoop;
回复

在线用户

正浏览此版面之用户: 没有注册用户 和 1 访客