MDI Dialog

Post Reply
User avatar
Maurizio
Posts: 844
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

MDI Dialog

Post 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

User avatar
karinha
Posts: 8720
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil
Contact:

Re: MDI Dialog

Post by karinha »

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
User avatar
Maurizio
Posts: 844
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

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

Post 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

User avatar
Antonio Linares
Site Admin
Posts: 44515
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MDI Dialog

Post by Antonio Linares »

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
Post Reply