1

I need to delete X lines from the middle of a textctrl starting from line number Y

Is there any easy way to do this? I can't see one: it seems like I have to somehow search through the contents of the TextCtrl counting newlines to find the position of Y...

GreenAsJade
  • 14,459
  • 11
  • 63
  • 98

1 Answers1

1
    if self._log.GetNumberOfLines() > MAX_LINES:
        if self._log.GetLineText(DELETION_POINT) != DELETION_LINE:
            start = self._log.XYToPosition(0, DELETION_POINT)
            self._log.SetInsertionPoint(start)
            self._log.WriteText(DELETION_LINE)
        while (self._log.GetNumberOfLines() > MAX_LINES):
            start = self._log.XYToPosition(0, DELETION_POINT+1)
            len = self._log.GetLineLength(DELETION_POINT+1)
            self._log.Remove(start, start+len+1)
GreenAsJade
  • 14,459
  • 11
  • 63
  • 98