Using Macros with shapes in Base

I would like to use shapes as containers for groups of fields in a form. I am able to group the fields within the shape, and figured out how to name the group, but am unsure how to target it with macros or otherwise manipulate it, or get it to show up in the navigator panel. I would like to have multiple shapes that stack on each other, with the relevant one brought to the top by a button click event. Is there a better way of achieving this?

Hello,

.
Why not just make visible or not?
.
How do you determine which one is relevant? Different buttons?
.
Trying to understand what the purpose or use might be. Can you explain please?

Howdy Ratslinger!
Each shape container would have multiple related data fields for entry, for instance, one group would be for entering details about the heritage and another group for details about the physical descriptors. For looks, I would like to have the group container shapes to be stacked on top of one another, with the top most (or visible, as that would achieve the same look) one determined by clicking the associated button, each shapecontainer having their own button. There are many different fields and tables involved and the stacking of their containers is for the sake of neatness and ease of use.

.
I’m having trouble figuring out how to target the shapes in macros to begin with, and they don’t have the standard control properties like other elements so I’m not sure how to bring them to the front, or make them visible/invisible with macros.

.
Hope that makes sense.

I try avoiding using shapes on Base forms as they can be selected by the user. They can be set to not move but selecting leaves, to me, an unwanted visual of the selected item.
.
Regardless, each shape has a name. Use F5 (navigator) to see. Example:


.
Based upon the code from @Lupp in this post (Removing all draw objects from a writer doc? - #3 by Lupp) , you can modify to:

Sub clearDrawPageFromShapes
theDrawPage = ThisComponent.DrawPage
theEnum = theDrawPage.CreateEnumeration
Do While theEnum.HasMoreElements 
	theElement = theEnum.NextElement
	Print theElement.Name
Loop
End Sub

.
to find your wanted control:

Screenshot at 2022-12-17 11-59-41
.
Once obtained, set as wanted such as Visible set as True or False.

I’ve still much to learn/relearn and you make a great point. I’ve given this notion up for now and am working in sections and section visibility instead. Not sure if this answer was what I was looking for, as I was off in the wrong direction. Either way, appreciate the help you give around here, I’ve gained more than a couple of insights from your numerous posts on here.