Somehow I ended up with a few forms where the FormCreate was declared in an explicit public section and it doesn’t work. It may have been Claude doing, or it could have been me copying things in Beyond Compare.
In Delphi, it doesn’t execute well.
In TMSWebcore, it just doesn’t execute the event at all; the rest of the code works fine.
This works
type
TfrmMain = class(TForm)
procedure FormCreate(Sender: TObject);
end;
This does not
type
TfrmMain = class(TForm)
public
procedure FormCreate(Sender: TObject);
end;
Is there a reason for this? Its a nasty hole to fall into.
You have to implicitly override parent methods like that in the top part of the subclass - the way you have it in your topmost example. Delphi normally does this for you, but Claude probably messed up and put it in the PUBLIC block.
Also make sure that FormCreate has your method assigned to it in your DFM’s OnCreate event handler. That is another case where Claude went wrong as you probably created the PAS file using it and did not have it update your DFM.
The first example the visibility is published (the default for TComponent descendants), which the IDE/RTL needs (using the older style of RTTI) in order to hook up events.