2011-02-06 10:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbct/keysec.prg
  * contrib/hbct/keytime.prg
    ! Fixed KEYSEC() and KEYTIME() functions to work.
      They used xhb specific __KEYBOARD() extension, now 
      swapped for HB_KEYPUT().
      Reported by Georgewf.
    ! Fixed KEYSEC() to work around midnight.
    * Formatting.
This commit is contained in:
Viktor Szakats
2011-02-06 09:39:16 +00:00
parent 40a3e1d9e4
commit a78f123db5
3 changed files with 38 additions and 25 deletions

View File

@@ -16,6 +16,16 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-02-06 10:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbct/keysec.prg
* contrib/hbct/keytime.prg
! Fixed KEYSEC() and KEYTIME() functions to work.
They used xhb specific __KEYBOARD() extension, now
swapped for HB_KEYPUT().
Reported by Georgewf.
! Fixed KEYSEC() to work around midnight.
* Formatting.
2011-02-06 03:04 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbnetio/utils/hbnetio/netiosrv.prg
* contrib/hbnetio/utils/hbnetio/netiocon.prg

View File

@@ -58,7 +58,7 @@ FUNCTION KeySec( nKey, nTime, nCounter, lMode )
LOCAL nSeconds
IF t_hIdle != NIL
HB_IDLEDEL( t_hIdle )
hb_idleDel( t_hIdle )
t_hIdle := NIL
ENDIF
@@ -68,6 +68,7 @@ FUNCTION KeySec( nKey, nTime, nCounter, lMode )
ELSEIF nTime < 0
nTime := -nTime / 18.2
ENDIF
nTime *= 1000
IF ! ISNUMBER( nCounter )
nCounter := 1
ENDIF
@@ -75,8 +76,8 @@ FUNCTION KeySec( nKey, nTime, nCounter, lMode )
lMode := .F.
ENDIF
nSeconds := SECONDS()
t_hIdle := HB_IDLEADD( {|| doKeySec( nKey, nTime, lMode, ;
nSeconds := hb_milliSeconds()
t_hIdle := hb_idleAdd( {|| doKeySec( nKey, nTime, lMode, ;
@nCounter, @nSeconds ) } )
RETURN .T.
ENDIF
@@ -84,17 +85,17 @@ FUNCTION KeySec( nKey, nTime, nCounter, lMode )
RETURN .F.
STATIC PROCEDURE doKeySec( nKey, nTime, lMode, nCounter, nSeconds )
LOCAL nSec := SECONDS()
LOCAL nSec := hb_milliSeconds()
IF lMode .AND. ! EMPTY( NEXTKEY() )
IF lMode .AND. ! Empty( NextKey() )
nSeconds := nSec
ELSEIF nCounter != 0 .AND. nSec - nSeconds >= nTime
__KEYBOARD( nKey )
hb_keyPut( nKey )
IF nCounter > 0
nCounter--
ENDIF
IF nCounter == 0
HB_IDLEDEL( t_hIdle )
hb_idleDel( t_hIdle )
t_hIdle := NIL
ELSE
nSeconds := nSec

View File

@@ -58,57 +58,59 @@ FUNCTION KeyTime( nKey, cClockTime )
LOCAL nHour, nMin, nSec, nLast
IF t_hIdle != NIL
HB_IDLEDEL( t_hIdle )
hb_idleDel( t_hIdle )
t_hIdle := NIL
ENDIF
IF ISNUMBER( nKey ) .AND. ISCHARACTER( cClockTime )
nHour := VAL( SUBSTR( cClockTime, 1, 2 ) )
nMin := VAL( SUBSTR( cClockTime, 4, 2 ) )
nSec := VAL( SUBSTR( cClockTime, 7, 2 ) )
nHour := Val( SubStr( cClockTime, 1, 2 ) )
nMin := Val( SubStr( cClockTime, 4, 2 ) )
nSec := Val( SubStr( cClockTime, 7, 2 ) )
nLast := -1
t_hIdle := HB_IDLEADD( {|| doKeyTime( nKey, cClockTime, nHour, nMin, nSec, ;
t_hIdle := hb_idleAdd( {|| doKeyTime( nKey, cClockTime, nHour, nMin, nSec, ;
@nLast ) } )
RETURN .T.
ENDIF
RETURN .F.
RETURN .F.
STATIC PROCEDURE doKeyTime( nKey, cClockTime, nHour, nMin, nSec, nLast )
LOCAL ccTime := TIME()
LOCAL nHr := VAL( SUBSTR( ccTime, 1, 2 ) )
LOCAL nMn := VAL( SUBSTR( ccTime, 4, 2 ) )
LOCAL nSc := VAL( SUBSTR( ccTime, 7, 2 ) )
LOCAL ccTime := Time()
LOCAL nHr := Val( SubStr( ccTime, 1, 2 ) )
LOCAL nMn := Val( SubStr( ccTime, 4, 2 ) )
LOCAL nSc := Val( SubStr( ccTime, 7, 2 ) )
IF nHour == 99
IF nHr > nLast
__KEYBOARD( nKey )
hb_keyPut( nKey )
nLast := nHr
IF nHr == 23
HB_IDLEDEL( t_hIdle )
hb_idleDel( t_hIdle )
t_hIdle := NIL
ENDIF
ENDIF
ELSEIF nMin == 99 .AND. nHr == nHour
IF nMn > nLast
__KEYBOARD( nKey )
hb_keyPut( nKey )
nLast := nMn
IF nMn == 59
HB_IDLEDEL( t_hIdle )
hb_idleDel( t_hIdle )
t_hIdle := NIL
ENDIF
ENDIF
ELSEIF nSec == 99 .AND. nHr == nHour .AND. nMn == nMin
IF nSc > nLast
__KEYBOARD( nKey )
hb_keyPut( nKey )
nLast := nSc
IF nSc == 59
HB_IDLEDEL( t_hIdle )
hb_idleDel( t_hIdle )
t_hIdle := NIL
ENDIF
ENDIF
ELSEIF ccTime > cClockTime
__KEYBOARD( nKey )
HB_IDLEDEL( t_hIdle )
hb_keyPut( nKey )
hb_idleDel( t_hIdle )
t_hIdle := NIL
ENDIF
RETURN