Hope you are doing well - it's been a long time!!!
You can definitely drive the 'Delete' button using the 'Can Delete' attribute in CustomUI for this control. The 'Copy' can also be shown or hidden but it is static (can't drive its enable/disable feature using a property like you can for 'Delete'. Add will be enabled or disabled based on the subpart collection it is mapped to.
And of course, the other way to do it is use your own separate button for these 3 functions and drive them individually.
I know this is an old post and you've found the solution that works for you but just wanted to leave it out there for future reference.
I have an issue that is connected to this post. I am trying to figure out how to create my own action button that does exactly what the Delete button do, but without beeing bound to the triple button. I'm having a hard time figuring out a script in custom.vb that can remove, from the subpart connected to a grid, the selected part. Do you have any idea about how to do it? More generally speaking, is there a way to read the functions called by the default buttons in Custom UI?
Yes, you can absolutely replicate the functionality of the individual buttons in ADD/COPY/DELETE combo...not only that but you can additional logic to those based on your unique situation. I am traveling now and don't have access to the exact snippet that removes a subpart but can you try this:
Dim _p As Object = <reference to some RS part object>
'remove the part from a subpart collection
The above code should do what you want. If it doesn't please let me know and I will find the correct code that does it.
You can remove the part from subpart easily as well as add part.
To Remove just call: SubpartOwnerPart.Subparts("YourSubpartName").Remove(referenceToPartToBeRemoved)
To Add call: SubpartOwnerPart.Subparts("YourSubpartName").AddPart("nameOfPartFamilyWhichInstanceToBeCreated")
If you want to link removing with user selection in grid, bind a property to grid that displays your subpart and use it to find and delete your selected part.
To avoid issues with refresh please check in your code if Subpart.Quantity > SelectedGridRowId property before referring to this item.