FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MDI Dialog
Posts: 844
Joined: Mon Oct 10, 2005 01:29 PM

MDI Dialog

Posted: Tue Jul 21, 2026 03:30 PM

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()

  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

Posts: 8716
Joined: Tue Dec 20, 2005 07:36 PM

Re: MDI Dialog

Posted: Wed Jul 22, 2026 03:29 PM

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

Maurizio, can you put together a quick demo?

Gracias, tks.

Regards, saludos.

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 844
Joined: Mon Oct 10, 2005 01:29 PM

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

Posted: Mon Jul 27, 2026 09:47 AM

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

Posts: 44508
Joined: Thu Oct 06, 2005 05:47 PM

Re: MDI Dialog

Posted: Mon Jul 27, 2026 09:58 AM

Dear Maurizio,

Please use these credentials:

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

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion