Can you give an example of how you are currently assigning custom keys to your controls? It will be easier to see how best to integrate.
Basically upon entering an "Assign key" state, add events for on left/right/middle mouse clicked - do something. This should be in parallel to your on keyboard key or button pressed.