I am trying to implement a custom selection tool in ArcMap 9.3.1 that is functionally similar to the default ArcMap selection tool with "Adding to current selection" enabled. ie. the user can click to incrementally select individual features one by one, while adding on to previously selected features. When the user clicks on an already selected feature, that feature should be unselected.
How should I go about replicating and implementing this behavior for my custom tool? There are some selection-related code snippets lying around, but nothing really comes close. I was able to perform single selections by calling SelectByShape(geom, null, true), where geom = a small area around the clicked point. To support multiple selections at various locations, how then do I keep the previously selected features still selected as I select a new one, since SelectByShape(geom, null, true) only selects a single feature each time it's called.
Clearly, I will need another approach, which probably involves me keeping a growing list of currently selected features, but I am not sure if there is a more straightforward solution. Has anyone attempted this before?