Forms Delphi

Title: Changing the actions performed by a button on each click.
Question: Here is a method for changing the actions performed by a button everytime the button is clicked.
Answer:
This is a very simple method.
Place a button on a form and set the "TAG" property to 1.
// FOLLOW CODE
procedure TForm1.Button1Click(Sender: TObject);
begin
case Button1.Tag of
1: begin
// perform any action here
Button1.Tag := 2;
end;
2: begin
// perform any action here
Button1.Tag := 3;
end;
3: begin
// perform any action here
Button1.Tag := 4;
end;
4: begin
// perform any action here
Button1.Tag := 1;
end;
end;
end;
The button actions will be cycled, everytime the button is clicked. You can add any number of actions to the the above shown procedure without any hassles. But remember to set the button tag in the last action to 1, this ensures the cycling of actions.