FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos Bug in oDlg:bGotFocus
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in oDlg:bGotFocus
Posted: Fri Dec 16, 2005 05:29 PM
Running the following sample you can hear a beep only when the dialog is closed but not when it gets the focus:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE( 30 )

    DEFINE DIALOG oDlg

    oDlg:bGotFocus = { || Tone( 440, 1 ) }

    @ 1, 1 GET cVar

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in oDlg:bGotFocus
Posted: Fri Dec 16, 2005 05:56 PM

Enrico,

It does not look as a bug, as the dialog never gets the focus, just momentary when it is going to be closed. All the time a control has the focus.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in oDlg:bGotFocus
Posted: Fri Dec 16, 2005 07:03 PM

Ok, but this is not consistent with the behavior of bLostFocus. Why?

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in oDlg:bGotFocus
Posted: Sat Dec 17, 2005 06:04 AM

Enrico,

Do you mean with oDlg:bLostFocus ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in oDlg:bGotFocus
Posted: Sat Dec 17, 2005 09:00 AM

Yes. oDlg:bLostFocus is evaluated when a dialog losts the focus even if there are controls on it while oDlg:bGotFocus isn't.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Bug in oDlg:bGotFocus
Posted: Sat Dec 17, 2005 09:07 AM
Enrico,

I have been reviewing the way the Windows msgs are routed by FWH internals, and we don't make any distinction from GotFocus and LostFocus(), so it seems its a Windows behavior for dialogboxes, as Class TDialog code just does this:

   METHOD GotFocus() INLINE ::lFocused := .t.,;
                            If( ::bGotFocus != nil, Eval( ::bGotFocus ), nil )
...
   METHOD LostFocus() INLINE ::lFocused := .f.,;
                             If( ::bLostFocus != nil, Eval( ::bLostFocus ), nil )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in oDlg:bGotFocus
Posted: Sat Dec 17, 2005 09:10 AM

Ok, no problems. Thank you.

EMG

Posts: 174
Joined: Sat Feb 23, 2013 10:04 AM
Re: Bug in oDlg:bGotFocus
Posted: Fri Apr 26, 2013 08:05 PM

Continue the discussion