DCGET Valid condition

This forum is for eXpress++ general support.
Post Reply
Message
Author
Maxz
Posts: 49
Joined: Sun Jan 09, 2022 12:11 pm

DCGET Valid condition

#1 Post by Maxz »

In a particular GET sequence (typically the 1st) Is it possible to perform a validation only if the content of the variable has been modified?

@ DCGET var1 VALID {|| Check_Load() }
@ DCGET var2
@ DCGET var3
...

DCREAD GUI

function Check_Load
LOCAL lRet:=.F.
SEEK var1
IF FOUND()
load_data()
lRet:=.T.
ENDIF
RETURN lRet


if the first get of the sequence loads for example the data from a database record (using Valid clause), every time you confirm the last get of sequence, automatically you return to the first one by reloading all the data again (because VALID clause is performed always using ENTER key )

thanks

max

Maxz
Posts: 49
Joined: Sun Jan 09, 2022 12:11 pm

Re: DCGET Valid condition

#2 Post by Maxz »

I've found this statement in Valid clause searching in Xsample1.prg:

VALID {|o| IIF(o:get:changed, Check_Load() ,.T.)}

Seems to work well.

skiman
Posts: 1183
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: DCGET Valid condition

#3 Post by skiman »

Hi,

Just for your information, If you want to avoid to return to the first get when you enter on the last, there is ENTEREXIT as an option for dcgetoptions.
Best regards,

Chris.
www.aboservice.be

Maxz
Posts: 49
Joined: Sun Jan 09, 2022 12:11 pm

Re: DCGET Valid condition

#4 Post by Maxz »

from Express doc:
ENTEREXIT will exit the dialog if the ENTER key is pressed. The
exact behavior is determined by the DC_EnterExitMode() function.
The default behavior is to exit the dialog when the ENTER keys is
pressed in the "last GET"
. If this option is not used, then pressing
the ENTER key in the last GET will cause the first GET to receive
focus provided that SET WRAP is ON, otherwise pressing ENTER in the
last GET will have no affect.

my purpose is to keep the LOOP of the GETs but not validate the first GET, responsible for loading the data during its validation

if that function is enabled, I exit the sequence as soon as I press enter in the last input field

Post Reply