Re: [twsocket] Freeze when using smtp after recreating its parent form

2006-12-12 Thread Henrik
Hi Marcelo!

Ok, I didn't realize that that was what it was. Thanks for the
clarification!
I tried it in the example application but I still get the same freeze when
trying to connect after the second time the form is created...

Any other ideas?
To rephrase a solution to the problem: If I use the standard example
applications or if I put the smtp component on the main form of my own
application, everything works fine on all computers since the main form is
not released until the application is closed. It is when the form containing
the smtp-component is created and freed when I want to send an email that I
get the freezing problem the second time it is done.

So why not just put it on the main form? Well I want to have the capability
to send e-mails from many applications so it is convenient to have a
separate e-mail unit with an Execute-function that I can call from my
applications. Execute takes care of everything from creating the form that
contains the smtp component and shows the sending status to initiating the
properties of the smtp component with the parameters passed to Execute. It
tries to send the email and returns true if the email was sent.

Once again: All suggestions are appreciated.
Thank You in advance!
Best Regards
Henrik

 

-Ursprungligt meddelande-
Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] För
Marcelo Grossi
Skickat: den 11 december 2006 17:41
Till: ICS support mailing
Ämne: Re: [twsocket] Freeze when using smtp after recreating itsparentform

Hi,

Procedure Variable is a variable that has scope only for a given procedure. 
Example:

procedure MyForm.ButtonSendMailClick(Sender : TObject);
var
   MySendMailForm : TMySendMailForm; -- Procedure Variable, for its

only accessible inside this procedure (ButtonSendMailClick)...
begin
   MySendMailForm := TMySendMailForm.Create(params..);
   etc...
   .
end;

Regards,

Marcelo Grossi

 My final remark was that I normally have the form
 as a procedure variable as it is not needed to be
 defined outside the buttonclick event and maybe that
 also solves your issue.

 I don't know if I understand You correctly...

 Best Regards
 Henrik

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Freeze when using smtp after recreating its parent form

2006-12-12 Thread Wilfried Mestdagh
Hello Henrik,

Do you have the same problem in the IDE ?  Because this way you can
check witch code line never comes back (freeze). If not eventually open
a console window and write some debug information into it to see where
it happens.

Your approach is normal. I do this all the time, however I almost never
use forms for it. Normally I have an object containing the component, eg
TSmtpClient, another object that creates / handles / destroy the
TSmtpClient objects. But in principle it is the same. It can as whell be
a DataModule, a Form or whatever other object.

Question: We do understeand the word 'Freeze' the right way ?  Form
cannot moved, closed, application cannot quit, etc... Right ?

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Freeze when using smtp after recreating its parent form

2006-12-11 Thread Henrik
Hi!
 
I have probably misunderstood something because I get the same behavior
described below no matter which of the components SmtpCli, SyncSmtpCli and
HtmlSmtpCli I use.
 
The problem has to do with freeing the smtp-components parent form. You can
easily duplicate the behavior with one of the standard demo applications:
* Open Your favorite demo of  MailSnd, MimeTst or MailHtml. (I proceed with
MailSnd-demo below.)
* Add a new form with a button to the project. Write the following in the
buttons OnClick method:
  procedure TForm2.Button1Click(Sender: TObject);
  begin
  SmtpTestForm := TSmtpTestForm.Create(Application);
  try
  SmtpTestForm.ShowModal;
  finally
  SmtpTestForm.Release;
  end;
  end;
* Click on the menu: Project - Options, and remove the SmtpTestFrom from
the Auto-createForms list.
* Run the application and click the button. SmtpTestForm opens and You can
send lots of e-mails.
* Close SmtpTestForm and press the button again. Try to send yet another
email and You get stuck!
 
I guess I'm doing something fundamentally wrong?! I have narrowed it down to
that everything works as expected if I don't release the form. 
(I get the same error when setting Action to caFree in
SmtpTestFrom.OnClose.)
 
Is it not a good idea to free a manually created form?
 
Best Regards
Henrik
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Freeze when using smtp after recreating its parent form

2006-12-11 Thread Frans van Daalen

- Original Message - 
From: Henrik [EMAIL PROTECTED]
To: twsocket@elists.org
Sent: Monday, December 11, 2006 9:59 AM
Subject: [twsocket] Freeze when using smtp after recreating its parent form


 Hi!

 I have probably misunderstood something because I get the same behavior
 described below no matter which of the components SmtpCli, SyncSmtpCli and
 HtmlSmtpCli I use.

 The problem has to do with freeing the smtp-components parent form. You 
 can
 easily duplicate the behavior with one of the standard demo applications:
 * Open Your favorite demo of  MailSnd, MimeTst or MailHtml. (I proceed 
 with
 MailSnd-demo below.)
 * Add a new form with a button to the project. Write the following in the
 buttons OnClick method:
  procedure TForm2.Button1Click(Sender: TObject);
  begin
  SmtpTestForm := TSmtpTestForm.Create(Application);
  try
  SmtpTestForm.ShowModal;
  finally
  SmtpTestForm.Release;
  end;
  end;

 When entering the second time is the form already released then?

I normally just call .free never used .released. I also make the 
SmtpTestForm a procedure based variable in these kind of constructions. 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be