27 Oct 2012 00:35:57 UTC
- Distribution: Gtk2-Ex-WidgetBits
- Module version: 48
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (2330 / 50 / 0)
- KwaliteeBus factor: 1
- 42.85% Coverage
- License: open_source
- Perl: v5.8.0
- Activity24 month
- Download (136.17KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionKRYDE Kevin Rydeand 1 contributors
- Kevin Ryde
Gtk2::Ex::Statusbar::MessageUntilKey -- Statusbar message until key or button
use Gtk2::Ex::Statusbar::MessageUntilKey; Gtk2::Ex::Statusbar::MessageUntilKey->message ($statusbar, 'Hello World');
This is an easy way to display a message in a
Gtk2::Statusbar, automatically cleared when the user presses a key or mouse button. It's good for the result of a user action, cleared by the next action.
In a multi-display program (multiple
Gtk2::Gdk::Display's) the message is only cleared by a key or button from the statusbar's own display. A statusbar can be moved between displays and is cleared only by its current display.
Gtk2::Ex::Statusbar::MessageUntilKey->message ($statusbar, $message)
Gtk2::Statusbar), and setup to remove it on the next key press or button press.
If another MessageUntilKey is already displayed in
$statusbarthen it's replaced by the new
$message. The new message goes on the top of the statusbar stack, even if the old one had been buried under other things.
The MessageUntilKey setups only keep a weak reference to
$statusbar, so the mere fact there's a message displayed doesn't keep it alive.
Remove any MessageUntilKey message displayed in
$statusbar. This is what's done on the next key or button press but you can use this sooner for explicit removal. If
$statusbarhas no MessageUntilKey then
Keypresses are detected with a key snooper, and button presses with a
button-press-eventemission hook. Of course only those delivered to the program are seen, so keypresses in another program don't clear the message.
A button press in a widget without
button-press-mask(meaning something not normally clickable) doesn't reach the client program and so doesn't clear anything. This isn't ideal, but clicking an unclickable isn't really a new user action, so keeping the message may be reasonable. One possibility is to add
button-press-maskto the toplevel widget (or all relevant toplevels), even if it doesn't do anything with buttons, so the event reaches the client. Perhaps MessageUntilKey could do that itself, or try selecting on the root window to pick up button presses anywhere at all.
If a statusbar is not under a toplevel window (
Gtk2::Window) then currently it ends up treated as on the default display (
Gtk2::Gdk::Display->get_default) and MessageUntilKey cleared by a key or button from that display. Would it be better to leave an unparented statusbar alone? Of course when unparented it's not visible, so the contents aren't important until redisplayed later.
Copyright 2008, 2009, 2010, 2011, 2012 Kevin Ryde
Gtk2-Ex-WidgetBits is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Gtk2-Ex-WidgetBits is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Gtk2-Ex-WidgetBits. If not, see http://www.gnu.org/licenses/.
Module Install Instructions
To install Gtk2::Ex::WidgetBits, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Gtk2::Ex::WidgetBits
For more information on module installation, please visit the detailed CPAN module installation guide.