Hi,

I need to create a modal dialog window with a few fields and after closing it, I need to return the values of those fields to the parent window.

Please tell me which is the recommended way to do that. I've tried a few ways, but none of them looks clean.

If I need to do what I said, do I need to use global variables like

$main::var
or
$myapp->{var}


If it is possible, I would like to be able to not use them, because the program would need too many and it will be hard to understand it after a time.

I've tried something like:

package MyApp::Main;

use MyApp::Main::Dialog;
use base 'Wx::Frame';

sub new {
my ($class, $parent) = @_
my $self = $class->SUPER::new($parent, ...);

$self->{dialog} = MyApp::Main::Dialog->new($self);
$self->{dialog}->ShowModal();

# Here I want to access the values from the fields from the closed dialog
}

I have also tried to store the code that creates the dialog in MyApp::Main, but the event handler which is executed when pressing the "Ok" button of the dialog gets the $self which is the instance of the dialog, and not the Main form, so I can't use it to store the variables I need.

I'm pretty confused.
Please tell me which do you think it is the cleanest way to do that.

Thank you.

Octavian

Reply via email to