Tk::ObjEditor(3pm) | User Contributed Perl Documentation | Tk::ObjEditor(3pm) |
Tk::ObjEditor - Tk composite widget Obj editor
use Tk::ObjEditor; my $editor = $mw->ObjEditor( caller => $object, direct => [1|0], [title=>"windows"]) -> pack ;
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. The editor can be used in an autonomous way with the "edit_object" function.
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 multi-line string)
If you use the middle button and the item (either hash, array or scalar) is tied to an object , you will open the object hidden behind the tied variable.
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" section.
As the constructor will pass a reference to the data structure to be edited, the data can be edited :
Unforunately, undirect edition will break if the cloned data structure contains code reference.
This function is not exported and must be called this way:
Tk::ObjEditor::edit_object($data);
This function will load Tk and pop up an editor widget. When the user destroy the widget (with "File -" destroy> menu), the user code is resumed.
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.
ObjEditor cannot edit code reference. The module will break if you try undirect edition of data containing code references.
Dominique Dumont (ddumont at cpan.org), Guillaume Degremont.
Copyright (c) 1997-2004,2007,2014 Dominique Dumont, Guillaume Degremont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1), Tk, Tk::HList, Tk::ObjScanner
2022-12-01 | perl v5.36.0 |