Dear esteemed WxPerl experts and users:
I have been trying to incorprate a validator on a TextCtrl widget, using
PlValidator (following this:
http://articles.mongueurs.net/magazines/linuxmag71.html).
(Sytem: Citrus Perl 16.2, wxWidgets 2.9.4, Windows 7 machine).
It seems that a Wx::PlValidator object returns "undef" for method GetWindow,
even if intialized correctly.
For example, if, in a frame, you have:
$text_c = Wx::TextCtrl->new($panel2, -1, q{}, wxDefaultPosition, wxDefaultSize
, wxTE_PROCESS_ENTER);
$text_v = MyValidator->new( \$var);
# and the validator package:
package MyValidator;
use strict;
use Wx;
use parent -norequire, 'Wx::PlValidator';
use Wx qw(wxOK wxICON_ERROR);
sub new { # Constructeur
my $class = shift;
my $var_r = shift; # Ref de la variable associée
my $this = $class->SUPER::new;
$this->{var_r} = $var_r; # Pour consultation ultérieure
return $this;
} # end sub new
# etc...
sub TransferToWindow {
my $this = shift;
$this->GetWindow->SetValue( ${$this->{var_r}} );
1; # Signale que tout va bien
}
This gives the error: "Can't call method "SetValue" on an undefined value
at..." etc.
In other words, it seems that calling GetWindow on a PlValidator object returns
undef?
Many TIA
Helen