How do i create an object with a GUI Button

Ok so i was wondering how do i take a GUI button and make it attach a gameobject to the mouse when the button is pressed. For example, there is a button, user presses it with the mouse and a cube is then attached to the mouse. The gameobject moves with the mouse until i click again. When you click again it places the gameobject in the world. How do u do that??? Please help.

These might be some use, let me know how you get on.