VALID and HIDE

This forum is for eXpress++ general support.
Post Reply
Message
Author
gnewcomb
Posts: 17
Joined: Thu Jan 28, 2010 7:06 pm
Location: Colorado Springs, Colorado USA

VALID and HIDE

#1 Post by gnewcomb »

Can someone explain why after the execution of the valid in example 1 the focus is set on the appropriate Amount get, but in example 2 the focus remains on the Work Order Type get? After a second execution of the valid in example 2 the focus is set to the appropriate Amount get.

Code: Select all

// example 1
Procedure Main()

LOCAL GetList[0], GetOptions, cWorkOrderType, cValidType, nAmountA, nAmountB

DCGETOPTIONS AUTORESIZE

cWorkOrderType := cValidType := SPACE(1)
nAmountA := nAmountB := 0

@ 1,0 DCSAY 'Work Order Type' GET cWorkOrderType ;
   VALID {|| cWorkOrderType $ 'AB' }

@ 2,0 DCSAY 'Amount A' GET nAmountA ;
   HIDE {|| cWorkOrderType # 'A' }

@ 2,0 DCSAY 'Amount B' GET nAmountB ;
   HIDE {|| cWorkOrderType # 'B' }

DCREAD GUI FIT ADDBUTTONS OPTIONS GetOptions

RETURN

Code: Select all

// example 2
Procedure Main()

LOCAL GetList[0], GetOptions, cWorkOrderType, cValidType, nAmountA, nAmountB

DCGETOPTIONS AUTORESIZE

cWorkOrderType := cValidType := SPACE(1)
nAmountA := nAmountB := 0

@ 1,0 DCSAY 'Work Order Type' GET cWorkOrderType ;
   VALID {|| IIF( cWorkOrderType $ 'AB', ( cValidType := cWorkOrderType, .t. ), .f. ) }

@ 2,0 DCSAY 'Amount A' GET nAmountA ;
   HIDE {|| cValidType # 'A' }

@ 2,0 DCSAY 'Amount B' GET nAmountB ;
   HIDE {|| cValidType # 'B' }

DCREAD GUI FIT ADDBUTTONS OPTIONS GetOptions

RETURN

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: VALID and HIDE

#2 Post by Tom »

The VALID clause is evaluated before something happens to the second get and it's HIDE clause. This should work:
Procedure Main()

LOCAL GetList[0], GetOptions, cWorkOrderType, cValidType, nAmountA, nAmountB

DCGETOPTIONS AUTORESIZE

cWorkOrderType := cValidType := SPACE(1)
nAmountA := nAmountB := 0

@ 1,0 DCSAY 'Work Order Type' GET cWorkOrderType ;
VALID {|| IIF( cWorkOrderType $ 'AB', ( cValidType := cWorkOrderType, DC_GetRefresh(oObject),SetAppFocus(oObject), .t. ), .f. ) }

@ 2,0 DCSAY 'Amount A' GET nAmountA GETOBJECT oObject ;
HIDE {|| cValidType # 'A' }

@ 2,0 DCSAY 'Amount B' GET nAmountB ;
HIDE {|| cValidType # 'B' }

DCREAD GUI FIT ADDBUTTONS OPTIONS GetOptions

RETURN
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply