Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Error adding TTimer to a form (only in 64 bits)

Each time I try to add the OnTimer event to a TTimer, an exception is raised. This problem occurs in 64 bits mode. Can be reproduce with the pIDE demo program. The modifications needed to reproduce it are:

1) Add the TTimer object

procedure TfrmMain.FormCreate(Sender: TObject);
begin
  CompBar.RegisterComponent('Standard', TLabel, 0);
  CompBar.RegisterComponent('Standard', TEdit, 1);
  CompBar.RegisterComponent('Standard', TMemo, 2);
  CompBar.RegisterComponent('Standard', TButton, 3);
  CompBar.RegisterComponent('Standard', TCheckBox, 4);
  CompBar.RegisterComponent('Standard', TRadioButton, 5);
  CompBar.RegisterComponent('Standard', TListBox, 6);
  CompBar.RegisterComponent('Standard', TComboBox, 7);
  CompBar.RegisterComponent('Standard', TGroupBox, 8);
  CompBar.RegisterComponent('Standard', TRadioGroup, 9);
  CompBar.RegisterComponent('Standard', TPanel, 10);
  CompBar.RegisterComponent('Standard', TActionList, 11);
  CompBar.RegisterComponent('Standard', TTimer, 11);
  CompBar.Pages[0].Expanded := True;

  AlignPalette.FormLeft := Left + 50;
  AlignPalette.FormTop :=  Top + 50;

  LMDRegisterStandardNodes(ProjMgr);
end;

2) Create a new platform to compile in 64 bits
3) After start the program, add a TTimer to the layout
4) Try to overwrite the OnTimer event
5) After this, the event is created, but a periodically access violation exception is thown

I'm using Embarcadero® Delphi 10.4 Version 27.0.37889.9797, and LMD 2020

Comments

  • 3 Comments sorted by Votes Date Added
  • The reason of the issue is that the standard Delphi's Assign function, used everywhere (and specifically for checking event handlers before execution), is implemented differently in 32 and 64 bit platforms, since Delphi itself does not exist in x64 variant.

    We are thinking, what can be done.
  • The solution I have implemented is to create a new component TTimer (same name, but different unit). This new class is used instead the old one. Obviously, this solution only work with this componente. If another one has the same problem, it will fail
  • You right. All other components can occasionnaly call event handlers during design-time.
Sign In or Register to comment.