How do I create a component from an instance I have drawn?

Post a snippet from your code, otherwise we can only guess what might be wrong.

Please first read the wiki post on how to post code in the forum.
(Convert any TABs to 2 spaces for Ruby.)