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

Reply via email to