View Full Version : How do I copy a method from one object to another?
SamScott
08-08-2006, 06:47 AM
I created a method in "World", and I need to move it to one of my other objects. Is there any way to do this?
lanceA
08-08-2006, 08:30 AM
I'm not sure you can copy/paste the entire method per se`, but you can copy a group of instructions and then rebuild your method in another object.
To copy a sequence of instructions, click on the left side of the block of instructions that you want to copy. Now use the mouse to drag the instructions to the clipboard in the upper right corner of your screen. Once copied into the clipboard you can then drag the code back into your editor at the new location. Once you have done this you need to go back to the original location and delete the original code.
NOTE: You can only place one set of code in the clipboard at a time. If you have some code in the clipboard and then attempt to drag additional code into the clipboard you will overwrite the orginal.
If you have a lot of code in the method then you can increase the number of clipboards available for copying by selecting the Edit menu and then Preferences->Seldom Used->number of clipboards
SamScott
08-08-2006, 09:54 AM
Thanks a lot! I hadn't noticed the clipboard.
Sam.
josborne
09-09-2007, 09:40 AM
I'm having trouble with this. I click on the left side and it does not select multiple instructions.
lanceA
09-09-2007, 11:00 AM
In order to be able to copy multiple instructions they normally need to be enclosed in a Do In Order or Do Together code block. Even though the default in Alice is always Do In Order I always physically insert that tile into my code so that it will make it easier to do just what you are trying to accomplish now - copy a block of code with one-click.
josborne
09-09-2007, 11:48 AM
I did not realize the trick to coding was to wrap them in a block, e.g., Do In Order. That's a nice tip. Thanks.
DickBaldwin
09-09-2007, 06:46 PM
Sounds like you may be able to make good use of the free online tutorials at http://www.dickbaldwin.com/tocalice.htm
Pay particular attention to Appendix A.