I have been actively working on Behold for the last month, but have neglected to post to my Blog. I got stuck in a bit of a rut. The Instant Organize worked fine as I had implemented it in the Name Index and in the Tree View. But it did not work properly when I tried implementing it in the Everything Report.
For one thing, I had tried to implement it using checkpoints in TRichView. This required searching for the previous checkpoint, which was not trivial. Then once I had it, I had to look in the Name Index for all the individuals and spouses who may refer to that checkpoint: and individuals could be listed several times due to multiple surnames. It was not clean and just didn’t seem right.
After much deliberation, I realized that I needed to now implement the functionality I didn’t think I would need until I added editing: that is to be able to find the specific person and data structure that any point in the Everything report is referring to. This would be needed to allow the data structure to be edited in the future, but for now it would allow me to identify the individual being pointed to. Rather than using TRichView’s checkpoints for this, I needed to use its “Tags” instead. A Tag is associated with every RichView item, and I can easily get the current tag being referred to. For now, a tag will identify the individuals referred to by the item, so that Instant Organize can work from the Everything Report. It will be easy in the future to add references to the data structure as well.
My first attempt was to set up the tags as PChars and then create a string to identify the individual and convert it to a PChar. I’ll tell you I had a rough time trying to get that going, since PChars are such an ancient structure in Delphi. You have to allocate the right amount of space for each one and make sure they are null-terminated. Delphi kept hiccoughing and abending on me and it was a horrendous job tracking the problems down. Strings are much nicer to work with - without worries. After a week’s attempts to get this working, I decided this wouldn’t work and thought this through again. Instead I would use the tags as a pointer to a data structure that I would maintain in my own B-tree structure. That got rid of all the problems right away. It will also allow much future flexibility and efficiency when editing time comes.