Cursor
Hello
I am sending a pdf report by email and with ShowEmailDialog := True.
Other relevant components relative to the question are as follows:
1)
procedure TRBReportRequestLetter2.ppReport1PreviewFormCreate(Sender:
TObject);
begin
TppPrintPreview(ppReport1.PreviewForm).EmailButton.OnClick :=
PreviewFormEmailClickEvent;
end;
2)
The PreviewFormEmailClick event contains the SendMail command.
3)
The OnCreate event contains
with ppReport1 do
begin
TppEmail(ppReport1.Email).SMTP.OnStatusChange := EmailStatusChangeEvent;
end;
4)
procedure TRBReportRequestLetter2.EmailStatusChangeEvent(Sender: TObject);
begin
MessageDlg('SMTP.Status = ' + TppEmail(ppReport1.Email).SMTP.Status + '.',
mtInformation, [mbOK], 0);
{ The following allows the above messagedlg to disappear.}
Application.ProcessMessages;
5)
After the Send mail command is issued, the OnPrintingComplete command is
issued. This is followed by the EmailStatusChangeEvent that issues several
messages: a) SMTP.Status = Connected, b) SMTP.Status = Encoding attachment,
c) SMTP.Status = Sent: email address, d) SMTP.Status = Disconnecting and e)
SMTP.Status = Disconnected.
Question
To the end user there are what appear to be some delays between the
OnPrintingComplete event and the EmailStatusChangeEvent as well as between
the various messages issued in the EmailStatusChangeEvent. It appears that
anywhere is these code issuing the screen.cursor := crHourglass does not
actually change the cursor, even when it is followed with a
Application.ProcessMessages command.
Does anyone have a suggestion as to how to accomplish the cursor change so
that the end user is informed as to the progress of the process?
TIA
John
I am sending a pdf report by email and with ShowEmailDialog := True.
Other relevant components relative to the question are as follows:
1)
procedure TRBReportRequestLetter2.ppReport1PreviewFormCreate(Sender:
TObject);
begin
TppPrintPreview(ppReport1.PreviewForm).EmailButton.OnClick :=
PreviewFormEmailClickEvent;
end;
2)
The PreviewFormEmailClick event contains the SendMail command.
3)
The OnCreate event contains
with ppReport1 do
begin
TppEmail(ppReport1.Email).SMTP.OnStatusChange := EmailStatusChangeEvent;
end;
4)
procedure TRBReportRequestLetter2.EmailStatusChangeEvent(Sender: TObject);
begin
MessageDlg('SMTP.Status = ' + TppEmail(ppReport1.Email).SMTP.Status + '.',
mtInformation, [mbOK], 0);
{ The following allows the above messagedlg to disappear.}
Application.ProcessMessages;
5)
After the Send mail command is issued, the OnPrintingComplete command is
issued. This is followed by the EmailStatusChangeEvent that issues several
messages: a) SMTP.Status = Connected, b) SMTP.Status = Encoding attachment,
c) SMTP.Status = Sent: email address, d) SMTP.Status = Disconnecting and e)
SMTP.Status = Disconnected.
Question
To the end user there are what appear to be some delays between the
OnPrintingComplete event and the EmailStatusChangeEvent as well as between
the various messages issued in the EmailStatusChangeEvent. It appears that
anywhere is these code issuing the screen.cursor := crHourglass does not
actually change the cursor, even when it is followed with a
Application.ProcessMessages command.
Does anyone have a suggestion as to how to accomplish the cursor change so
that the end user is informed as to the progress of the process?
TIA
John
This discussion has been closed.
Comments
The report is going to generate before the email is actually sent (or even
begins to send). Below is the order of operation for reference.
1. Email Dialog opened.
2. The report is exported to file (generated).
3. Email plugin connects to the server.
4. Email plugin sends the email with attached report.
5. Email plugin disconnects from the server.
As you can see the OnPrintingComplete event will fire before the Email
Status even begins to change. I would suggest perhaps using the
OnBeforePrint and OnAfterEmail events to change the cursor. Note that the
OnBeforeEmail event fires just after the call to Report.SendMail, which is
too early if you are using the built-in email dialog.
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks for the reply. Using the OnBeforeEmail and OnAfterEmail events gave
me exactly what I was looking for.
John