Design Time vs Run Time
In some methods, there will be code that is used only at runtime or only at design time. In the VCL, these are some typical ways to control this.
if not (csLoading in ComponentState) and (not (csDesigning in ComponentState) then if (IsVisible or (csDesigning in ComponentState)) then if not (csDesigning in ComponentState) then if (csDesigning in ComponentState) then |
When you develop software, you can set runtime breakpoints and single step thru the code. Unfortunately, there is no way to single step thru your code at design time.
Placing the component on a form
Place the component on the form without resizing it | This verifies that the height and width are set in the constructor. If either of these is missing, the component will not be displayed. |
Resize the component and verify that it looks the way you expect | This verifies that the height and width trigger the correct routines. |
Add a component to the form using a non-default size | This verifies that the height and width properties are working. |
With several components on a form - some at the default size and others at a different size - save and reopen the form | Problems in the constructor will affect the "default sized" components, other problems will affect the resized components. |
View the form design in text mode and verify that the saved properties are as expected | Properties that store integer, boolean, and enumerated values may be defined with a default value using the default directive. If the default values are used, then they are not stored in the *.dfm file or displayed in the text version. |
In design mode, loaded is not called unless there is at least one non-default property value. Therefore, make sure that none of the required design time code is there (or called from there).
The Destructor
For example, this destructor clears FOnChange and FOnChanging before destroying itself.
destructor TStringList.Destroy; begin FOnChange := nil; FOnChanging := nil; inherited Destroy; if FCount <> 0 then Finalize(FList^[0], FCount); FCount := 0; SetCapacity(0); end; |
Testing the Help Interface
The basic test procedure is to click everything that related to your component, press F1, and verify that the correct help page is displayed. Items that need to be checked include
Simple, huh. I find that writing and testing the associated help is at least as much work as developing the component itself.
Oh, by the way .. useful help is "easy" to develop for Delphi 5. Delphi 6 and 7 don't work near as well. Beyond that, the help system was changed (it now uses html help) and I have no idea how to make those work - they intentionally broke the F1 key. (Actually, this is the reason I have refused to upgrade - an IDE with worthless help has no value.)
Author: Robert Clemenzi