I'm without time now to write you a tutorial of how I did my menus, but I can tell you to use something like a matrix.
So, I did an cursor for the object selection, and slots, where the movement of the cursor is set to move in grid, fixing the smaller and the bigger X and Y of this cursor, when it's overlaping the object in that menu, it's selected.
Creating the object inside the menu and deleting or rearranging it is pretty easy, you just need to setup a variable for that object in the instant when the player pickup it, and if already exist, just add more for his amount.
Complex menus can be made, using your imagination, like rearranging the objecting on the grid, you can, when swapping one with other, just set his slot ID with the same conditional and 2 actions, but while changing, you need to setup a new variable for the second object. For example, if you wanna change the object number 2 with the 3, set the object 3 slot to be 3_old, change the 2 to be 3 and the 3_old to be 2, etc.. Just a logic ^^
(check the mouse to meet the requirements, if you're using the mouse cursor, for rearrange the grid)
When the selecting cursor is overlapping the character "pick_character.ID"
When the selecting cursor is not overlapping character "pick_character.ID -1"
When the selecting cursor is not overlapping character "pick_character.ID +1"
etc. Treat each exception here, because you don't want the player grabbing more than once each time.
(set what will happen)
Set temp_slot_free to (character.sprite.ID.X, character.sprite.ID.Y)
> Set character.sprite.ID X,Y to (cursor.X, cursor.Y);
By this way, you'll need now check where the cursor is when the player release the mouse button, setting this position inside a grid and changing the object.X and Y under it to match the temp_slot_free coord. if this slot is not free, if it's free, just set the new position to the object grabbed by the mouse.
What I'm doing will be useful for many people here, I pretend to make an character strip organizer with alignment (top, bottom, middle, left and right, plus the interaction with each other and by coord. too), rotation, pivot point, slot management (rearranging), etc, so, you can setup very fast and easy that animation what is giving you pain, because one frame is not aligned perfectly ^^
Sorry if I didn't helped too much, but the code to make a "good" selection menu need many logic and exception treatments, nothing hard, but many work need to be done, it's something what you can do, I believe.