Efficient way to delete lines from CEdit
-
Hello all, I've got a CEdit (read-only) in which continuously lines are added at the end (debugging stuff). Of course... if I do nothing, its memory usage will grow and grow (64k Max for Win9x, 'unlimitted' for WinNT/2k). What I want to do is to delete the first line when it passed a predefined maximum amount of lines. But... CEdit doesn't implement a 'delete-line' method. The only way I've found out was: -First select the line(s), than replace the selection with nothing. This sounds CPU-consuming to me... Does anyone knows an efficient way to do this? Thanks in advanced, EiSl
-
Hello all, I've got a CEdit (read-only) in which continuously lines are added at the end (debugging stuff). Of course... if I do nothing, its memory usage will grow and grow (64k Max for Win9x, 'unlimitted' for WinNT/2k). What I want to do is to delete the first line when it passed a predefined maximum amount of lines. But... CEdit doesn't implement a 'delete-line' method. The only way I've found out was: -First select the line(s), than replace the selection with nothing. This sounds CPU-consuming to me... Does anyone knows an efficient way to do this? Thanks in advanced, EiSl
I think there's no other option than select/replace with nothing. Is this a real problem? Tomasz Sowinski -- http://www.shooltz.com.pl
-
Hello all, I've got a CEdit (read-only) in which continuously lines are added at the end (debugging stuff). Of course... if I do nothing, its memory usage will grow and grow (64k Max for Win9x, 'unlimitted' for WinNT/2k). What I want to do is to delete the first line when it passed a predefined maximum amount of lines. But... CEdit doesn't implement a 'delete-line' method. The only way I've found out was: -First select the line(s), than replace the selection with nothing. This sounds CPU-consuming to me... Does anyone knows an efficient way to do this? Thanks in advanced, EiSl
-
Better you should create a loop that replace the first line with the second, the second with the third... and you should call this loop after verify wheather the comming line are going to exceed the limit. :rose:
Thanks for your reaction :rolleyes: ! Just a summary of what you suggested: 1. First get access to complete memory block in CEdit 2. Do the loop-stuff as you suggested (outside the scope of CEdit) Probably by using memmove 3. Give this block of memory back to CEdit Now a little question... :confused: Let's say we're talking about 1000 lines of average 50 characters in width. What do you know about your method that it's probably faster than the 'select-and-replace-with-nothing' method? Curious about your answer, EiSl