Bug in oDlg:bGotFocus

Bug in oDlg:bGotFocus

Postby Enrico Maria Giordano » Fri Dec 16, 2005 5:29 pm

Running the following sample you can hear a beep only when the dialog is closed but not when it gets the focus:

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Fri Dec 16, 2005 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41205
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Fri Dec 16, 2005 7:03 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sat Dec 17, 2005 6:04 am

Enrico,

Do you mean with oDlg:bLostFocus ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41205
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sat Dec 17, 2005 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Sat Dec 17, 2005 9: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:

Code: Select all  Expand view
   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
User avatar
Antonio Linares
Site Admin
 
Posts: 41205
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sat Dec 17, 2005 9:10 am

Ok, no problems. Thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8243
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Bug in oDlg:bGotFocus

Postby Antonio Mart. » Fri Apr 26, 2013 8:05 pm

Antonio Mart.
 
Posts: 174
Joined: Sat Feb 23, 2013 10:04 am


Return to Bugs report & fixes / Informe de errores y arreglos

Who is online

Users browsing this forum: No registered users and 2 guests