Update:
Let me ask a slightly different way, since I may be over-complicating things.
If working from the UI there's an option to do this:
You can Shift-Click to hide parent and children objects. How do you accomplish this programmatically? The only way I've found so far just hides the main object:
row.prop(wall, "hide_viewport")
Original Question
I'm working on an addon that's essentially a kitchen designer, so the base objects that need tracking are walls. Each wall has objects snap to it and become the parent object for everything underneath.
The walls need the ability to be hidden, along with all of the associated child objects. This requires a function for a little processing. If all of the walls could be defined ahead of time, I know how to accomplish this (create the class functions and register them, etc).
However walls are added as needed, with a simple loop that tracks and displays them:
row.label(text="Walls")
if object.expanded_walls:
row = box.row()
for wall in objs:
row = box.row()
row.prop(wall, "name")
--> row.##boolean_flag(script_that_hides, arg_with_wall_id)
This list is updated dynamically in the display, so displaying any wall property is easy.
But, I can't figure out how to put a simple boolean flag with each line item capable of calling a function data from objects in the same row. Any way to do that?