https://forum.lmd.de/discussion/992/error-adding-ttimer-to-a-form-only-in-64-bits#latest
The problem is the next:
- A component has an event assigned
- The code of the component is using Assigned function to detect if the event is assigned or not
- The code of the component is not making any kind of checking about if the component is in DesingState or not to fire the event (it is only checking if the event is Assigned)
- In 64 bits, in design mode, Assiged function is returning true and the component tries to fire the event (in desing mode), generating an exception.
This problem was first time detected in TTimer tick, but now I have the same problem with TPageControl (OnChage event). The implementation of this event in VCL is the following one:
procedure TPageControl.Change;
var
Form: TCustomForm;
begin
if TabIndex >= 0 then
UpdateActivePage;
if csDesigning in ComponentState then
begin
Form := GetParentForm(Self);
if (Form <> nil) and (Form.Designer <> nil) then
Form.Designer.Modified;
end;
inherited Change;
end;
The invocation to the base is clase is made even if the component is in designe state. The implementation in the base class is:
procedure TCustomTabControl.Change;
begin
if Assigned(FOnChange) then FOnChange(Self);
end;
In 64 bits mode, even in design time, the OnChague event is fired, and an exception is generated.
Do you have any solution to this problem? It affects to most of the VCL component and makes to work in 64 bits mode almost impossible.
Comments
Use a TDicionary to store the real association between event handler and property
Modify TWin32Traits to use the new association mechanims