|
From: Mattia B. <mb...@ds...> - 2002-02-15 17:58:21
|
> > > in a textctrl i wish to use wxTE_PROCESS_TAB but this doesn't work...
> > > but wxTE_PROCESS_ENTER works...
> > > because of this i assume that the mistake is not on my side?
> > Somewhat: with wxTE_PROCESS_TAB the textctrl generates key events for
> > TAB presses; hovever if you do not handle the key events ( EVT_CHAR )
> > for TAB keys, or Skip() them, this triggers the default behaviour
> > ( go to next control ).
> >
> > HTH
> > Mattia
>
> interesting...
...but as usual I missed to give the last step...
> i just want the tab to make a tab...
> if the control isn't in a dialog or in a label this works by default...
# WARNING: untested, but should ( almost ) work
sub OnChar {
my( $this, $event ) = @_;
if( $event->GetKeyCode == 9 ) { # 9 is the ASCII code for TAB
$this->WriteText( "\t" );
} else {
$event->Skip; # search for the next handler
}
}
should do...
> can you (or someone else) give me an example of how to do this?
> i have an EVT_CHAR on the textctrl and it captures every key event...
> what do i have to do now that the chars go to the textctrl?
Skip() the event ( Skip-ing an event means that wx searches
for the next event handler )
> i mean it looks unnecessary to me to capture every pressed key and write it
> to the textctrl just to don't loose the tab
Regards
Mattia
|