ruby-****@sourc*****
ruby-****@sourc*****
2003年 8月 16日 (土) 02:54:14 JST
------------------------- REMOTE_ADDR = 217.117.54.155 REMOTE_HOST = URL = http://ruby-gnome2.sourceforge.jp/?tut-gtk2-events ------------------------- = Events In addition to the above signal mechanism, events from the X Window Server are also reflected in GTK. Here is an exhaustive list of catchable events: * event * button_press_event * button_release_event * scroll_event * motion_notify_event * delete_event * destroy_event * expose_event * key_press_event * key_release_event * enter_notify_event * leave_notify_event * configure_event * focus_in_event * focus_out_event * map_event * unmap_event * property_notify_event * selection_clear_event * selection_request_event * selection_notify_event * proximity_in_event * proximity_out_event * visibility_notify_event * client_event * no_expose_event * window_state_event You can connect some code to a specific X11 event exactly in the same way as we saw previously with GTK signals. Just provide one of the above mentioned "event name" instead of "signal name": GLib::Instantiatable#signal_connect("event name") do # Code to execute upon reception of "event name". end The callback code can accept 2 parameters, as follows: GLib::Instantiatable#signal_connect("event name") do |w, e| # ... end (in this case, w will refer the widget, and e the event). Depending of the return value of the block code, GTK will decide if the event should be spread or not: * if true, GTK will stop the event processing here; * if false, GTK will continue to propagate the event [xxx explain more] Also, GDK selections and drag-and-drop issue several events, but these are reflected by GTK signals: * selection_received * selection_get * drag_begin_event * drag_end_event * drag_data_delete * drag_motion * drag_drop * drag_data_get * drag_data_received