my $current_focus = 0; #widget that is currently in focus ... #main window bindings $main_window->bind( ''=> \&button_press); ... #text widget class bindings (9 x 9 = 81 text widgets) $text_widget->bind($text_class, ''=> \&focus_out); $text_widget->bind($text_class, '' => \&focus_in); ... #get focus on a cell - save the widget to be processed by button_press later if a button is pressed sub focus_in { my($widget) = @_; $current_focus = $widget; #stash it away } #generate a fake focus_out on a cell when a button is pressed sub button_press { if ($current_focus ) { focus_out($current_focus); #fake a missing event } } #lose focus on a cell - update master data and redraw cell/screen sub focus_out { my($widget) = @_; my $e = $widget->XEvent; # get event object # do stuff here... $current_focus = 0; #there is no current focus right now. will create a new one... return 0; }