next up previous contents
Next: Developing a new class Up: Method of use Previous: Method of use

Using a Command object:

Whenever an action is to be performed, you create a new instance of the particular Command derivative with a `new' operation: Command* cmd = new CmdTranslate(x, y, z, 0); Then, the command is queued, by adding it to a CommandQueue object, by appending it to the queue: commandQueue->append(cmd); When doing this in a UIObject, there is a member function addcommand(Command *) to do this more easily.

Once queued, the command will be executed during the main event loop in VMD, and then the instance will be deleted after it is done executing. Do NOT queue a static Command object, it must have been created using new. (But see the description of the runcommand function in CommandQueue, section 6.6.2.)



Justin Gullingsrud
Tue Apr 6 09:26:48 CDT 1999