This was an interesting issue. The problem a customer reported was that when they wanted to add a user to a SharePoint Group, the "Add users to a SharePoint group" drop-down was disabled. On investigation, it was found the customer was creating a web application and a site collection "on-the-fly", through SharePoint object model code. They were also creating their custom SharePoint groups that were derived from default groups. However, they are not able to assign a user to their groups.
If you are wondering what I am talking about in the above paragraph, here's a screenshot that I believe will be more descriptive of the problem:
The red rectangle is the one to note. That's the drop-down, which was not available for administrators to select and was grayed out! The customer was doing everything right here. Create web application, create a top-level site collection and create SharePoint groups (there were few instances where customers had a misconception that creating a web application/site collection via object model code would create the default groups automatically - well, that's not actually the case. I mean it would be good to have that feature, but sadly it isn't there. So, we have to create the user groups manually via code), every step is appropriate.
On further investigation, I noticed that the "AssociatedGroup" property was not defined in customer's code. Below is the code snippet that corrected the problem.
Again the red rectangle above, shows how to utilize the "AssociatedGroup" property. Setting this property as shown resolved this issue for the customer and they were able to assign users to SharePoint Groups.