Tk::ObjEditorDialog - Tk composite widget obj editor popup dialog


Tk-ObjEditor documentation Contained in the Tk-ObjEditor distribution.

Index


Code Index:

NAME

Top

Tk::ObjEditorDialog - Tk composite widget obj editor popup dialog

SYNOPSIS

Top

  use Tk::ObjEditorDialog;

  my $editor = $mw->ObjEditorDialog( caller => $object, 
                                      direct => [1|0],
                                      [title=>"windows"]) ;

  $editor -> Show;

DESCRIPTION

Top

This widget is a ObjEditor within a DialogBox widget. I.e. it will appear in its own toplevel window when you invoke the Show() method like the FileDialog widget.

Constructor parameters

Top

Method

Top

Show(grab)

As in Tk::DialogBox, this method displays the dialog box, until user invokes one of the buttons in the bottom frame. If the grab type is specified in grab, then Show uses that grab; otherwise it uses a local grab. Returns the name of the button invoked.

CAVEATS

Top

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

Top

Dominique Dumont.

Copyright (c) 2001 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

Top

perl(1), Tk, Tk::HList, Tk::ObjScanner, Tk::ObjEditor, Tk::DialogBox


Tk-ObjEditor documentation Contained in the Tk-ObjEditor distribution.

package Tk::ObjEditorDialog;

use strict;

use Carp ;
use Tk::ObjEditor;

use vars qw/$VERSION @ISA/;

#use Storable qw(dclone);

use base  qw(Tk::Derived Tk::DialogBox);
*isa = \&UNIVERSAL::isa;

$VERSION = sprintf "%d.%03d", q$Revision: 1.1.1.1 $ =~ /(\d+)\.(\d+)/;

Tk::Widget->Construct('ObjEditorDialog');

sub Populate
  {
    my ($cw,$args) = @_ ;

    my $data  = delete $args->{'caller'} || delete $args->{'-caller'};
    $cw->{direct} = delete $args->{'direct'} || delete $args->{'-direct'} || 0;

    # need to add different button for clone ????
    my $buttons = $cw->{direct} ?  ['done'] : [qw/OK cancel/] ;

    $args->{-buttons} =  $buttons;

    $cw->SUPER::Populate($args) ;

    $cw->add('ObjEditor', caller => $data, -direct => $cw->{direct})->pack ;

    return $cw ;
  }

sub Show
  {
    my $cw=shift;

    my $hit = $cw->SUPER::Show(@_);
    
    if ($hit eq 'OK')
      {
        # no direct edit
        return $cw->Subwidget("objeditor")->get_data();
      }
    else
      {
        return $cw->Subwidget("objeditor")->get_orig_data();
      }
  }