I just noticed that in the wxSTC/Scintilla control that holding down Control
or Alt while typing a character does NOT stop the character from being
written into the control. This does not seem very intuitive to me. It also
prevents you from accessing menus using Alt-Key combinations. Is this the
way it is supposed to work? I added the following code to PyCrust to get the
behavior I expect, but this doesn't seem right. And it doesn't solve the
menu access problem. (I'm on 2.3.2beta5 on Win98.)
def OnChar(self, event):
"""Keypress event handler.
The main goal here is to not allow modifications to previous
lines of text."""
key = event.KeyCode()
currpos = self.GetCurrentPos()
stoppos = self.promptPos[1]
if currpos < stoppos:
wxBell()
return
if key == ord('.'):
# "." The dot or period key activates auto completion.
# Get the command between the prompt and the cursor.
# Add a dot to the end of the command.
command = self.GetTextRange(stoppos, currpos) + '.'
self.write('.')
if self.autoComplete: self.autoCompleteShow(command)
elif key == ord('('):
# "(" The left paren activates a call tip and cancels
# an active auto completion.
if self.AutoCompActive(): self.AutoCompCancel()
# Get the command between the prompt and the cursor.
# Add the '(' to the end of the command.
command = self.GetTextRange(stoppos, currpos) + '('
self.write('(')
if self.autoCallTip: self.autoCallTipShow(command)
# Hack to keep characters from entering when Alt or Control are
down.
elif event.ControlDown() or event.AltDown():
pass
else:
# Allow the normal event handling to take place.
event.Skip()
···
---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."