Ian Branch 130 Posted 11 hours ago MyCustomCalendar.pas Hi Team, Delphi 12.2 p2. 32 bit App. It builds and installs OK but when I go to add it to a form Delphi thinks about it for a while, way too long, and then falls over. 😞 It is a derivation of TMonthCalendar. Appreciate any insights.  Regards & TIA, Share this post Link to post
Lajos Juhász 300 Posted 11 hours ago Reading the code I believe it is the: procedure TMyCustomCalendar.CreateWnd; begin  inherited CreateWnd;  RecreateWnd; // Force the control to redraw and send MCN_GETDAYSTATE end;  Why do you want to create windows handle all the time? (just after it was created?) Share this post Link to post
Ian Branch 130 Posted 10 hours ago Tks Lajos, You, that fixed it Tks. I didn't think about the race condition it would set up.  Ian Share this post Link to post
Rollo62 542 Posted 4 hours ago TL;DR; You should consider to separate the combined unit into separate designtime and runtime units. procedure Register; begin RegisterComponents('My Delphi Tools', [TMyCustomCalendar]); end; Â Share this post Link to post
Anders Melander 1819 Posted 2 hours ago 1 hour ago, Rollo62 said: You should consider to separate the combined unit into separate designtime and runtime units. There's no design-time code in it so unless the unit is used by other design-time packages there's really no reason to do that. Share this post Link to post
Rollo62 542 Posted 2 hours ago Perhaps, but I assume if there is already one custom control, then its very likely that there are several custom components units too, like MyCustomCalendar.pas MyCustomThis.pas MyCustomThat.pas  wouldn't it be cleaner to combine the registration for the designer in a common registration unit? MyCustomReg.pas  procedure Register; begin RegisterComponents('My Delphi Tools', [TMyCustomCalendar, TMyCustomThis, TMyCustomThat]); end;  Just saying, I haven't looked too deep into this, its also fine as-is.  Share this post Link to post