[ City Zoo | Announcements | Articles | Tips & Tricks | Bug List | FAQ | Sites ]
For the ControlAtPos method (Keyword: ControlAtPos), the documentation states that the Pos parameter is in screen coordinates.
Coordinates passed in the Pos parameter should be in client coordinates of the control being used.
Attempting to view help for Compiler Error 202: Property cannot be published results in a Topic Does Not Exist error message.
More information can be found on publishing properties by searching the help for "published parts". The most likely cause of this error is attempting to publish a property with a type that Delphi does not know how to read and/or write to a stream. To stream the data for non-standard data types, override the component's DefineProperties method and register a property reader and writer routine. See the source of TStringList for an example of how this is done.
The example for the Curosors Property topic (Keyword: Cursors Property, choose Example link) incorrectly shows a LoadCursor API call with the Instance parameter being passed as 1.
The Instance parameter should be the instance of the application. This value is stored in a global variable, hInstance, available from the System unit. The line should read:
Screen.Cursors[crMyCursor] := LoadCursor(hInstance, 'NewCursor');
The example for the MDIChildren Property topic claims that the following code will close all of the MDI children of Form1:
var I: Integer; begin with Form1 do for I := 0 to MDIChildCount-1 do MDIChildren[I].Close; end;
This code actually causes a GPF. The reason is that the MDIChildren list property is recalculated after children are closed and opened. So, if there were two MDI child windows and the first were closed in the first iteration of the above loop, in the second iteration there is only one window, and it is referenced as MDIChildren. However, the loop will attempt to call MDIChildren.Close.
The following code will correctly close all MDI child windows by looping down through the children instead of up:
var I: Integer; begin with Form1 do for I := MDIChildCount-1 downto 0 do MDIChildren[I].Close; end;
The OnCreate Event topic lists the order of events that occur when an object is created as:
The actual order of events is:
The Add method for the TFieldDefs object (Keyword: Add, choose Add Method for Field Definitions link) is missing a parameter.
The declaration for the procedure should read:
procedure Add(const Name: string; DataType: TFieldType; Size: Word; Required: Boolean);
The Required parameter is described as:
"to assign (or not assign) a constraint to the field that is equivalent to the SQL constraint NOT NULL." -- Steve Koterski (email@example.com)
For those of you like me who know little about SQL, this means that new records are required to contain a value in this field (i.e. it may not be "NULL").
The topics for TFont.Size and TFont.Height (Keyword: TFont, choose Size or Height link) seem to be reversed.
The description of TFont.Size actually applies to TFont.Height, and TFont.Height applies to TFont.Size.
Also, the formula shown for calculating a TFont.Size (shown in the TFont.Height topic) will not compile because of the use of the / operator and storing the result to an integer variable. You can use the following line if you need to calculate the height in pixels of a font:
PixelHeight := Trunc(-Font.Height * Font.PixelsPerInch / 72);
The TListBox component topic has a popup topic, accessed through the Properties link. This popup topic lists all properties for the component and links to the appropriate topics explaining each property. Unfortunately, someone forgot to actually link each of the properties to the topics.
You will have to use the search dialog of WinHelp for the particular property you need help with. For example, if you need help with the BorderStyle property, press the Search button and entery BorderStyle in the resulting dialog.