` Printed Icetips Article

Icetips Article



Par2: Incremental locator delay
2001-11-16 -- Kevin Erskine
 
This is a template solution -- letting CW do what it wants....
 
Generated Code.... Blue code is standard CW generated code..
 
BRW1::Sort0:Locator.TakeKey PROCEDURE
 
ReturnValue          BYTE,AUTO
 
!---                                                  ! (BGN) Incremental Locator Delay
!---
!--- In order to reduce file I/O for Incremental locators, take the keycode and
!--- if there are more in the buffer continue until no more
!---
DelayUntilTime     LONG(0)                            ! Delay Field
eStdDelayTime      EQUATE(35)                         ! 35/100 of a second
!---
  CODE
  !---
  LOOP                                                ! Loop until no KeyCodes in Buffer
  !-
  ReturnValue = PARENT.TakeKey()
  !-
     DelayUntilTime = CLOCK() + eStdDelayTime         ! Set   Delay Time
     
     LOOP WHILE NOT KEYBOARD() |                      ! Pause Until  A KeyCode
            AND ABS(CLOCK() - DelayUntilTime) <= eStdDelayTime    ! OR TimeOut
                YIELD()                               ! Give other Processes time
     END
  !-
     IF KEYBOARD()                                    ! Is there another KeyCode
        ASK                                           ! Get Next KeyCode
        CYCLE                                         ! Process KeyCode
     ELSE
        BREAK                                         ! All Done
     END
  !-
  END
  !---                                                ! (END) Incremental Locator Delay
  RETURN ReturnValue

 
Template Code...
 
#!=============================================================================
#!=== (BGN) - Incremental Locator Delay
#!=============================================================================
#AT(%LocatorMethodDataSection),WHERE(INSTRING(', TakeKey',%EmbedParameters,1,1) AND
%LocatorType = 'Incremental')
!---                                        #




Printed November 21, 2024, 6:58 am
This article has been viewed/printed 35205 times.