PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:
I am curretly developing a Mega-Widget that gets some additional configuration parameter. (Files from which data is parsed). The user can defined some lists of data he wants to edit with this data. When the user finished editing the data, He can click "Ok" and another routine is supposed to manipulate the data based on the user input.
To call the function for this processing outside the dialog, I need to get the settings out. However I am not sure which is the right way. I describe a couple of ways that came to mind and would like to get your comments.
The parameter way
The Data would be accesst as:sub Populate{ ... $self->ConfigSpecs( -infile => [ qw/METHOD infile INFILE]); $self->{ _configX } = []; ... }
This way seems to be a bit cumbersome to me.process( $dlg->{ _configX } );
The PASSIVE Way
The Data would be accesst as:sub Populate{ ... $self->ConfigSpecs( -infile => [ qw/METHOD infile INFILE], -configx => [ qw/PASSIVE configx CONFIGX] ); ... }
This is slightly more "Tk"-Like to me but it fails if the user does not pass a -configx argument.$config = []; $dlg->configure( -configx => $config ); process( $dlg->cget( "-configx" ) );
The METHOD Way
The Data would be accesst as:sub Populate{ ... $self->ConfigSpecs( -infile => [ qw/METHOD infile INFILE], -configx => [ qw/METHOD configx CONFIGX] ); $self->{ _configX } = []; ... } sub configx { # get configX on configure; # return configX on cget; }
This overcomes the problem of setting the variable, but the user never ever really needs to set configX it just comes out it should always start being empty. I am really looking for a way to get data out of a dialog but not at any point in there.$config = []; $dlg->configure( -configx => $config ); process( $dlg->cget( "-configx" ) );
I appreciate all comments on the above listings. People that point me to good widgets I could use as a read for now or other suggestions.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TK Mega Widget and User Edit
by zentara (Cardinal) on Jun 30, 2005 at 12:14 UTC |