.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Tk::ObjEditor 3pm" .TH Tk::ObjEditor 3pm "2023-11-01" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Tk::ObjEditor \- Tk composite widget Obj editor .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Tk::ObjEditor; \& \& my $editor = $mw\->ObjEditor( caller => $object, \& direct => [1|0], \& [title=>"windows"]) \-> pack ; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This widget provides a \s-1GUI\s0 to edit the attributes of an object or the elements of a simple hash or array. .PP The editor is a Tk::ObjScanner with additional function to edit data. The editor can be used in an autonomous way with the \&\f(CW\*(C`edit_object\*(C'\fR function. .PP When the user double clicks (with left button) on an item, the value of the item will be displayed in the HList. .PP 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) .PP 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. .PP 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. .PP 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 \*(L"User Contributed Demonstration\*(R" section. .SH "Direct or undirect edit" .IX Header "Direct or undirect edit" As the constructor will pass a reference to the data structure to be edited, the data can be edited : .IP "not directly" 4 .IX Item "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 structure will stay on the old datastructure and will not be aware of the new values entered with this widget. .Sp Unforunately, undirect edition will break if the cloned data structure contains code reference. .IP "directly" 4 .IX Item "directly" In this case, the data structure is not cloned. The edition is performed on the passed reference. Any reference to the internals of old data structure will be updated on-line. The drawback is that the user cannot cancel (or undo) the edition. .SH "Constructor parameters" .IX Header "Constructor parameters" .IP "\(bu" 4 \&\-caller: The ref of the object or hash or array to edit (mandatory). .IP "\(bu" 4 \&\-title: the title of the menu created by the editor (optional) .IP "\(bu" 4 \&\-direct: Set to 1 if you want to perform direct edition. .SH "Autonomous widget" .IX Header "Autonomous widget" .SS "edit_object( data )" .IX Subsection "edit_object( data )" This function is not exported and must be called this way: .PP .Vb 1 \& Tk::ObjEditor::edit_object($data); .Ve .PP This function will load Tk and pop up an editor widget. When the user destroy the widget (with \f(CW\*(C`File \-\*(C'\fR destroy> menu), the user code is resumed. .SH "CAVEATS" .IX Header "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. .PP ObjEditor cannot edit code reference. The module will break if you try undirect edition of data containing code references. .SH "AUTHOR" .IX Header "AUTHOR" Dominique Dumont (ddumont at cpan.org), Guillaume Degremont. .SH "LICENSE" .IX Header "LICENSE" 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. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBperl\fR\|(1), Tk, Tk::HList, Tk::ObjScanner