Author: Tomas Rutkauskas
How to create an 'Easter Egg' in an application
1. Give the form a field of type String:
2. Declare a constant that represents the character sequence that needs to be typed
for the Easter Egg to appear. For example:
1 const2 Target = ' abc ' #1;
(In this example, you have to type "a" "b" "c" and finally CTRL - A)
3. Set the forms KeyPreview property to True.
4. In the dialog's OnCreate event handler, do this:
3 procedure TMyAboutBox.FormCreate(Sender: TObject);
4 begin5 Match := ''
5. In the dialog's OnKeyPress event handler, do this:
7 8 procedure TMyAboutBox.FormKeyPress(Sender: TObject; var Key: Char);
9 begin10 Match := Match + Key;
11 if Pos(Match, Target) <> 1 then12 Match := ''
13 elseif Match = Target then14 ShowMessage('Congratulations')