The 64 bit version of TfcTreeNode.WriteData does not write the Data pointer and TfcTreeNode.ReadData simple sets the Data pointer to nil. This seems to be by design to get a backward compatibility for saved TfcNodeInfo data.
This behaviour results into a problem in the following case:
- Generate the treeview content with fcTreeView.Items.AddChildObject(..., SomePointer) before the form becomes visible. SomePointer will be assigned to Data pointer.
- Call MyForm.ShowModal. This will (re)create the window, calling somewhere WriteData and ReadData. In the 64 bit version, Data is lost!
This will also happen on any recreation of the window/dialog at runtime.
I suggest to use one of the TfcNodeInfo.DummyPad bytes/bit as a flag to signal that in the saved data a 64 bit pointer will follow instead of a 32 bit pointer. On reading, a 32 bit version could ignore the 64 bit pointer and vice versa, but a 32 bit version will read the 32-bit-pointer and the 64 bit version will read the 64 bit pointer, which is essential at runtime.
A second suggestion/solution is a new boolean property in TfcTreeView which advices TfcNodeInfo to save the 64 bit Data pointer, for the price of losing backward compatibility.
Please sign in to leave a comment.