First of all I would question your choice to only hide this form if
the backup was successful.  I never leave any forms in memory after they are
no longer or immediately needed.  It makes little sense from a resource
point of view.  I would simply call the Form's close method and then in the
Form's OnClose Method I would run my "NoErrors" test.  If True then I would
set the form to nil and call Action := caFree;  If False I would call Action
:= caNone and use the showMessage or MessageDlg to inform the user that he
may need to try again or whatever you want your alternate choice to be.
Provided the ShowMessage is the last call made for that particular branch it
should stay on top of the calling form.  I think the reason it's not in your
case might have something to do with it not being able to function properly
after a Hide command, thus it reappears above the ShowMessage.  I've noticed
twice before where it seems that calling Hide is usually of less value than
setting the Form's visible property to False!

from: Robert Meek at: [EMAIL PROTECTED] 
dba "Tangentals Design" home of "PoBoy"
freeware Windows apps and utilities
located at: www.TangentalsDesign.com
Proud to be a moderator for the
"Delphi Programming Lists" at: elists.org 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Rainer von Saleski
Sent: Monday, October 17, 2005 4:25 AM
To: Borland's Delphi Discussion List
Subject: Form won't hide (sometimes)

When a unit finishes its work, I want the form to disappear and I want to
display a message to let the user know how things went.  So I've tried the
obvious:

Backup.Hide;
if NoErrors
  then ShowMessage ('Backup Completed OK')
  else ShowMessage ('*** BACKUP FAILED ***');

My problem is that this works as expected when run from the Delphi 7
development environment ... but when run from the executable file, the form
does not disappear, and the ShowMessage box is displayed BEHIND the Backup
form (which is supposed to be hidden).  And, yes, the focus has moved to the
message box (which confuses everyone, because it can't be seen).  

So ... what magic invocation do I need to make the Hide actually take
effect?

Thanks,
Rainer
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to