Control respond to Windows events.
For example, a Windows click event for a button occurs when the user clicks it.
As a developer, you decide what is to happen for any of these Windows events.
These responses are coded in the appropriate event method for the control.
You will code the click event method for the buttonCancel on the AddBookForm.
What is to happen is that the form is removed from the screen and from memory.
Here is where inheritance comes in: the Form superclass has a method,
called unloadForm, that does exactly what you want.
Instructions
- In the Class Browser, select the AddBookForm.
- In the properties window, select buttonCancel.
- In the methods window, select click.
A method skeleton for the buttonCancel_click method is displayed.
- On the empty line between begin and end;
enter
self.unloadForm();
- Select the Methods | Compile Method menu command.
- Run your application
and test the click method works.
|
 |