Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FUNCky - <b>name:</b> <b>keystat() - display status of numlock, caps lock etc.</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Name:     keystat() - display status of numlock, caps lock etc.
            capstext() - set string to display if caps lock is on
            numtext() - set string to display if num lock is on
            instext() - set string to display if insert is on
            scrltext() - set string to display if scroll lock is on
            blanktext() - set the character to use to blank the keystat area

  Usage:    <logical> = keystat(<logical>)
            capstext(<row>,<col>,<string>,[<attrib>])
            numtext(<row>,<col>,<string>,[<attrib>])
            instext(<row>,<col>,<string>,[<attrib>])
            scrltext(<row>,<col>,<string>,[<attrib>])
            blanktext(<char>)

  Params:        parameters for keystat():

                 Logical value, .T. to turn the key
                 status display on, .F. to turn it off

            parameters for the xxxtext() functions:

                 integer <row> - the row to display text on
                 integer <col> - the column to display text at
                 string <string> - the text to display when the
                 appropriate key status is on
                 integer <attrib> - the color to display the text in,
                 optional, if left off, then Clipper's standard
                 foreground color is used.

            parameter for blanktext()

                 string <char> - the character to use instead of a space
                 when the appropriate key status is off. This character
                 is used to blank the area under the text defined by the
                 xxxtext() functions. Useful for specifying a border
                 character to use when displaying the key status in the
                 border of a box.

  Returns:  keystat() returns a logical value, logical .T. if the
            key status display is active, .F. if it is not. The
            xxxtext() functions do not return anything.

 ---------------------------------- Example ---------------------------------

            * This example displays <NUM><CAPS><INS> in
            * white/blue in the upper right hand corner
            * whenever the appropriate key state is active:

            * turn off Clipper's insert status
            set scoreboard off

            * set up the text to display for each state,
            * do text for num lock
            numtext(0,64,"<NUM>",23)

            * do text for caps lock
            capstext(0,69,"<CAPS>",23)

            * do text for insert
            capstext(0,75,"<INS>",23)

            * there is a border around the screen, so set the blank
            * character to a line so that when the status is off, it
            * is the same as the border
            blanktext("-")

            * at this point, the text is set, but it is not
            * displayed until you issue a keystat(.T.). That
            * lets you setup the strings without displaying
            * them until your ready.

            * set up the read

            memvar = space(30)
            @ 10,0 say "Enter Text: " get memvar

            * turn key status on
            keystat(.T.)

            * do the read
            read

            * turn key status line off when not needed
            keystat(.F.)

  Note:     FUNCky automatically saves and restores the timer
            interrupt vector for you so there is no need to
            un-hook keystat() before you quit. However, it is
            necessary to disable keystat() before quitting because
            the text has a habit of reappearing after the final
            cls() before they get turned off.

            You can move status text around by simply calling it again
            with the new row/col coordinates. Be aware that the
            text is displayed on the video page that was defined
            at the time you issued the keystat(.T.) call. If you
            setpage() or setscreen() after you turn keystat() on
            the status text will still be displayed on the video page
            that was defined at the time you turned keystat() on.

  Warning!: Un-hook your keystat() before running external programs
            because the text will continue to display during
            the program your running. Some programs like
            Relational Report Writer from Concentric Data require
            that the timer vector be free and clear before they
            will run. If you need to use keystat() in an overlay,
            set up your status text in the main module of your
            application. this will ensure that the code that
            displays the status text is not contained in an overlay.
            If the interrupt driven code is in an overlay, you
            run the risk of swapping out the interrupt driven
            code if the overlay gets swap out. This usually
            results in a system hang.


See Also: clock12() clock24() kbdstat() insert()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson