home *** CD-ROM | disk | FTP | other *** search
- *****************************************************************
- FUNCTION VRULER
- *****************************************************************
-
- * Display a calibrated vertical ruler line
-
- * Copyright(c) 1991 - James Occhiogrosso
-
- # include "inkey.ch"
- # include "setcurs.ch"
-
- LOCAL keypress := 0, old_color, old_cursor, old_screen, ;
- old_row := ROW(), old_col := COL(), ;
- v_col := INT(MAXCOL()/2), v_ruler := '', v_row := 0
-
- * Save entry conditions
- old_cursor = SETCURSOR(SC_NONE)
- old_color = SETCOLOR(colbarhi)
- old_screen = SCRNSAVE(0, v_col, MAXROW(), v_col)
-
-
- * Display vertical ruler
- @ 0, v_col SAY '┬'
- @ MAXROW(), v_col SAY '┴'
- FOR counter = 1 TO (MAXROW() - 1)
- * Display double horizontal marks on each 5th row
- @ counter, v_col SAY IF(counter % 5 = 0, '╪', '┼')
- NEXT
-
- * Save ruler screen area
- v_ruler = SAVESCREEN(0, v_col, MAXROW(), v_col)
-
- DO WHILE keypress != K_ESC
- keypress = INKEY(0)
- SCRNREST(old_screen)
-
- * Adjust row and column for each arrow key pressed
- IF keypress = K_RIGHT
- v_col = IF(v_col < MAXCOL(), v_col+1, MAXCOL())
- old_screen = SCRNSAVE(0, v_col, MAXROW(), v_col)
-
- ELSEIF keypress = K_LEFT
- v_col = IF(v_col > 0, v_col-1, 0)
- old_screen = SCRNSAVE(0, v_col, MAXROW(), v_col)
-
- ENDIF
-
- * Display ruler in new position
- RESTSCREEN(0, v_col, MAXROW(), v_col, v_ruler)
-
- IF keypress = K_ALT_H
- * Display horizontal ruler line
- DO hruler
- ENDIF
-
- IF keypress = K_ALT_V
- * Display another vertical ruler
- DO vruler
- ENDIF
-
- ENDDO
-
- * Restore entry conditions and return
- SCRNREST(old_screen)
- SETPOS(old_row, old_col)
- SETCOLOR(old_color)
- SETCURSOR(old_cursor)
- RETURN NIL
-
-