[ next ] [ prev ] [ contents ] Invitation To Ruby

Callbacks

  1: #!/usr/bin/env ruby
  2: 
  3: require 'guicallback'
  4:     
  5: gui_button = Button.new
  6: gui_button.when_pressed {
  7:   puts "Someone pressed my button"
  8: }
  9: 
 10: # ... Some time later ...
 11: gui_button.press

Output

Someone pressed my button

(see guicallback.rb Source)



[ next ] [ prev ] [ contents ] Copyright 2002 by Jim Weirich.
All rights reserved.