Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWCustomControl's FPageContext field
#1
I would like to suggest a possible change in the way IntraWeb custom controls decide to call the UnRegisterAsyncEvents method.

At this time, in IW 15.2.69, the Dispose method of TIWCustomControls only checks to see if IsDesignMode is true. I would like to add another condition to that:

  if Assigned(OwnerForm) and not (OwnerForm as TIWForm).PageContext.Destroying then

This will be faster, since the UnRegisterAsyncEvents will no longer have to do through all controls and all events to unregister them (which is not required, since we are in the Destroy of our main form anyway).

It is also a bit safer, since my code uses an approach with templates where numerous controls are added dynamically to the form, with a temporary PageContext. Since this PageContext often no longer exists when the page is destroyed, I sometimes get access violations (if the custom control's PageContext, which no longer exists, has a Destroying field pointing to some place in memory which just happend to be False).

I've been using the modified IWControl.pas for a while now, without any further problems.

Thanks for your consideration.

Groetjes, Bob Swart
Reply


Messages In This Thread
TIWCustomControl's FPageContext field - by ebob42 - 02-14-2023, 12:25 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)