Dialog Loosing Focus

Post Reply
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Dialog Loosing Focus

Post 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
Last edited by Detlef Hoefner on Tue Dec 06, 2005 5:43 pm, edited 1 time in total.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Dialog Loosing Focus

Post by Enrico Maria Giordano »

This sample works fine in FWH 2.7:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    oDlg:bLostFocus = { || MsgBeep() }

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL
EMG
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

No. This works fine either:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg;
           RESOURCE "TEST"

    oDlg:bLostFocus = { || MsgBeep() }

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL

Code: Select all

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
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Detlef,

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

Code: Select all

  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

  ACTIVATE DIALOG oDlg VALID msgBeep()
Regards,
Jamess
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Detlef,

Is it a non modal dialog ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Detlef Hoefner
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany
Contact:

Post 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
manuramos
Posts: 219
Joined: Mon Dec 26, 2005 7:25 pm
Location: Jerez de la Frontera (Spain)

You can't control dialog's focus

Post 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...
Nos Gusta Programar
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

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