ModalResult

I will swear that the documentation does not contain any information about what happens when you assign a value to the ModalResult property of a form. In fact, ModalResult is a property of push buttons (PRIM_PHBN), but when a button is pushed, the ModalResult is supposed to be migrated to the form as well.

This became apparent when I had a form with a reusable that tried to catch invalid input when the user clicked on a button. Unfortunately, the reusable sent a signal to an event which then set the ModalResult property, closing the form no matter what I tried to do.

It turns out that assigning a value to ModalResult closes the modal form immediately.

Evtroutine Handling(ÆPHBN_1.Click)
  If Cond(...)
    ...
  Else
    #COM_OWNER.ModalResult := OK
  Endif
Endroutine

 

Advertisements