This sample demonstrates how to change event handlers at run time.
You can find the switch sample project at:
- Start > Programs > Embarcadero RAD Studio > Samples and then navigate to CPP\VCL\Switch
- Subversion Repository for C++: http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RadStudio_XE4/CPP/VCL/Switch/
The application creates a simple form with one button. The handler for the TButton.OnClick event changes at run time every time the button is clicked.
How to Use the Sample
- Navigate to Start > Programs > Embarcadero RAD Studio > Samples and open scrollba.cbproj.
- Press F9 or choose Run > Run.
The project contains one source file, main.pas, which contains the main form class.
TFormMain, the class corresponding to the main form, handles the events that occur when interacting with the visual components on the form.
A message box is prompted to let the user know which handler is being executed.