- # Looks like a bug here, but only if not wxTE_RICH...
- if wxPlatform == "__WXMSW__":
- text = string.replace(text, '\n', '\r\n')
- self.log.write("GetSelection(): (%d, %d)\n\tSelectedText: %s\n" %
- (start, end, repr(text[start:end])))
+ if wxPlatform == "__WXMSW__": # This is why GetStringSelection was added
+ text = text.replace('\n', '\r\n')
+ self.log.write("multi-line GetSelection(): (%d, %d)\n"
+ "\tGetStringSelection(): %s\n"
+ "\tSelectedText: %s\n" %
+ (start, end,
+ self.tc.GetStringSelection(),
+ repr(text[start:end])))
+
+ start, end = self.tc1.GetSelection()
+ text = self.tc1.GetValue()
+ if wxPlatform == "__WXMSW__": # This is why GetStringSelection was added
+ text = text.replace('\n', '\r\n')
+ self.log.write("single-line GetSelection(): (%d, %d)\n"
+ "\tGetStringSelection(): %s\n"
+ "\tSelectedText: %s\n" %
+ (start, end,
+ self.tc1.GetStringSelection(),
+ repr(text[start:end])))
+
+
+ def OnT5LeftDown(self, evt):
+ evt.Skip()
+ wxCallAfter(self.LogT5Position, evt)
+
+ def LogT5Position(self, evt):
+ text = self.t5.GetValue()
+ ip = self.t5.GetInsertionPoint()
+ lp = self.t5.GetLastPosition()
+ self.log.write("LogT5Position:\n"
+ "\tGetInsertionPoint:\t%d\n"
+ "\ttext[insertionpoint]:\t%s\n"
+ "\tGetLastPosition:\t%d\n"
+ "\tlen(text):\t\t%d\n"
+ % (ip, text[ip], lp, len(text)))
+
+
+ def OnTestEvent(self, evt):
+ ke = wxKeyEvent(wxEVT_CHAR)
+ ke.SetEventObject(self.tc1)
+ ke.SetId(self.tc1.GetId())
+ ke.m_keyCode = ord('A')
+ self.tc1.GetEventHandler().ProcessEvent(ke)