문제

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...

도움이 되었습니까?

해결책

    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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top