|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
use FVWM::Module::Toolkit qw(Tk X11::Protocol Tk::Balloon);
use FVWM::Module::Toolkit qw(Tk=804.024,catch X11::Protocol>=0.52);
There is the same syntactic sugar as in ``perl -M'', with an addition of ``>='' being fully equivalent to ``=''. The ``>='' form may look better for the user in the error message. If the required Perl class is absent, FVWM::Module::Toolkit->showMessage() is used to show the dialog and the application dies.
2) This class should be uses to implement concrete toolkit subclasses. A new toolkit subclass implementation may look like this:
package FVWM::Module::SomeToolkit;
# this automatically sets the base class and tries "use SomeToolkit;"
use FVWM::Module::Toolkit qw(base SomeToolkit);
sub showError ($$;$) {
my ($self, $error, $title) = @_;
$title ||= $self->name . " Error";
# create a dialog box using SomeToolkit widgets
SomeToolkit->Dialog(
-title => $title,
-text => $error,
-buttons => ['Close'],
);
}
sub eventLoop ($$) {
my $self = shift;
my @params = @_;
# enter the SomeToolkit event loop with hooking $self->{istream}
$self->eventLoopPrepared(@params);
fileevent($self->{istream},
read => sub {
unless ($self->processPacket($self->readPacket)) {
$self->disconnect;
$top->destroy;
}
$self->eventLoopPrepared(@params);
}
);
SomeToolkit->MainLoop;
$self->eventLoopFinished(@params);
}
This class overloads one method addDefaultErrorHandler and expects sub-classes to overload the methods showError, showMessage and showDebug to use native widgets. These 3 methods are implemented in this class, they extend the superclass versions by adding a title parameter and using an external dialog tool to show error/message.
This manual page details only those differences. For details on the API itself, see FVWM::Module.
May be good for module diagnostics or any other purpose.
May be good for module debugging or any other purpose.
May be good for module debugging or any other purpose.
Last modified on April 26, 2010