When objects other than UIObjects wish to execute a command, they should use the global object commandQueue, and append the command: commandQueue->append(new CmdReshape()); This command will not actually be run until the main event loop in VMD\ is run. If a command needs to be executed immediately, use runcommand: int success = commandQueue->runcommand(new CmdReshape());
When UIObjects are adding commands, there are special funcions in UIObject to make this faster, `addcommand' and `runcommand'. Each UIObject is given a pointer to a CommandQueue object, and so the `addcommand' routine will take a command and add it to that queue. For example, in UIText there might be: addcommand(new TextEvent("text command", id())); Most commands have as their last argument an id code for the UIObject which created them. This is that so UIObjects can tell, when they are told that the command has executed, who started it all.