<steveco.1959@gmail.com> writes: > If I want to set a separate control (control2), I'd have to do > > sub handler { > my ($control, $event) = @_; > $control->GetParent()->{"control2"}->SetValue( Stuff ); > } > > Whereas EVT_TEXT would be: > > sub handler { > my ($parent, $event) = @_; > $parent->{"control2"}->SetValue( Stuff ); > } Yes. As I see it, EVT_TEXT applies to the widget as a whole (a child of the parent), so effectively the parent gets the event. EVT_CHAR operates within the widget itself. > I'm not sure why they are different. Are there any other impacts apart > from EVT_TEXT firing for programmatic input? EVT_CHAR does only fire > for character events and not for up-arrow and stuff, I guess. Au contraire... This is from one of my OnChar handlers: +---- snip ---- use Wx qw(:keycode); sub OnChar { my ($self, $ctl, $event) = @_; # Get key code and char, if ordinary. my $k = $event->GetKeyCode; my $c = ($k < WXK_START) ? pack("C", $k) : ""; if ( $k == WXK_UP && $self->{_cmdptr} > 0 ) { $self->PutOnHistory($ctl->GetValue); $ctl->SetValue($self->{_cmd}->[--$self->{_cmdptr}]); $ctl->SetInsertionPointEnd; } elsif ( $k == WXK_DOWN && $self->{_cmdptr} < $#{$self->{_cmd}} ) { $self->PutOnHistory($ctl->GetValue); $ctl->SetValue($self->{_cmd}->[++$self->{_cmdptr}]); $ctl->SetInsertionPointEnd; } elsif ( $k == WXK_RETURN && $event->ControlDown ) { $self->OnEdit($event); } elsif ( $k == WXK_TAB || $k == WXK_RETURN || $k >= WXK_START || $event->HasModifiers ) { # Common controls. $event->Skip; return; } else { $event->Skip; } } +---- snip ---- This only reacts to some special keys. Because of the Skip, all other characters that are input behave as usual. HTH, JohanThread Previous | Thread Next