Page 1 of 1

Dialog Loosing Focus

PostPosted: Tue Dec 06, 2005 4:45 pm
by Detlef Hoefner
Hi all,


i can not catch the moment when a dialog looses focus.
I tried oDlg:bLostFocus := { || MsgBeep() }
But i never heard the beep.

Is there a known issue in FW2.4 that a bLostFocus block of a dialog will not be executed?
Maybe it's not executed because the dialog lost his Focus :wink: ?

Thanks for each reply.
Detlef

Re: Dialog Loosing Focus

PostPosted: Tue Dec 06, 2005 4:53 pm
by Enrico Maria Giordano
This sample works fine in FWH 2.7:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    oDlg:bLostFocus = { || MsgBeep() }

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG

PostPosted: Tue Dec 06, 2005 5:42 pm
by Detlef Hoefner
Hi Enrico,

Yes, your sample works even fine for me with FW 2.4.

But from the moment i build the dialog from resource your sample doesn't work.

Could you confirm this, please?

Thanks,
Detlef

PostPosted: Tue Dec 06, 2005 5:58 pm
by Enrico Maria Giordano
No. This works fine either:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg;
           RESOURCE "TEST"

    oDlg:bLostFocus = { || MsgBeep() }

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


Code: Select all  Expand view
TEST DIALOG 40, 27, 194, 119
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "This is a & test"
FONT 8, "MS Sans Serif"
{
DEFPUSHBUTTON "&Close", 201, 12, 96, 50, 14
}


EMG

PostPosted: Tue Dec 06, 2005 6:31 pm
by Detlef Hoefner
Hi Enrico,

this is probably one difference from FW 2.4 to 2.7.
Your sample doesn't work for my version.

Anyhow, thanks Enrico.

Regards
Detlef

PostPosted: Wed Dec 07, 2005 1:37 am
by James Bott
Detlef,

As long as the dialog is modal, you can just do whatever after the dialog is closed.

Code: Select all  Expand view
  ACTIVATE DIALOG oDlg

  msgBeep()

This would be called just a split second after oDlg:bLostFocus.

Or use the dialog's VALID clause

Code: Select all  Expand view
  ACTIVATE DIALOG oDlg VALID msgBeep()


Regards,
Jamess

PostPosted: Wed Dec 07, 2005 7:40 am
by Detlef Hoefner
James,

my problem is not to do something after a dialog is closed but when it's loosing focus.
I can not catch the moment when a user clicks outside the dialog.

But thanks for jumping in, James.
Regards,
Detlef

PostPosted: Wed Dec 07, 2005 12:46 pm
by Antonio Linares
Detlef,

Is it a non modal dialog ?

PostPosted: Wed Dec 07, 2005 1:03 pm
by Detlef Hoefner
Antonio,

no it's a modal dialog.

Just like the 2nd example Enrico posted.
It doesn't work for me.
bGotFocus is executed but bLostFocus not.

Thanks for jumping in Antonio.

Regards,
Detlef

You can't control dialog's focus

PostPosted: Mon Dec 26, 2005 7:43 pm
by manuramos
I Think you can't completly control dialog's focus. You only can fully control CONTROLS FOCUSES. for example oListBox:bLostFocus := .....

For knowing mouses outclicks you must build NO MODALs dialogs and test any Control:bLostFocus and the IsOverWnd command. I THINK...

PostPosted: Wed Jan 04, 2006 12:50 am
by James Bott
Detlef Hoefner wrote:my problem is not to do something after a dialog is closed but when it's loosing focus.
I can not catch the moment when a user clicks outside the dialog.


Hmm. Since the dialog is modal, the only way it can loose focus is if you click outside the application. Is that what you mean?

James

Re: Dialog Loosing Focus

PostPosted: Fri Apr 26, 2013 8:05 pm
by Antonio Mart.