Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TContentForm always create a new instance
#1
Hellow,

how do I get TContentForm to always create a new instance?

has the UseExistingInstance property, more is read-only.

Thanks All.
Reply
#2
Default for UseExistingInstance is True.

Besides that, you can:
- Create a descendant class of TContentForm and change the behavior at will
- Change mUseExistingInstance (it is protected not private), as:

type
  TContentFormAccess = class(TContentForm)

procedure TIWServerController.IWServerControllerBaseConfig(Sender: TObject);
var
  LContentHandler: TContentForm;
begin
   LContentHandler := TContentForm.Create(TMyIWForm);
   TContentFormAccess(LContentHandler).mUseExistingInstance := False;
THandlers.Add('', 'myaddress.html', LContentHandler);
end;

Have in mind that when UseExistingInstance is True, the session will search for an existing instance with the same class name, so you must not have 2 forms with the same class name instantiated.
In case UseExistingInstance is False, you are responsible for form destruction otherwise they will accumulate and start consuming system resources, until the session is terminated.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)