home *** CD-ROM | disk | FTP | other *** search
- <<* APPCOND.INC *>>
- <<#
-
- procedure GenCondNoEdit
- begin
- pushmargin( 1 )
- GenColor( 0,'PROMPT' )
- #>>
- <<if Bracketed>>
- @ row,0 SAY ;
- "CONDITION: {A}dd {S}elect <PgUp> <PgDn> <Del> <Return> "
- <<elsif LiteBar>>
- <<* 1 2 3 4 5
- 0123456789012345678901234567890123456789012345678901234567890
- CONDITION: (A)dd (S)elect <PgUp> <PgDn> <Del> <Return>
- *>>
- @ row,0 SAY ;
- "CONDITION: (A)dd (S)elect <PgUp> <PgDn> <Del> <Return>"
- <<GenColor( 0,'HILITE' )>>
- @ row,12 SAY "(A)"
- @ row,19 SAY "(S)"
- @ row,30 SAY "PgUp"
- @ row,38 SAY "PgDn"
- @ row,46 SAY "Del"
- @ row,53 SAY "Return"
- <<GenColor( 0,'PROMPT' )>>
- @ row,61 SAY ""
- <<else>> <<*Simple*>>
- @ row,0 SAY;
- "CONDITION: (A)dd (S)elect <PgUp> <PgDn> <Del> <Return> "
- <<endif>>
- DO GetKey WITH choice,"AS"+PgUp+PgDn+DelRecord+Returnkey
- <<popmargin>>
- <<end GenCondNoEdit>>
-
-
- <<#
- procedure GenCondWithEdit <<*Allows (E)dit option: TYPE() function avail*>>
- begin
- pushmargin( 1 )
- GenColor( 0,'PROMPT' )
- #>>
- <<if Bracketed>>
- @ row,0 SAY;
- "CONDITION: {A}dd {E}dit {S}elect <PgUp> <PgDn> <Del> <Return> "
- <<elsif LiteBar>>
- <<* 1 2 3 4 5
- 01234567890123456789012345678901234567890123456789012345678901234
- CONDITION: (A)dd (E)dit (S)elect <PgUp> <PgDn> <Del> <Return>
- *>>
- @ row,0 SAY ;
- "CONDITION: (A)dd (E)dit (S)elect <PgUp> <PgDn> <Del> <Return>"
- <<GenColor( 0,'HILITE' )>>
- @ row,12 SAY "(A)"
- @ row,19 SAY "(E)"
- @ row,27 SAY "(S)"
- @ row,38 SAY "PgUp"
- @ row,46 SAY "PgDn"
- @ row,54 SAY "Del"
- @ row,61 SAY "Return"
- <<GenColor( 0,'PROMPT' )>>
- @ row,69 SAY ""
- <<else>>
- @ row,0 SAY;
- "CONDITION: (A)dd (E)dit (S)elect <PgUp> <PgDn> <Del> <Return> "
- <<endif>>
- DO GetKey WITH choice,"AES"+PgUp+PgDn+DelRecord+Returnkey
- <<popmargin>>
- <<end GenCondWithEdit>>
-
-
- <<procedure GenCondMain( IsTypeAvail : logical )>>
- <<begin>>
- PARAMETER expr
- PRIVATE row,rowTOP,recnum,recnumTOP
- PRIVATE newexpr,PagePaint,skipRECS,exprTOTAL
- SELECT H
- GOTO BOTTOM
- IF EOF()
- exprTOTAL = 0
- recnumTOP = 0
- ELSE
- exprTOTAL = RECNO()
- GOTO TOP
- recnumTOP = RECNO()
- ENDIF
- skipRECS = 18
- row = 23
- rowTOP = 2
- recnum = 0
- expr = ""
- newexpr = ""
- PagePaint = .T.
- *
- DO WHILE .T.
- IF PagePaint
- <<GenColor( 2,'WINDOW' )>>
- @ rowTOP,0 CLEAR
- <<GenColor( 2,'PROMPT' )>>
- @ rowTOP,0 SAY CHR(222) + REPLICATE( CHR(223),78 ) + CHR(221)
- @ rowTOP,34 SAY "<CONDITIONS>"
- @ row-1,0 SAY PromptBar
- @ rowTOP,0 SAY ""
- IF recnumTOP > 0
- GOTO recnumTOP
- ENDIF
- SET HEADING OFF
- LIST NEXT skipRECS SUBSTR( CondExpr,1,69 ) FOR CondArea = dbfarea
- SET HEADING ON
- PagePaint = .F.
- ENDIF
- IF "" = expr
- <<GenColor( 2,'PROMPT' )>>
- @ row-2,0
- ELSE
- <<GenColor( 2,'PROMPT' )>>
- @ row-2,0 SAY "<selected>"
- <<GenColor( 2,'HILITE' )>>
- @ row-2,11 SAY SUBSTR( expr,1,69 )
- ENDIF
- <<#
- if IsTypeAvail
- GenCondWithEdit
- else
- GenCondNoEdit
- endif
- #>>
- DO CASE
- CASE choice = Returnkey
- EXIT
- CASE choice = "A"
- * ---Add new CONDITION.
- DO {fileprefix}_EXPR WITH newexpr
- IF "" <> TRIM(newexpr)
- APPEND BLANK
- REPLACE CondExpr WITH newexpr,CondArea WITH dbfarea
- expr = CondExpr
- exprTOTAL = exprTOTAL + 1
- ENDIF
- PagePaint = .T.
- <<if IsTypeAvail>> <<*Allows (E)dit option*>>
- CASE choice = "E"
- * ---Edit CONDITION.
- DO GotoRec WITH row,recnum,exprTOTAL
- IF recnum > 0 .AND. CondArea = dbfarea
- recnumTOP = RECNO()
- @ row,0 GET CondExpr
- READ
- expr = CondExpr
- PagePaint = .T.
- ENDIF
- <<endif>>
- CASE choice = "S"
- * ---Select CONDITION.
- DO GotoRec WITH row,recnum,exprTOTAL
- IF recnum = 0 .OR. CondArea <> dbfarea
- expr = ""
- ELSE
- expr = CondExpr
- ENDIF
- CASE choice = PgDn
- IF .NOT. EOF()
- IF recnumTOP > 0
- GOTO recnumTOP
- ENDIF
- SKIP skipRECS
- IF EOF()
- GOTO BOTTOM
- ENDIF
- recnumTOP = RECNO()
- PagePaint = .T.
- ENDIF
- CASE choice = PgUp
- IF .NOT. BOF()
- IF recnumTOP > 0
- GOTO recnumTOP
- ENDIF
- SKIP -skipRECS
- IF BOF()
- GOTO TOP
- ENDIF
- recnumTOP = RECNO()
- PagePaint = .T.
- ENDIF
- CASE choice = DelRecord
- * ---Delete the record.
- DO GotoRec WITH row,recnum,exprTOTAL
- IF recnum > 0 .AND. CondArea = dbfarea
- DELETE
- PACK
- IF exprTOTAL > 0
- exprTOTAL = exprTOTAL - 1
- ENDIF
- GOTO TOP
- IF EOF()
- recnumTOP = 0
- expr = ""
- ELSE
- recnumTOP = RECNO()
- ENDIF
- PagePaint = .T.
- ENDIF
- ENDCASE
- ENDDO
- expr = TRIM( expr )
- SELECT &dbfarea
- <<end GenCondMain>>
-
-
- <<#
- procedure GenCondBody
- begin
- GenCondMain( true )
- end GenCondBody
-
- <<* EOF: APPCOND.INC *>>
- #>>