program INFTST,1.0(101) ! handy program for testing INFLD !------------------------------------------------------------------------- !NOTES: ! To test several field types (or particularly, variations on a ! theme like dates), just change the DATA statements below, and ! change the NUM_FIELDS definition to match the number of ! field data statements (up to 9). Also, you may want to change ! the GLOBAL'TYPES string (these will be added to each field). !------------------------------------------------------------------------- !EDIT HISTORY ![101] October 29, 2005 01:44 PM Edited by joaquin ! Created !------------------------------------------------------------------------- ++include ashinc:ashell.def MAP1 GLOBAL'TYPES,S,20,"|G||Cg12345T" ! Variations of date params: xmax, xmin, type, initial value DATA 6,6,"D","050199" DATA 6,6,"D","" DATA 6,6,"d","" DATA 6,0,"D","" DATA 8,0,"D>","20030228" DATA 8,8,"DO","25122001" DATA 1,1,"YN||c|E||b","Y" define NUM_FIELDS = 7 ! number of fields (# of data statements) MAP1 INFLD'PARAMS MAP2 EXITCODE,F MAP2 INXCTL,F MAP2 TIMER,F MAP2 CMDFLG,F MAP2 ENTRY,S,20 MAP2 TYPE,S,40 MAP2 ROW,B,1 MAP2 COL,B,1 MAP2 SETDEF,S,30 MAP2 HLPIDX,S,100 MAP2 MAXCHRS,B,1 MAP2 INFOPC,B,1 MAP1 DATES(NUM_FIELDS) MAP2 D'TYPE,S,40 MAP2 D'ENTRY,S,12 MAP2 D'XMAX,B,1 MAP2 D'XMIN,B,1 MAP1 MISC MAP2 FNO,F,6 MAP2 RC,F MAP1 INFCLR tprint tab(-1,0);"Test INFLD " for FNO = 1 to NUM_FIELDS read D'XMAX(FNO),D'XMIN(FNO),D'TYPE(FNO),D'ENTRY(FNO) next FNO ! Display column headers tprint tab(3,3);"Max,Min";tab(3,12);"Type";tab(3,22);"Entry"; tprint tab(3,55);"Exitcode";tab(3,64);"Entry" DISPLAY: ! display fields... INFOPC = 2 for FNO = 1 to NUM_FIELDS call INFLD next FNO ! ask if we should edit them xcall MSGBOX,"Do you want to edit the fields?", & "INFLD Date Test", MBTN_YES_NO, MBICON_QUESTION, & MBMISC_TASKMODAL,RC if RC = MBRC_NO goto DONE'PROG ! input dates until we hit the end or hit ESC FNO = 0 INFOPC = 1 LOOP: FNO = FNO + 1 if FNO > NUM_FIELDS goto DONE'EDITING FIELD: call INFLD if EXITCODE = 1 goto DONE'EDITING if EXITCODE = 2 or EXITCODE = 3 then FNO = FNO - 1 if FNO < 1 goto DONE'EDITING else goto FIELD endif if EXITCODE < -100 then FNO = abs(EXITCODE)-100 goto FIELD endif goto LOOP DONE'EDITING: ! ask if we should do it again xcall MSGBOX,"Do you want to re-display the fields?", & "INFLD Date Test", MBTN_YES_NO, MBICON_QUESTION, & MBMISC_TASKMODAL,RC if RC = MBRC_YES goto DISPLAY DONE'PROG: tprint tab(22,1);"End" end !--------------------------------------------------------------------- ! Perform a single INFLD input or output operation ! Inputs: ! FNO (field #), INFOPC (opcode), plus all other INFLD params ! Outputs: ! Updated D'ENTRY(FNO), EXITCODE ! Notes: ! Displays field label containing xmax,xmin,type,entry, plus ! on exit displays updated entry and exitcode !--------------------------------------------------------------------- INFLD: ROW = FNO*2 + 3 ! Add global TYPE codes... TYPE = D'TYPE(FNO) + GLOBAL'TYPES ! display info tprint tab(ROW,3);D'XMAX(FNO)",";D'XMIN(FNO); & tab(ROW,12);TYPE;tab(ROW,22);D'ENTRY(FNO); xcall INFLD,ROW,40,D'XMAX(FNO),D'XMIN(FNO),TYPE, & D'ENTRY(FNO),INXCTL,1,INFOPC,EXITCODE,TIMER,CMDFLG,-1,-1,-1,SETDEF,& 0,">Sample tool tip~"+chr(7)+chr(250)+str(100+FNO)+".", & MAXCHRS if INFOPC < 2 then tprint tab(ROW,55);EXITCODE;tab(ROW,64);D'ENTRY(FNO); else tprint tab(ROW,55);tab(-1,9); endif return