Command-based editor
A command pattern has many moving parts, so it is not a surprise that the example for this pattern is one of the more complicated ones in this book.
The Editor project in the Command folder implements a very simple text editor that internally uses the command pattern. Although it offers only primitive editing capabilities, the example implements both an undo system and a simple macro recorder.
The client part of the pattern is represented by the TfrmCommand form in the EditorMain unit. The command receiver is a TMemo field, which is for reasons of simplicity part of the main form. As we'll see later, the code actually implements two editors, each with its own memo component as a receiver.
The command hierarchy starts ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access