Files
harbour-core/harbour/contrib/hbnf/numlock.c
Viktor Szakats 1de11ac355 2009-06-14 00:52 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/gtwvg/gtwvg.c
  * contrib/gtwvg/wincallb.c
  * contrib/gtwvg/wvgcore.c
  * contrib/gtwvg/wvgcuig.c
  * contrib/gtwvg/wvgutils.c
  * contrib/gtwvg/wvgwin.c
  * contrib/hbbmcdx/bmdbfcdx.c
  * contrib/hbbtree/hb_btree.c
  * contrib/hbclipsm/environ.c
  * contrib/hbclipsm/gauge.c
  * contrib/hbclipsm/num.c
  * contrib/hbclipsm/status.c
  * contrib/hbct/addascii.c
  * contrib/hbct/asciisum.c
  * contrib/hbct/ascpos.c
  * contrib/hbct/atadjust.c
  * contrib/hbct/atnum.c
  * contrib/hbct/atrepl.c
  * contrib/hbct/bitnum.c
  * contrib/hbct/charevod.c
  * contrib/hbct/charlist.c
  * contrib/hbct/charmirr.c
  * contrib/hbct/charmix.c
  * contrib/hbct/charone.c
  * contrib/hbct/charonly.c
  * contrib/hbct/charop.c
  * contrib/hbct/charrepl.c
  * contrib/hbct/charsort.c
  * contrib/hbct/charsprd.c
  * contrib/hbct/charswap.c
  * contrib/hbct/color.c
  * contrib/hbct/count.c
  * contrib/hbct/ctc.c
  * contrib/hbct/ctmath2.c
  * contrib/hbct/ctnet.c
  * contrib/hbct/ctpad.c
  * contrib/hbct/ctstr.c
  * contrib/hbct/ctstrfil.c
  * contrib/hbct/ctwfunc.c
  * contrib/hbct/datetime.c
  * contrib/hbct/dattime2.c
  * contrib/hbct/disk.c
  * contrib/hbct/expand.c
  * contrib/hbct/files.c
  * contrib/hbct/finan.c
  * contrib/hbct/justify.c
  * contrib/hbct/keyset.c
  * contrib/hbct/lton.c
  * contrib/hbct/maxline.c
  * contrib/hbct/misc1.c
  * contrib/hbct/num1.c
  * contrib/hbct/numat.c
  * contrib/hbct/numcount.c
  * contrib/hbct/numline.c
  * contrib/hbct/pos1.c
  * contrib/hbct/pos2.c
  * contrib/hbct/posdiff.c
  * contrib/hbct/print.c
  * contrib/hbct/range.c
  * contrib/hbct/relation.c
  * contrib/hbct/remove.c
  * contrib/hbct/replace.c
  * contrib/hbct/screen1.c
  * contrib/hbct/screen2.c
  * contrib/hbct/setrc.c
  * contrib/hbct/strdiff.c
  * contrib/hbct/strswap.c
  * contrib/hbct/tab.c
  * contrib/hbct/token1.c
  * contrib/hbct/token2.c
  * contrib/hbct/trig.c
  * contrib/hbct/video.c
  * contrib/hbct/wordrepl.c
  * contrib/hbct/wordtoch.c
  * contrib/hbcurl/hbcurl.c
  * contrib/hbcurl/hbcurlm.c
  * contrib/hbfbird/firebird.c
  * contrib/hbfimage/fi_wrp.c
  * contrib/hbgd/gdwrp.c
  * contrib/hbgt/ascposgt.c
  * contrib/hbgt/atdiff.c
  * contrib/hbgt/bitflags.c
  * contrib/hbgt/charmixg.c
  * contrib/hbgt/chrcount.c
  * contrib/hbgt/chrfirst.c
  * contrib/hbgt/chrtotal.c
  * contrib/hbgt/strcount.c
  * contrib/hbgt/strcspn.c
  * contrib/hbgt/strdiffg.c
  * contrib/hbgt/strleft.c
  * contrib/hbgt/strpbrk.c
  * contrib/hbgt/strright.c
  * contrib/hbmisc/dates2.c
  * contrib/hbmisc/hb_f.c
  * contrib/hbmisc/stringsx.c
  * contrib/hbmysql/mysql.c
  * contrib/hbmzip/hbmzip.c
  * contrib/hbnf/caplock.c
  * contrib/hbnf/chdir.c
  * contrib/hbnf/color2n.c
  * contrib/hbnf/ftattr.c
  * contrib/hbnf/fttext.c
  * contrib/hbnf/getenvrn.c
  * contrib/hbnf/mkdir.c
  * contrib/hbnf/n2color.c
  * contrib/hbnf/numlock.c
  * contrib/hbnf/peek.c
  * contrib/hbnf/poke.c
  * contrib/hbnf/prtscr.c
  * contrib/hbnf/putkey.c
  * contrib/hbnf/rmdir.c
  * contrib/hbodbc/odbc.c
  * contrib/hbqt/hbqt_qradiobutton.cpp
  * contrib/hbqt/qth/QRadioButton.qth
  * contrib/hbsqlit3/hbsqlit3.c
  * contrib/hbssl/ssl.c
  * contrib/hbssl/sslciph.c
  * contrib/hbtip/utils.c
  * contrib/hbwin/legacyc.c
  * contrib/hbwin/olecore.c
  * contrib/hbwin/wapi_commctrl.c
  * contrib/hbwin/wapi_winbase.c
  * contrib/hbwin/wapi_winuser.c
  * contrib/hbwin/win_dll.c
  * contrib/hbwin/win_misc.c
  * contrib/hbwin/win_prn1.c
  * contrib/hbwin/win_prn2.c
  * contrib/hbwin/win_prt.c
  * contrib/rddads/ads1.c
  * contrib/rddads/adsfunc.c
  * contrib/rddads/adsmgmnt.c
  * contrib/xhb/datesxhb.c
  * contrib/xhb/fparse.c
  * contrib/xhb/freadlin.c
  * contrib/xhb/hbcomprs.c
  * contrib/xhb/hboutdbg.c
  * contrib/xhb/txtline.c
  * contrib/xhb/xhbarr.c
  * contrib/xhb/xhbcopyf.c
  * contrib/xhb/xhbfunc.c
  * contrib/xhb/xhbsave.c
  * contrib/xhb/xhbtrim.c
  * contrib/xhb/xstrdel.c
    * IS*() -> HB_IS*() macro rename.
      (pass 3 - final)
