xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

SetLastKey()

Changes the return value of function LastKey()

Syntax

SetLastKey( <nKey> ) --> cNullString

Arguments

<nKey>
This is the numeric Inkey() code of the key to set function LastKey() to. Refer to the file Inkey.ch for #define constants that can be used for <nKey>.

Return

The function changes the return value of LastKey() to <nKey> and returns a null string ("")

Info

See also:Inkey(), LastKey(), NextKey()
Category: CT:Settings , Keyboard functions
Header:Inkey.ch
Source:ct\setlast.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example changes LastKey() to K_ESC as soon as an
// alphabetic key is pressed

   #include "Inkey.ch"

   PROCEDURE Main
      LOCAL nKey := 0

      CLS

      DO WHILE LastKey() <> K_ESC
         nKey := Inkey(0.1)

         @ 0,0 SAY "Inkey code: "
         ?? nKey

         IF IsAlpha( Chr(nKey) )
            SetLastKey( K_ESC )
         ENDIF

      ENDDO
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe