"Cannot make a visible window modal"

I have a main form full of data-aware edits and a "more" button which opens
some more data-aware edits in a dialog, which I display modally "showmodal"
and close with a button returning mrOK.   Another button causes some
calculations and printout from the current record, showing another dialog
with results in a string grid.

If I use the second button on any record displayed in the form, the
calculation works and the results are displayed in the string grid dialog.
However, if I close that dialog and click the "more button", I get an error
"EInvalidOperation.  Cannot make a visible window modal".   If I never use
the calculate button, I can use the "more" button repeatedly, on the same or
other records, without problem.

If I comment out the calculations and merely show the string grid dialog, it
does not produce the error when I go back to the first button, so the
problem lies in the calculation procedure.   This is reading values from the
current record and putting calculated results into a matrix for string grid
display, and also back into the record (preceded with edit and followed by

Any suggestions would be appreciated.

Harry Bintley