ET++: Stepping through a left mouse click in a button

This performs a command by calling the DoIt method of the command. DoIt does the actual work of saving whatever is necessary to undo the command, and then doing the command. The code for DoIt varies from command to command. This completes the step-by-step tour through ET++'s event system during the handling of a mouse click in a button.


int Command::Perform()
{
	if (this == gNoChanges || this == gResetUndo)
		return 0;
	int cc= 0;

	switch (state) {
	case eCmdStateNew:
		DoIt();
		state= eCmdStateDone;
		cc= 1;
		break;
		
	[ ... code to handle Undo, Redo ... ]
	}
	if (type == eCmdTypeNoChange)
		return 0;
	return cc;
}

Back to the method call sequence