Creating button with flag

Hello,
I have such a situation that the names of 3D objects that appear on the scene are display in the panel. If a given 3D object has an appropriate name, its name appears on the panel. Once I have that, I would like to create a button that will appear next to the name of object. Just like on screen.
image
As you can see, it works. My problem is that when I push a button, it works on all objects. I would like this button to work [on/off] and only affect the object it is next to. The button is quite simple, because it only has to select object / point. I know I should use flags, but I don’t know how to do it. Does anyone have any idea or comments?
I will be very grateful for any help.
Greets

not sure if I understand your question or not- but it sounds like you just need to set a property for the operator (button) based on whichever object is next to it. Is the button for an operator you made, or is it a built in operator in Blender?

Yes, I know, I’ve tried such a solution. The problem is that when I do, I have two buttons pressed at once.
image

And I would like the first button to be pressed, the second is not. When the second button is pressed, the first one will be not. I’ve done it like this so far. I know I should use flags, but I don’t quite know how to do it.

row.prop(context.scene.common_properties, CommonProperties.second_button, text=“Second Button”, toggle=True, icon=‘CHECKBOX_HLT’)