objeditor(3)
NAME
Tk::ObjEditor - Tk composite widget Obj editor
SYNOPSIS
use Tk::ObjEditor;
my $editor = $mw->ObjEditor( caller => $object,
direct => [1|0],
[title=>"windows"]) ->
pack ;
DESCRIPTION
This widget provides a GUI to edit the attributes of an
object or the elements of a simple hash or array.
The editor is a Tk::ObjScanner with additional function to
edit data.
When the user double clicks (with left button) on an item,
the value of the item will be displayed in the HList.
If the value is a scalar, the scalar will be displayed in
the text window. (Which is handy if the value is a multiline string)
Use the right button of the mouse of an element to modify
its value. Depending on the context, you will also be able
to delete the element or to add a sub-element.
This may be not clear. If yes, I think that trying this
widget will be much clearer than any explanation I can
write. So run the Tk widget demo and you'll find the Obj
editor demo in the "User Contributed Demonstration" sec
tion.
Direct or undirect edit
As the constructor will pass a reference to the data
structure to be edited, the data can be edited :
- not directly
- In this case, the data structure is cloned. The widget
will edit the cloned version of the data structure.
This enable the user to cancel the edition. This means
that any reference to the internals of old data struc
ture will stay on the old datastructure and will not
be aware of the new values entered with this widget. - directly
- In this case, the data structure is not cloned. The
edition is performed on the passed reference. Any ref
erence to the internals of old data structure will be
updated on-line. The drawback is that the user cannot
cancel (or undo) the edition.
Constructor parameters
- · caller: The ref of the object or hash or array to edit
- (mandatory).
- · title: the title of the menu created by the editor
- (optionnal)
- · direct: Set to 1 if you want to perform direct edi
- tion.
CAVEATS
Like Tk::ObjScanner ObjEditor does not detect recursive
data structures. It will just keep on displaying the tree
until the user gets tired of clicking on the HList items.
AUTHOR
Dominique Dumont, Guillaume Degremont.
Copyright (c) 1997-2001 Dominique Dumont, Guillaume Degre
mont. 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
- perl(1), Tk, Tk::HList, Tk::ObjScanner