Board index » delphi » Delete
mrc...@primenet.com (Mike Copeland)
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
DeleteQuote> can anyone help me more than the pascal help files in regards to delete. procedure), and although you're allowed to override it, using it with your own definition prevents you from using the normal one. It's usually a poor idea to redefine a standard name... Second, you have, by using this code, declared Delete as a _recursive_ procedure, and I really doubt that was your intent. Because I don't think you wanted to do this, I wonder what you intended this call to do. As it exists here, it will make a (recursive) call to itself (and not accomplish anything), and I'm quite sure the program will eventually abort with a 202 Stack Overflow...or perhaps lock up with an infinite loop. Either way, I'm pretty sure you don't want that... Quote> end move array element(s) which are "to the right" of the element to be deleted one array position to the left. Then, you want to set some sort of "sentinel" in the last array element (to signify a "null record"), or you want to reduce the array size index by one. However, this simple process has difficulties: if the matching element is the last in the array, no move is required. It also implies that you maintain a separate "array size" value, so that you know how many elements are present in the array. You can also "logically delete" any given record - by declaring a "present flag" variable in each record and using it (true or false) to define whether the record exists or not. That means that the record isn't physically removed from the array, but that deleted (marked as not present) are ignored in processing after the flag variable is set. There are several other ways of dealing with this "delete" problem, but I suspect this is a school assignment and that the above is enough to get you going. |