Exiting when click out of a dialog

Post Reply
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Exiting when click out of a dialog

Post by Maurilio Viana »

When I click in a button I activate a dialog with NoWait clause. Is possible close this dialog if I click out of his area?
For example:

Dialog1 call Dialog2 (dialog2 is nowait), if I click in Dialog1 ou other screen area I want to close Dialog2.

Regards,
Maurilio
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Exiting when click out of a dialog

Post by Enrico Maria Giordano »

This is a working sample:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    @ 1, 1 BUTTON "Dialog2" ACTION DIALOG2( oDlg )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


STATIC FUNCTION DIALOG2( oMainDlg )

    LOCAL oDlg

    LOCAL oGet, cVar := SPACE( 30 )
    LOCAL oBut

    DEFINE DIALOG oDlg

    oDlg:bLostFocus = { || oBut:Click() }

    @ 1, 1 GET oGet VAR cVar OF oDlg

    @ 3, 1 BUTTON oBut PROMPT "&Close" ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER NOMODAL

    RETURN NIL
EMG
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Re: Exiting when click out of a dialog

Post by Maurilio Viana »

Thanks a lot, Enrico!

Regards,
Maurilio
Post Reply