home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeMastering Perl/TkSearch this book

13.18. Marking a Widget Busy and Unbusy

When a widget (or application) is busy doing uninterruptable work and doesn't want to be bothered by mere mortals, the current idiom is to change the cursor shape (to a watch, a clock, or perhaps a spinning ball) as it passes over the busy widget(s). The Tk commands Busy and Unbusy automate this task for us.

$widget->Busy(?-recurse => 1,-option => value>?);

This method configures a -cursor option for $widget and, if -recurse => 1 is specified, all its descendants. If -cursor is not specified, it defaults to watch. Additional configure options are applied to $widget only. It also adds a special tag, Busy, to the bind tags of the widgets configured, such that KeyPress, KeyRelease, ButtonPress, and ButtonRelease events are ignored (with press events generating a call to bell). It then acquires a local grab for $widget.

The state of the widgets and the grab is restored by a call to:

$widget->Unbusy;

For cursor details, see Chapter 23, "Plethora of pTk Potpourri".



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.