I'm trying to copy, or 'exchange' two forms that are referenced by a TListBox.
Here's what I'm trying to do, but I get an error (shown below):
cf1 := TCustomform(lstPackages.Items.Objects[origNdx]);
cf2 := TCustomform(lstPackages.Items.Objects[origNdx - 1]);
cfTmp.Assign(cf1); //error here: cannot assign TfPackage to a TfPackage
cf1.Assign(cf2);
cf2.Assign(cfTmp);
lstPackages.Items.Exchange(origNdx, origNdx - 1);
lstPackages.ItemIndex := origNdx - 1;
So, I'm trying to exchange the list items, and I need to do something similar with the forms, but I get the error that I can't assign the form type that I'm using. TfPackage is a descendant of TCustomForm.
How can I accomplish the same thing?