[fxruby-users] removeTimeout in a timeout handler

dave L dglnz at yahoo.com
Sat Sep 4 17:56:46 EDT 2010


From: Ralph Shnelvar <ralphs at dos32.com>

To: fxruby-users at rubyforge.org
Sent: Sat, 4 September, 2010 12:57:39 AM
Subject: [fxruby-users] removeTimeout in a timeout handler

removeTimeout in a timeout handler  
I have
    timeout_ = @app.addTimeout(milliseconds, method_, :repeat => true)


My analysis shows that
  removeTimeout(timeout_)
does not seem to work inside of the method_.  In other words, you can't remove a 
repeating timeout inside a timeout.

Could someone confirm, please.

I have worked around this problem by schedule a chore to remove the timeout ... 
but that seems ugly.  Anyone have a better solution?

in code I have this when a user presses a set of keys (escape key lets say)


do it's a test on @timer

Keypress method handler

case pressed

  when 65535, 65307, 65360 , 65365..65367, 65379 # Page Up, Page Down Home, End, 
Insert, Delete and Escape

    if @timer == false
      $fxapp.addTimeout(2000*12, :repeat => true) do |sender, sel, data|
    else

      $fxapp.removeTimeout(@timeout)
     @timer = false

    end


end

Well that's how I handle it

HTH.



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20100904/2d131e45/attachment.html>


More information about the fxruby-users mailing list