I added another way to tvplanit trunk how to create a resource group which is clearer and more flexible in my opinion: TVpResource.OverlayResources(AResources, ACaption). AResources is an array of the resource instances to be overlaid (not the resource ids any more!), and ACaption is an optional name for the resource group. When AResources is nil then resourcegroup assigned to the currently selected resource is removed. Unlike the old method, the resource to which the other resource are added must not be contained in AResources any more.
type TVpResource = class(...)
function OverlayResources(const AResources: TVpResourceArray; ACaption: String = ''): TVpResourceGroup;
This code is working in your second demo project correctly for me:
procedure TForm1.CheckBox1Change(Sender: TObject);
var
aParentRes: TVpResource;
aOverlaidRes: TvpResourceArray = nil;
begin
aParentRes := VpSqlite3Datastore1.Resources.Items[0];
if CheckBox1.Checked then
begin
SetLength(aOverlaidRes, 2);
aOverlaidRes[0] := VpSqlite3Datastore1.Resources.Items[1];
aOverlaidRes[1] := VpSqlite3Datastore1.Resources.Items[2];
aParentRes.OverlayResources(aOverlaidRes);
end else
aParentRes.OverlayResources(nil);
end;
I also extended the FullDemo project of the tvplanit installation by a possibility to select from a TCheckListbox the resources to be overlaid.