2009-06-13 22:57:48 +00:00

108 lines
2.6 KiB
C

/*
* $Id$
*/
/*
* File......: numlock.c
* Author....: Ted Means
* CIS ID....: 73067,3332
*
* This function is an original work by Ted Means and is placed in the
* public domain.
*
* Modification history:
* ---------------------
*
* Rev 1.3 15 Jul 1993 00:08:46 GLENN
* Changed reference to status_byte in order to make this work in
* protected mode.
*
* Rev 1.2 15 Aug 1991 23:08:12 GLENN
* Forest Belt proofread/edited/cleaned up doc
*
* Rev 1.1 27 May 1991 14:43:20 GLENN
* Ted added a parameter to toggle the Numlock on or off.
*
* Rev 1.0 01 Apr 1991 01:02:50 GLENN
* Nanforum Toolkit
*
*
*/
/* $DOC$
* $FUNCNAME$
* FT_NUMLOCK()
* $CATEGORY$
* Keyboard/Mouse
* $ONELINER$
* Return status of NumLock key
* $SYNTAX$
* FT_NUMLOCK( [ <lNewSetting> ] ) -> lCurrentSetting
* $ARGUMENTS$
* <lNewSetting> is optional and if supplied is the new setting
* for the CapLock key. Specify .T. to turn CapLock on, or .F. to
* turn it off.
* $RETURNS$
* lValue is .T. if NumLock is set, .F. if it isn't set. The value
* returned represents the setting in effect prior to any changes that
* might by made by <lNewSetting>.
* $DESCRIPTION$
* This function is useful if you need to know or set the status of the
* NumLock key for some reason.
* $EXAMPLES$
* IF FT_NUMLOCK()
* Qout( "NumLock is active" )
* ENDIF
*
* Another one, slightly strange, courtesy of Glenn Scott:
*
*
* function numBlink()
* local lOldNum := ft_numlock()
*
* while inkey( .5 ) != 27
* ft_numlock( !ft_numlock() )
* end
*
* return ft_numlock( lOldNum )
* $SEEALSO$
* FT_CAPLOCK() FT_CTRL() FT_PRTSCR() FT_SHIFT() FT_ALT()
* $END$
*/
#include "hbapigt.h"
#include "hbapiitm.h"
HB_FUNC( FT_NUMLOCK )
{
int iState = 0, iNewState;
HB_GT_INFO gtInfo;
memset( &gtInfo, 0, sizeof( gtInfo ) );
hb_gtInfo( HB_GTI_KBDSHIFTS, &gtInfo );
if( gtInfo.pResult )
{
iState = hb_itemGetNI( gtInfo.pResult );
gtInfo.pNewVal = gtInfo.pResult;
gtInfo.pResult = NULL;
}
if( HB_ISLOG( 1 ) )
{
iNewState = hb_parl( 1 ) ? ( iState | HB_GTI_KBD_NUMLOCK ) :
( iState & ~HB_GTI_KBD_NUMLOCK );
gtInfo.pNewVal = hb_itemPutNI( gtInfo.pNewVal, iNewState );
hb_gtInfo( HB_GTI_KBDSHIFTS, &gtInfo );
}
if( gtInfo.pNewVal )
hb_itemRelease( gtInfo.pNewVal );
if( gtInfo.pResult )
hb_itemRelease( gtInfo.pResult );
hb_retl( ( iState & HB_GTI_KBD_NUMLOCK ) != 0 );
}