Something I don’t understand with Layers


On a Form I put a Diagram (atDiagram1), then define 2 Layers (0 and 1). By default, both of them are editable and visible.

In the diagram I put 2 DiagramBlocks (DiagramBlock1 and DiagramBlock2). By default, both of them belong to Layer 0. I change Layer of DiagramBlock2 to 1 and … It disappears… Why ?

Then 2 buttons on the form with this code :

void __fastcall TForm2::Button1Click(TObject *Sender)
	atDiagram1->Layers->Items[0]->Visible = true;
	atDiagram1->Layers->Items[1]->Visible = false;
void __fastcall TForm2::Button2Click(TObject *Sender)
	atDiagram1->Layers->Items[0]->Visible = false;
	atDiagram1->Layers->Items[1]->Visible = true;

Then I run the project, click on the buttons and… nothing happens…
I don’t understand anything, how should I work with those layers ?

If the two blocks are in layer 0 and you then make the layer 0 visible (Button2Click), the blocks will disappear.

Your code sample is very limited and doesn't show all the steps you are doing. If that's not the case, please provide a simple code that reproduces the issue from the beginning.

OK, maybe I have found the right way to do it : the Layers must have a LayerName (Lay0, Lay1 for example) and the DiagramBlocks belong to the Layers by their property LayerName, not by their property Layer (which can be 0 for the two DiagramBlocks). Well… it’s a bit strange but like that it works.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.