When I sat down to write all the new persistence code into my UI example program I realized that while I could load data from the persister into the ManyToManyLinks instance and have those checkboxes appear checked in my listbox, I had no way of communicating the user's selection of a record back to the ManyToManyLinks instance.
There are several places in the CML_UI_ListCheckbox code where I update the queue on the user taking an action, so in each of those places I added a call to a new SetManyToManyLinkForCurrentQRecord method:
Code Block |
---|
CML_UI_ListCheckbox.SetManyToManyLinkForCurrentQRecord procedure
code
if not self.ManyToManyLinks &= NULL
if self.ListQIconField = CML_UI_ListCheckbox_TrueValue
self.ManyToManyLinks.SetLinkTo(self.ListQRightRecordID)
else
self.ManyToManyLinks.ClearLinkTo(self.ListQRightRecordID)
end
end |
This method looked great but it didn't compile, because while I already have a SetLinkTo method, I don't have a ClearLinkTo method. That was easy enough to fix, although for symmetry with the SetLink* methods I added two ClearLink* methods:
Code Block |
---|
CML_Data_ManyToManyLinks.ClearLinkTo procedure(long rightRecordID)
code
self.ClearLinkBetween(self.LeftRecordID,rightRecordID)
CML_Data_ManyToManyLinks.ClearLinkBetween procedure(long leftRecordID,long rightRecordID)
code
clear(self.LinksData.LinksQ)
self.LinksData.LinksQ.LeftRecordID = LeftRecordID
self.LinksData.LinksQ.RightRecordID = rightRecordID
get(self.LinksData.LinksQ,self.LinksData.LinksQ.LeftRecordID,self.LinksData.LinksQ.RightRecordID)
if not errorcode() then delete(self.linksData.LinksQ). |
But I had another problem: I didn't have a self.ListQRightRecordID property, because none of my UI code had had to deal with this requirement before. That meant adding that property and changing the Initialize prototype so I could assign the property: