home *** CD-ROM | disk | FTP | other *** search
- /*
- Function: GKeyStep()
- Purpose: Alternate for GetApplyKey() for step entry (dates and numerics)
- Author: Greg Lief
- Copyright (c) 1991 Greg Lief
- Dialect: Clipper 5.01
- */
-
- #include "inkey.ch"
- #include "getexit.ch"
-
- procedure gkeystep(get, key)
- local cKey
- local oldvalue
-
- //───── check for SET KEY and basic movement keys
- if ! GKeyBasic(get, key)
- do case
-
- case (key == K_INS)
- Set( _SET_INSERT, ! Set(_SET_INSERT) )
- setcursor( if(set(_SET_INSERT), 3, 1) )
-
- case (key == K_CTRL_U)
- get:Undo()
-
- case (key == K_HOME)
- get:Home()
-
- case (key == K_END)
- get:End()
-
- case (key == K_RIGHT)
- get:Right()
-
- case (key == K_LEFT)
- get:Left()
-
- case (key == K_CTRL_RIGHT)
- get:WordRight()
-
- case (key == K_CTRL_LEFT)
- get:WordLeft()
-
- case (key == K_BS)
- get:BackSpace()
-
- case (key == K_DEL)
- get:Delete()
-
- case (key == K_CTRL_T)
- get:DelWordRight()
-
- case (key == K_CTRL_Y)
- get:DelEnd()
-
- case (key == K_CTRL_BS)
- get:DelWordLeft()
-
- otherwise
-
- if (key >= 32 .and. key <= 255)
- cKey := chr(key)
- //───── test for step entry on numerics and dates
- if cKey $ '-+' .and. get:type $ "ND"
- oldvalue := get:varGet()
- get:changed := .t.
- if cKey == "-"
- get:varPut(get:varGet() - 1)
- else
- get:varPut(get:varGet() + 1)
- endif
- if get:postBlock != NIL .and. ! eval(get:postBlock, get)
- get:varPut(oldvalue)
- endif
- get:updateBuffer()
- else
- if ( Set(_SET_INSERT) )
- get:Insert(cKey)
- else
- get:Overstrike(cKey)
- endif
- if (get:typeOut .and. !Set(_SET_CONFIRM) )
- if ( Set(_SET_BELL) )
- ?? Chr(7)
- endif
- get:exitState := GE_ENTER
- endif
- endif
- endif
- endcase
- endif
- return
-