Page 1 of 1

MDI Dialog

Posted: Tue Jul 21, 2026 3:30 pm
by Maurizio

Hi Antonio,

I think I found a possible issue in the current FiveWin sources (FW 26.xx).

My application uses MDI windows and I open child dialogs using:

ACTIVATE DIALOG oDlg CENTERED NOWAIT

The dialogs are modeless and each one works with its own ADODB.Recordset.
When the dialog is closed, the Recordset is closed correctly. However, after the dialog has already been destroyed, FiveWin still evaluates all the WHEN clauses.

After some debugging I found the following execution sequence:

TBtnFlat:Click()

Eval( ::bAction ) // oDlg:End()

::Super:Click()

Code: Select all | Expand

  TControl:Click()

     ::oContainerWnd:AEvalWhen()

The problem is that after oDlg:End(), the dialog handle is already destroyed (hWnd == 0), but AEvalWhen() is still called.

As a consequence, every control's WHEN block is evaluated again, for example:

WHEN oRs:RecordCount() == 0

Since the ADODB.Recordset has already been closed, this raises an exception.

I tested the following modification in TControl:

METHOD Click() CLASS TControl

if ::oContainerWnd != nil .and. ::oContainerWnd:hWnd != 0
::oContainerWnd:AEvalWhen()
endif

return nil

(or the equivalent INLINE version)

After this change:

the exception disappears;
all my dialogs continue to work correctly;
AEvalWhen() is no longer executed for a dialog that has already been destroyed.

It seems that AEvalWhen() should not be called after the dialog has been closed, because there are no controls left to update and any WHEN block may access objects that have already been released (such as ADODB.Recordsets).

Could you please check whether this behavior is intentional, or if the hWnd test should be added before calling AEvalWhen()?

Thank you.
Maurizio


Re: MDI Dialog

Posted: Wed Jul 22, 2026 3:29 pm
by karinha

Maurizio, ¿puedes preparar una demostración rápida?

Maurizio, can you put together a quick demo?

Gracias, tks.

Regards, saludos.


Re: MDI Dialog ( and oCn := FW_DemoDB() )

Posted: Mon Jul 27, 2026 9:47 am
by Maurizio

I'm preparing the test file and using the maria01.prg test file, but the connection doesn't work.
oCn := FW_DemoDB()
Maurizio


Re: MDI Dialog

Posted: Mon Jul 27, 2026 9:58 am
by Antonio Linares

Dear Maurizio,

Please use these credentials:

Host mail.fivetechsoft.com
Database fivetech_test
User fivetech_test
Password fivewin2026