Are you looking for RhinoDoc.SelectObjects event? Here you can find a simple implementation in Grasshopper: