FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Valid, oJump and close
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Valid, oJump and close
Posted: Fri Sep 30, 2016 09:17 PM
Dear friends, In the following sample try to click on Close button: the focus will go on the third GET. Instead, I need the button to close the dialog. Only on pressing Enter the focus should go to the third GET. How to get this? Any ideas?

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oGet1, oGet3

    LOCAL nVar1 := 0
    LOCAL nVar2 := 0
    LOCAL nVar3 := 0

    DEFINE DIALOG oDlg;
           SIZE 800, 600

    @ 1, 1 GET oGet1 VAR nVar1;
           SIZE 100, 13;
           VALID ( IF( nVar1 = 0, oGet1:oJump := oGet3, ), .T. )

    @ 3, 1 GET nVar2;
           SIZE 100, 13

    @ 5, 1 GET oGet3 VAR nVar3;
           SIZE 100, 13

    @ 7, 1 BUTTON "Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
Posts: 102
Joined: Sat Jun 06, 2015 06:57 PM
Re: Valid, oJump and close
Posted: Fri Sep 30, 2016 10:29 PM

I think this might work.

Give the button a name, such as oBut1.

Then include the following line

oBut1:blclicked:= {||odlg:END()}

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: Valid, oJump and close
Posted: Fri Sep 30, 2016 10:33 PM
You can add the Cancel clause to the Button but then the valid will not execute.
Code (fw): Select all Collapse
   @ 7, 1 BUTTON "Close";
           ACTION oDlg:End() CANCEL
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Valid, oJump and close
Posted: Sat Oct 01, 2016 08:19 AM

Thank you, but the valid is disable with both suggestions. :-(

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Valid, oJump and close
Posted: Sat Oct 01, 2016 08:25 AM
Found!

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oGet2, oGet4, oBtn1

    LOCAL nVar1 := 0
    LOCAL nVar2 := 0
    LOCAL nVar3 := 0
    LOCAL nVar4 := 0

    DEFINE DIALOG oDlg;
           SIZE 800, 600

    @ 1, 1 GET nVar1;
           SIZE 100, 13;
           VALID !EMPTY( nVar1 )

    @ 3, 1 GET oGet2 VAR nVar2;
           SIZE 100, 13;
           VALID ( IF( nVar2 = 0 .AND. !oBtn1:lFocused, oGet2:oJump := oGet4, ), .T. )

    @ 5, 1 GET nVar3;
           SIZE 100, 13

    @ 7, 1 GET oGet4 VAR nVar4;
           SIZE 100, 13

    @ 9, 1 BUTTON oBtn1 PROMPT "Close";
           ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Valid, oJump and close
Posted: Sat Oct 01, 2016 01:52 PM
Enrico

Add this line after your close button .. it will keep any valids from firing .. hope that is the solution you are looking for ..

Rick Lipkin
Code (fw): Select all Collapse
oBtn2:lCancel := .t.
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Valid, oJump and close
Posted: Sat Oct 01, 2016 01:59 PM

Thank you. No, it's not the solution I needed. I already found the proper one. Please look at the sample in my previous message.

EMG

Posts: 102
Joined: Sat Jun 06, 2015 06:57 PM
Re: Valid, oJump and close
Posted: Sat Oct 01, 2016 06:59 PM

Clever. That effectively disables the valid clause from the one get without disabling all the others. Wish I had known that years ago

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Valid, oJump and close
Posted: Sat Oct 01, 2016 07:54 PM

In fact is better than that. You can control what to disable and what to enable using oBtn:lFocused as flag.

EMG

Continue the discussion