http://search.cpan.org/src/MBARBON/Wx-0.98/t/05_timer.t
#!/usr/bin/perl -w use strict; use Wx; use lib './t'; use Test::More Wx::wxMAC() ? ( 'skip_all' => 'Hangs on wxMac' ) : ( 'tests' => 2 ); use Tests_Helper qw(test_app); # test with Notify package MyTimer; use vars qw(@ISA); @ISA = qw(Wx::Timer); sub Notify { main::ok( 1, "Overriding Notify works" ); } package main; # test with owner package MyHandler; use base qw(Wx::EvtHandler); use Wx::Event qw(EVT_TIMER); sub new { my $class = shift; my $this = $class->SUPER::new( @_ ); EVT_TIMER( $this, -1, \&OnTimer ); return $this; } sub OnTimer { main::ok( 1, "EVT_TIMER works" ); my $frame = Wx::wxTheApp()->GetTopWindow; $frame->{T1}->Destroy; $frame->{T2}->Destroy; $frame->Destroy; Wx::WakeUpIdle; } package MyFrame; use base qw(Wx::Frame); sub new { my $class = shift; my $this = $class->SUPER::new( @_ ); my $timer2 = Wx::Timer->new( MyHandler->new ); $timer2->Start( 800, 1 ); my $timer1 = MyTimer->new; $timer1->Start( 100, 1 ); $this->{T1} = $timer1; $this->{T2} = $timer2; return $this; } package main; my $app = test_app( sub { MyFrame->new( undef, -1, 'boo' )->Show( 1 ); } ); $app->MainLoop; # Local variables: # # mode: cperl # # End: #

In reply to Re: Wx Event timer by Anonymous Monk
in thread Wx Event timer by PyrexKidd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.