John,

I am not sure exactly what you are trying to do; however, I think I 
can supply you with a _little_ guidance.

>type
>   ETooManyColumns = class (Exception);
>...
>     procedure NextColumn;
>     begin
>       dec (K);
>       if K <= 0 then begin
>    {     Sleep(1000); }
>         Raise ETooManyColumns.Create('Too Many Columns');
>       end;
>     end;
>...
>   try
>          SetUpPerformance (HPH, DHP);
>   except on ETooManyColumns do
>      begin
>         MessageDlg ('There are too many Historic Performance 
> columns', mtError, [mbOK], 0);
>         ModalResult := mrCancel;  {or Hide}
>       end;
>   end;
>...


At 10:05 AM 8/24/2007, you wrote:
>Hi,
>
>When I run into a fatal error 7 nested calls deep in a form and I need
>to give the user a message and terminate (hide) the form, an Exception
>seems like the right tool.  Everything works as I would hope, except ...
>
>The message does not appear when I call ShowMessage -- it appears AFTER
>the offending form hides.  I tried putting a 1000 millisecond Sleep  in
>the Exception generator (after the message and before the Raise) ... I
>tried making it a Modal form and setting the ModalResult to mrCancel
>instead of calling Hide ...  but the message box does not exist until
>AFTER the form is closed (manually, red X).  (I dragged the form away,
>and the message box is not lurking underneath)
>
>What am I doing wrong?   (Code snippets follow)
>
>(What I want is to display a message, let the user click on OK, then
>have the form close/hide/go away.)
>
>Thanks,
>Rainer
>
>type
>   ETooManyColumns = class (Exception);
>...
>     procedure NextColumn;
>     begin
>       dec (K);
>       if K <= 0 then begin
>         ShowMessage ('There are too many Historic Performance columns');
>         Sleep(1000);
>         Raise ETooManyColumns.Create('Too Many Columns');
>       end;
>     end;
>...
>   try
>     SetUpPerformance (HPH, DHP);
>   except on ETooManyColumns do begin
>     ModalResult := mrCancel;  {or Hide}
>   end end;
>...
>
>
>
>_______________________________________________
>Delphi mailing list -> [email protected]
>http://www.elists.org/mailman/listinfo/delphi

Ralph D. Wilson II
Systems Analyst

Home: (210) 497-2643
Cell:    (210) 387-7744
Fax:    (210) 497-5726

[EMAIL PROTECTED]
[EMAIL PROTECTED]


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

Reply via email to