November 2019
Beginner to intermediate
674 pages
15h
English
For the last part of the puzzle, I have to show you how macro recording is implemented. This is actually the most complicated part of the program.
Let's start with the command object. A macro is just a special kind of command, TMacroCommand. As we can see in the following code, it implements an Add command, which stores other commands in the internal list:
type TMacroCommand = class(TUndoableCommand) strict private FCommands: TObjectList<TCommand>; public procedure Add(command: TCommand); procedure AfterConstruction; override; procedure BeforeDestruction; override; function Clone: TCommand; override; procedure Execute; override; end;procedure TMacroCommand.Add(command: TCommand);begin FCommands.Add(command);end;
Read now
Unlock full access