The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Puppet::Show - Optional Tk Gui for Puppet::Body

SYNOPSIS

 use Puppet::Show ;

 package myClass ;

 sub new
  {
    my $type = shift ;
    my $self = {};
    
    # no inheritance, your class contains the Puppet::Show class
    $self->{body} = new Puppet::Show(cloth => $self, @_) ;

    bless $self,$type ;
  }

 package main;

 my $mw = MainWindow-> new ;

 # these 2 parameters are passed to Puppet::Show constructor
 my $test = new MyTest( name => 'foo', 'topTk' => $mw) ;

 $test->display;

 MainLoop ; # Tk's

DESCRIPTION

Puppet::Show is a utility class that is used (and not inherited like the deprecated Puppet::Any) to manage a Puppet::Body class through an optional GUI.

So when you construct a Puppet::Show object, you have all the functionnality of this object without the GUI. Then, when the need arises, you may (or the user class may decide to) open the GUI of Puppet::Show so the user may perform any interactive action.

On the other hand, if the need does not arise, you may instanciate a lot of objects (which uses Puppet::Show) without cluttering your display.

The user class may use the Puppet::Show Tk widget (actually a Tk::Multi::Toplevel widget) and add its own widget to customize the GUI to its needs.

This class features :

  • A Tk::Multi::Toplevel to show or hide the different display of the Show class (or of the user class)

  • A menu bar (part of Tk::Multi::Toplevel)

  • An online help (part of Tk::Multi::Toplevel)

  • An event log display so user object may log their activity (See Puppet::Log)

  • A Debug log display so user objects may log their "accidental" activities (See Puppet::Log)

  • An Object Scanner (See Tk::ObjScanner) to display the attributes of the user object

  • A set of functions to manage "has-a" relationship between Puppet objects. (See Puppet::Body). The menu bar feature a "content" bar which enabled the user to open the display of all "contained" objects.

  • A facility to store data on a database file tied to a hash. (part of Puppet::Body)

DEFAULT WINDOWS

debug log window

This log window (see Puppet::Log) will get all debug information for this instance of the object. More or less reserved for developers of classes using Puppet::Show.

Note that log sent to the 'event' window will also be displayed in the debug window for better clarity.

event log window

This log window (see Puppet::Log) will get all event information for this instance of the object.

Constructor

new( ... )

Creates new Puppet::Show object. The constructor uses all "Constructor" in Puppet::Body parameters plus:

topTk

The ref of the main Tk window

podName

The name of the pod file that will be used for the online help. (See Tk::Pod)

podSection

The name of the pod section that will be used for the online help

Methods

acquire(...)

Acquire the object ref as a child. Parameters are:

  • body: Reference of the Puppet::Body object that is to be acquired.

  • raise: Sub reference or method to call on the user object when the object is raised (generally through the 'content' menu). (Default to call display on the user object)

  • myRaise: Sub reference or method to call when this object is raised (generally through the 'container' menu). (Default to call $self->display())

For instance if object foo acquires object bar, bar becomes part of foo's content and foo is one of the container of bar.

display(...)

Creates a top level display for the user object.

Parameters are:

  • master: Optional. You can set it to 1 if this object will be the master object of your application. In this case, destroying its display (with the File->close menu for instance) will make the application exit.

  • onDestroy: sub ref to call back when the display is destroyed.

Return the Tk::Multi::Toplevel object if a display is actually created, undef otherwise (i.e is the display already exists).

myDisplay()

Return the Tk::Multi::Toplevel object created by the display method.

closeDisplay()

Close the display. Note that the display can be re-created later.

About Puppet body classes

Puppet classes are a set of utility classes which can be used by any object. If you use directly the Puppet::*Body class, you get the plain functionnality. And if you use the Puppet::* class, you can get the same functionnality and a Tk Gui to manage it.

AUTHOR

Dominique Dumont, Dominique_Dumont@grenoble.hp.com

Copyright (c) 1998-1999 Dominique Dumont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Tk(3), Puppet::Log(3), Puppet::LogBody(3), Puppet::Body(3), Tk::Multi::Toplevel(3), Tk::Multi::Manager(3)