ASC() | Преобразует символ в его код ASCII. |
CHR() | Преобразует код ASCII в его символьное значение. |
FKLABEL() | Возвращает имя функциональной клавиши. |
FKMAX() | Возвращает количество функциональных клавиш в виде константы. |
FT_MBUTPRS() | Retrieve button press status |
FT_MBUTREL() | Get mouse button release information |
FT_MCONOFF() | Turn mouse cursur off if in specified region |
FT_MCURSOR() | Set the mouse cursor |
FT_MDBLCLK() | Return true if a double click was detected |
FT_MDEFCRS() | Define the mouse cursor |
FT_MGETCOORD() | Get mouse cursor position (text coord.) and button status |
FT_MGETPAGE() | Get the display page for the mouse pointer |
FT_MGETPOS() | Get mouse cursor position and button status |
FT_MGETSENS() | Get the mouse sensitivity parameters |
FT_MGETX() | Get mouse cursor row position |
FT_MGETY() | Get mouse cursor column position |
FT_MHIDECRS() | Decrement internal mouse cursor flag and hide mouse cursor |
FT_MINIT() | Initialize the mouse driver, vars and return status of mouse |
FT_MINREGION() | Test if the mouse cursor is in the passed region |
FT_MMICKEYS() | Get mickeys |
FT_MRESET() | Reset mouse driver and return status of mouse |
FT_MSETCOORD() | Position the mouse cursor using text screen coordinates |
FT_MSETPAGE() | Set the display page for the mouse pointer |
FT_MSETPOS() | Position the mouse cursor using virtual screen coordinates |
FT_MSETSENS() | Set the mouse sensitivity parameters |
FT_MSHOWCRS() | Increment internal cursor flag and display mouse cursor |
FT_MVERSION() | Get the mouse driver version |
FT_MXLIMIT() | Set vertical bounds of mouse using virtual screen coord. |
FT_MYLIMIT() | Set horiz. bounds of mouse using virtual screen coordinates |
FT_SCANCODE() | Wait for keypress and return keyboard scan code |
INKEY() | Выделяет символ из буфера клавиатуры. |
LASTKEY() | Возвращает INKEY-код последней нажатой клавиши, извлеченной из буфера |
MCOL() | Determine the mouse cursor's screen column position |
MDBLCLK() | Determine the double-click speed threshold of the mouse |
MHIDE() | Hide the mouse pointer |
MLEFTDOWN() | Determine the press status of the left mouse button |
MPRESENT() | Determine if a mouse is present |
MRESTSTATE() | Re-establish the previous state of a mouse |
MRIGHTDOWN() | Determine the status of the right mouse button |
MROW() | Determine a mouse cursor's screen row position |
MSAVESTATE() | Save the current state of a mouse |
MSETBOUNDS() | Set screen boundaries for the mouse cursor |
MSETCLIP() | Define an inclusion region |
MSETCURSOR() | Determine a mouse's visibility |
MSETPOS() | Set a new position for the mouse cursor |
MSHOW() | Display the mouse pointer |
MSTATE() | Return the current mouse state |
NEXTKEY() | Считывает код нажатой клавиши в буфере клавиатуры. |
SETKEY() | Присваивает клавише блок кода. |
FKLABEL(<код клавиши>) --> символ
No arguments
FKLABEL() возвращает символьную строку, представляющую собой имя функциональной клавиши, заданной с помощью числового аргумента <код клавиши>. Если значение этого аргумента меньше 1 или больше 40, функция возвращает пустую строку ("").
FKLABEL() является эмулирующей функцией, которая используется для замены функции FKLABEL() в dBASE III PLUS. Там ее назначение, вероятно, заключается в том, чтобы создавать возможность перехода к различным машинам, но ее применение для пользователя ограничено. Обычно использование этой функции в xClipper-программах не рекомендуется.
Имена функциональных клавиш имеют вид Fn, где n изменяется от 1 до 40 и задается как аргумент <код клавиши>, а имя функциональной клавиши возвращается в виде аргумента FKLABEL().
FKMAX() --> максимальное число функциональных клавиш
No arguments
Returns NIL.
FKMAX() - это эмулирующая функция, используемая для замены функции FKMAX() в dBASE III PLUS. Там ее назначение, вероятно, заключается в том, чтобы создавать возможность перехода к различным машинам, но ее применение для пользователя ограничено.
Обычно использование этой функции в xClipper-программах не рекомендуется. Она просто возвращает константу 40, которую можно очень легко и более эффектно задать в программе в виде явной константы.
FT_MBUTPRS( <nButton> [, @nButPrs [, @nX [, @nY] ] ] ) -> nButStatus
<nButton> | is the mouse button number: |
0 - Left Button | |
1 - Right Button | |
2 - Middle Button [if applicable] | |
<nButPrs> | is the number of times the specified button was pressed |
since the last call to this routine. PASSED BY REFERENCE. | |
<nX> | is the X position of the cursor when the last press occurred. |
PASSED BY REFERENCE. | |
<nY> | is the Y position of the cursor when the last press occurred. |
PASSED BY REFERENCE. | |
An integer representing the button status:
0 - no buttons pressed 1 - left button pressed 2 - right button pressed 3 - left and right pressed 4 - middle pressed 5 - left and middle pressed 6 - middle and right buttons pressed 7 - all 3 buttons pressed
Retrieves the mouse button status and the position of the cursor when a button was last pressed.
IF Empty( FT_MBUTPRS(1) ) ? "No Item selected" ENDIF
FT_MBUTREL( nButton [, @nButRel [, @nX [, @nY] ] ]) -> nBStat
<nButton> | is the mouse button number |
0 - Left Button | |
1 - Right Button | |
2 - Middle Button [if applicable] | |
<nButRel> | is the number of times the specified button was released |
since the last call to this routine. PASSED BY REFERENCE. | |
<nX> | is the X position of the cursor when the last release occurred. |
PASSED BY REFERENCE. | |
<nY> | is the Y position of the cursor when the last release occurred. |
PASSED BY REFERENCE. |
<nBStat> - an integer representing button release status 0 - None 1 - Left 2 - Right 3 - Middle
This function returns the release status of the mouse buttons and the coordinates of the last release.
IF( FT_MBUTREL( 0 ) == 1 ) ? "Left button released" ENDIF
FT_MCONOFF( <nTop>, <nLeft>, <nBottom>, <nRight> )
This function tells the mouse driver to hide the cursor if it is in the given region. The driver hides the cursor by decrementing the cursor flag. A call to FT_MSHOWCRS is required to turn the cursor back on. Calling FT_MSHOWCRS also disables this function.
See FT_MSHOWCRS for a discussion of the cursor display flag.
FT_MCONOFF( 10, 10, 11, 20 )
FT_MCURSOR( [ <lState> ] ) -> lCursorState
A logical indicating the previous mouse cursor state.
This function works like most Clipper state functions. If no value is sent to FT_MCURSOR() it will return the state of the mouse cursor.
IF !( FT_MCURSOR() ) FT_MCURSOR( .T. ) ENDIF
FT_MDBLCLK( [ <nClick> [, <nButton> [, <nInterval> [, <nRow> [, <nCol>; [, <nTime> ] ] ] ] ] ] ) -> lIsDoubleClk
<nClick> | is a numeric value. If it is zero FT_MDBLCLK() will not |
check for the first press but rather will simply wait the | |
specified period for a single press. This is useful if this | |
routine is called from one which in turn responded to a button | |
press. If it is not present or not equal to 0, then FT_MDBLCLK() | |
will wait for two presses of the specified button. | |
<nButton> | is the mouse button number |
0 - Left Button | |
1 - Right Button | |
2 - Middle Button [if applicable] | |
<nInterval> | is the interval to wait for the first click if requested |
and the time to wait for the second. If not present then defaults | |
to 0.5 second. | |
<nRow> | is the row number for the mouse cursor location for a double click |
to be valid. If not present then the current position is taken as | |
the valid location. | |
<nCol> | is the column number for the mouse cursor location for a double |
click to be valid. If not present, then the current position is | |
taken as the valid location. | |
<nTime> | is an optional start time for the waiting period for the first |
click (of either one or two requested). If not given then the | |
time is set at entry into this routine. This is useful when this | |
routine is called from another routine which was called in | |
response to a mouse click but needs to know if a double click | |
has occurred |
.T. if a double click was detected.
This is a mouse meta function that checks for the presence of a double click.
IF FT_MISREGION( 10, 10, 11, 20 ) .AND.; FT_MDBLCLK(0,1,,FT_MGETX(),FT_MGETY()) && double click, right button && at current location with && default interval MnuItem1() ENDIF
FT_MDEFCRS( <nCrsType>, <nScrMask>, <nCrsMask> ) -> NIL
<nCrsType> | is the cursor type. A value of 0 indicates the software cursor |
(the default) and a value of 1 indicates the hardware cursor. | |
<nScrMask> | is the screen mask for the software cursor or the first scan |
line of the hardware cursor. See the description for more | |
information. | |
<nCrsMask> | is the cursor mask for the software cursor of the last scan |
line of the hardware cursor. See the description for more | |
information. |
In text mode the mouse cursor can either be a software generated or the actual hardware cursor. This routine allows one choose between them. The software cursor is the default and its effect on the character it covers is determined by the screen mask and the cursor mask. Both of these masks are 16 bit values (which in Clipper are passed as standard numerical values). The 16 bit masks are arranged in a manner identical to the way information is stored for each character cell on the screen. The low order 8 bits represent the actual character displayed while the high order bits represent the display atributes such as blinking, intensity and forground and background colors. The mask is represented in the diagram below:
Bit: |15 |14 12|11 |10 8|7 0| Function:|blink |background|intensity|foreground|character|
Blinking and high intensity are on when the bit is 1. The background and foreground indicate which colors are used for each. The software mouse cursor uses these two values by taking the mask from the screen cell it is on and performing a logical AND on each bit with the screen mask value. The result is then logically XOR'ed with the cursor mask value. Thus to keep the character the same but invert the foreground and background colors the following values would be used:
Bit: |15 |14 12|11 |10 8|7 0| Function:|blink |background|intensity|foreground|character| screen: | 0 | 111 | 0 | 111 |11111111 | =30719 cursor: | 0 | 111 | 0 | 111 |00000000 | =30464
The hardware cursor is the text cursor provided by the video board. One specifies the range of scan lines which are on using <nScrMask> and <nCrsMask>. The range of values is dependant upon the type of monitor. The first scan line is 0.
FT_MGETPOS( @<nX>, @<nY> ) -> nButtonStatus
an integer representing button status
- 0 for no button pressed - 1 for left pressed - 2 for right pressed - 3 for left and right pressed - 4 for middle pressed - 5 for left and middle pressed - 6 for right and middle pressed - 7 for all three buttons pressed
Loads cursor position into x and y coordinates passed by reference and returns the button status.
LOCAL nX, nY LOCAL nButton := FT_MGETCOORD( @nX, @nY ) ? "Mouse Row :", nX ? "Mouse Column :", nY ? "Button Status:", nButton
FT_MGETPAGE() -> <nPage>
No arguments
<nPage> is the display page on which the mouse is currently being displayed
This function gets the display page for the mouse cursor. The valid values of nPage is dependent upon the display mode. See FT_SETVPG() for changing the current video page
nPage = FT_MGETPAGE( ) // Gets the mouse cursor display page
FT_MGETPOS( @<nX>, @<nY> ) -> nButtonStatus
an integer representing button status
- 0 for no button pressed - 1 for left pressed - 2 for right pressed - 3 for left and right pressed - 4 for middle pressed - 5 for left and middle pressed - 6 for right and middle pressed - 7 for all three buttons pressed
Loads cursor position into x and y coordinates passed by reference and returns the button status. The coordinate system in text mode has eight virtual coordinates per character cell. Thus x=16 means that you are in the Row 2. The values returned by this routine when in text mode and with mouse driver versions 6 and above are multiples of 8. We have experience with drivers prior to that version
LOCAL nX, nY LOCAL nButton := FT_MGETPOS( @nX, @nY ) ? "Mouse Row :", nX ? "Mouse Column :", nY ? "Button Status:", nButton
FT_MGETSENS( <@nHoriz>, <@nVert>, <@nDouble> ) -> NIL
This function returns the current values of the mouse movement sensitivity parameters. The first two arguments control the amount of movement necessary to move the cursor a given amount. The third argument determines the threshold above which the mouse moves at twice the normal speed. For further discussion of these values see FT_MSETSENS()
FT_MGETSENS( @nHoriz, @nVert, @nDouble )
FT_MGETX() -> nRowPos
No arguments
<nRowPos> which is the row position of mouse in virtual screen coordinates.
Retrieves mouse's row position in virtual screen coordinates. The values returned are multiples of 8 when in text mode and with at least Microsoft drivers 6 and above.
? FT_MGETX()
FT_MGETY() -> nColPos
No arguments
<nColPos> Column position of mouse in virtual screen coordinates
Retrieves mouse's column position in virtual screen coordinates. The values returned are multiples of 8 when in text mode and with at least Microsoft drivers 6 and above.
? FT_MGETY()
FT_MHIDECRS() -> NIL
No arguments
Hides the mouse cursor. Make sure to turn the mouse cursor off when redrawing screens. The mouse cursor dutifully saves the screen under it, so if you draw over the mouse cursor it will create a "hole" in your screen when you move the mouse cursor.
Note: A call to FT_MHIDECRS() decrements a mouse driver variable which indicates whether the cursor is shown. The cursor is visible only when the variable = 0. Thus multiple calls to FT_MHIDECRS() require an equal number of calls to FT_MSHOWCRS() before the cursor will again be visible. Once the variable is 0 calls to FT_MSHOWCRS() does not increment the varaible above 0.
FT_MHIDECRS() @ 10, 10 to 20, 20 FT_MSHOWCRS()
FT_MINIT() -> lMouseStatus
No arguments
An logical representing the mouse status (.F. == mouse not installed)
Initializes the mouse drive, associated variables and returns mouse status. It checks to see if the mouse has been previously initialized and if so it does not reinitialize. The row and column limits of mouse movement is set to the maximum for the current video mode. Use FT_MSHOWCRS() to display the mouse cursor.
IF .NOT. FT_MINIT() ? "No mouse driver is installed" ENDIF
FT_MINREGION( <nT>, <nL>, <nB>, <nR> ) -> lInRegion
.T. if mouse is in specified region.
This function will check to see if the mouse cursor is within the confines of the specified region.
IF FT_MINREGION( 10, 10, 11, 20 ) nChoice := 1 ENDIF
FT_MMICKEYS( @<nX>, @<nY> ) -> NIL
<nX> and <nY> must be passed by reference to receive the mouse position in Mickeys.
FT_MMICKEYS( @nX, @nY ) ? nX ? nY
FT_MRESET() -> nMouseStatus
No arguments
An integer representing the mouse status (0 == mouse not installed)
Resets the mouse driver and returns mouse status. Use FT_MSHOWCRS() to display the mouse cursor. The mouse is set to allow it to cover the complete screen (as defined by MAXCOL() and MAXROW()). This is necessary because at least some versions of the mouse drivers do not operate according to the documentation when confronted with a 43 or 50 line screen.
Normally, FT_MINIT() should be used to initialize the mouse since it will not reinitialize if already done.
IF Empty( FT_MRESET() ) ? "No mouse driver is installed" ENDIF
FT_MSETPOS( <nX>, <nY> ) -> NIL
Positions mouse cursor on screen using text (normal row and column) coordinates.
FT_MSETCOORD( 10, 20 ) // position mouse cursor at row 10, col 20 // in text screen coordinates
FT_MSETPAGE( <@nPage> ) -> NIL
This function sets the display page for the mouse cursor. The valid values of nPage is dependent upon the display mode. See FT_SETVPG() for changing the current video page
FT_MSETPAGE( 1 ) // Sets the mouse cursor to page 1
FT_MSETPOS( <nX>, <nY> ) -> NIL
Positions mouse cursor on screen. The virtual coordinate system in text mode has eight virtual coordinates per character cell. Thus x=16 means that you are in the Row 2.
FT_MSETPOS( 10, 20 ) // position mouse cursor at row 10, col 20 // in virtual screen coordinates
FT_MSETSENS( <nHoriz>, <nVert>, <nDouble> ) -> NIL
<nHoriz> | is the sensitivity of the mouse on the horizontal axis. This |
value is the integer percentage of highest sensitivity and | |
thus has a range of 1 to 100. The default value is 50 and at | |
this setting about 3.2 inches of mouse movement will move | |
the mouse cursor across the screen. If NIL, the current | |
value is used. | |
<nVert> | is the relative sensitivity of the mouse on the vertical axis. |
The value is an integer percentage of the highest sensitivity | |
and thus has a range of 1 to 100. The default value is 50 and | |
requires about 2 inches of mouse movement will move from top | |
to bottom of the screen.If NIL, the current value is used. | |
<nDouble> | is the relative sensitivity of the mouse to doubling the ratio |
of cursor movement to mouse movement. The default | |
value is 50. If NIL, the current value is used. |
This function allows one to control the mouse movement sensitivity. The first two arguments control the amount of movement necessary to move the cursor a given amount. The values are the percentage of full sensitivity and the default values after installing the mouse driver is 50 which represents approximately 3.2 inches of horizontal and 2 inches of vertical mouse movement to cover the entire screen. A value of 100 requires about 0.9 inches of horizontal mouse movement to cover the screen from one side to the other.
The third argument changes the threshold above which the mouse moves at twice the normal speed. The value is a percentage of full sensitivity with the default (50) providing doubling at 64 mickeys per second.
NOTE: These values are NOT restored after resetting the mouse driver/ hardware. A well behaved application should reset them to the original value upon exiting.
NOTE: The above description is counter to all of the documentation I have available. However, it does not work the way it is documented with Microsoft drivers versions 6.16, 6.24, 7.04 and 8.20. The above movement values are documented to be the number of mickeys per 8 pixels and the double speed value as the number mickeys per second required to double the speed. Each of these values should range from 1 to 32K but the driver forces a maximum of 100. Also the documentation states that resetting the mouse will reset these values. This is not the case.
FT_MSETSENS( 75,75,50 ) // a little less mouse movement necessary.
FT_MSHOWCRS() -> NIL
No arguments
Displays the mouse cursor. Make sure to turn the mouse cursor off when redrawing screens. The mouse cursor dutifully saves the screen under it, so if you draw over the mouse cursor it will create a "hole" in your screen when you move the mouse cursor.
Note: A call to FT_MHIDECRS() decrements a mouse driver variable which indicates whether the cursor is shown. The cursor is visible only when the variable = 0. Thus multiple calls to FT_MHIDECRS() require an equal number of calls to FT_MSHOWCRS() before the cursor will again be visible. Once the variable is 0 calls to FT_MSHOWCRS() does not increment the variable above 0.
IF Empty( FT_MRESET() ) FT_MSHOWCRS() ENDIF
FT_MVERSION( <@nMinor>, <@nType>, <@nIRQ> ) -> <nMajor>
<nMajor> which is the major version number of the mouse driver.
This function returns the current values of the mouse driver version number and type. The major version would be 6 and the minor version would be 10 if the driver were version 6.10. The mouse type and IRQ numbers are also returned.
NOTE: It appears that the values reported when one starts the mouse driver actually have the minor version in hexadecimal! Thus on bootup my screen showed 6.24 but this routine returned 30 for the minor version number!
nMajor=FT_MVERSION( @nMinor ) IF (nMajor+nMinor/100)<7.2 ? "Sorry mouse driver version too old" RETURN ENDIF
FT_MXLIMIT( <nX1>, <nX2> ) -> NIL
Set maximum vertical bounds of mouse using virtual screen coordinates.
FT_MXLIMIT( 10, 20 )
FT_MYLIMIT( <nY1>, <nY2> ) -> NIL
Set maximum horizontal bounds of mouse using virtual screen coordinates.
FT_MYLIMIT( 10, 20 )
FT_SCANCODE() -> cCode
No arguments
A two-character string, corresponding to the keyboard scan code.
FT_SCANCODE() enables you to distinguish the different scancodes of similar keys (such as Grey minus versus regular minus), thus increasing the number of keys your input routine can recognize.
It works like INKEY(), in that it waits for a key to be pressed. The scan code consists of two bytes, which are returned as a two-character string.
For example, calling FT_SCANCODE() and pressing the Grey-minus key will return a two character string:
CHR(45) + CHR(74)
LASTKEY() is not updated by FT_SCANCODE(), so don't try to test LASTKEY() to see what was pressed during an FT_SCANCODE() call. Simply assign the return value to a variable and test that (see the test driver below).
* This was adapted from a short C routine posted by John Kaster on NANFORUM. It was written in Clipper to help demonstrate the FT_INT86 function of the Nanforum Toolkit.
This program requires FT_INT86().
cKey := FT_SCANCODE() [grey-] returns: CHR(45) + CHR(74) [-] returns: CHR(45) + CHR(12) [grey+] returns: CHR(43) + CHR(78) [+] returns: CHR(43) + CHR(13)
INKEY([<время ожидания в секундах>] [,<маска событий>]) --> код клавиши
<время ожидания в секундах> | задает количество секунд, которое |
INKEY() ждет нажатия клавиши. Значение может быть задано с точностью | |
до десятых долей секунды. Нулевое значение времени приостанавливает | |
программу до тех пор, пока не будет нажата клавиша. Если аргумент | |
<время ожидания в секундах> | опущен, то INKEY() не ждет нажатия |
клавиши. | |
<маска событий> | определяет какие события обслуживать. |
Возможные значения или их комбинации: | |
------------------------------------------------------------------------ | |
Constant Value Descripiton | |
------------------------------------------------------------------------ | |
INKEY_MOVE 1 Mouse Events | |
INKEY_LDOWN 2 Mouse Left Click Down | |
INKEY_LUP 4 Mouse Left Click Up | |
INKEY_RDOWN 8 Mouse Right Click Down | |
INKEY_RUP 16 Mouse Right Click Up | |
INKEY_KEYBOARD 128 Keyboard Events | |
INKEY_ALL 159 All Mouse and Keyboard Events | |
------------------------------------------------------------------------ |
INKEY() возвращает целое числовое значение в диапазоне от -39 до 386, идентифицируя клавишу, принятую из буфера клавиатуры или от 1001 до 1007 для событий мыши. Если буфер клавиатуры пуст, то INKEY() возвращает нуль. INKEY() возвращает значения для всех символов ASCII, функциональных клавиш, <Alt>-функциональных клавиш, <Ctrl>-функциональных клавиш и сочетаний клавиш <Alt>-буква и <Ctrl>-буква.
INKEY() - это функция работы с клавиатурой, которая выбирает код очередной клавиши из буфера клавиатуры и возвращает значение этого кода. Код этот, однако, запоминается и может быть прочитан с помощью функции LAST KEY(). Если задано ненулевое значение аргумента <время ожидания в секундах> и буфер пуст, то выполнение программы приостанавливается до тех пор, пока либо не будет нажата клавиша, либо не истечет заданное время ожидания. Время ожидания INKEY() определяется при помощи системного таймера и не зависит от скорости микропроцессора. Если аргумент <время ожидания в секундах> равен нулю, выполнение программы приостанавливается до тех пор, пока не будет нажата клавиша. Отметим, что INKEY() не переводит программу в состояние ожидания и поэтому в данной ситуации установки SET KEY не активны.
INKEY() подобна функции NEXTKEY(). Однако в отличие от INKEY() функция NEXTKEY() считывает, но не удаляет код клавиши из буфера клавиатуры. Это полезно, когда нужно проверить нажатие клавиши без ее обработки.
INKEY() - это основной примитив системы xClipper для получения кодов клавиш из буфера клавиатуры. Функция служит для опроса клавиатуры или приостановки исполнения программы, чтобы дождаться нажатия клавиши. Например, можно использовать INKEY(), чтобы завершить команды, работающие со списками, такие, как LIST, LABEL FORM и REPORT FORM, включая INKEY() в условие WHILE. Обратитесь к примеру ниже.
LASTKEY() --> INKEY-код.
No arguments
LASTKEY() возвращает число от -39 до 386 или от 1001 до 1007 для событий мыши, определяющее INKEY-код последней нажатой клавиши, извлеченной из буфера клавиатуры.
LASTKEY() является функцией работы с клавиатурой, которая возвращает INKEY-код последней нажатой клавиши, вызванной из буфера клавиатуры функцией INKEY(), или в состоянии ожидания - командами ACCEPT, INPUT, READ, WAIT, ACHOICE(), DBEDIT() и функциями MEMOEDIT(). LASTKEY() сохраняет свое значение до тех пор, пока новая клавиша не будет считана из буфера клавиатуры.
В программах LASTKEY() может быть использована в следующих случаях:
Определение кода клавиши, использованной для прерывания READ.
Определения кода клавиши, использованной для выхода из текущего GET-объекта внутри функции пользователя, вызванной в предложении VALID.
Определения ключа выхода в функциях пользователя в ACHOICE(), DBEDIT() или MEMOEDIT().
LASTKEY() используется также в комбинации с UPDATED(), чтобы определить, изменялся ли какой-либо из буферов GET-объектов во время выполнения команды READ.
Функция LASTKEY() аналогична функциям NEXTKEY() и READKEY(). NEXTKEY() читает текущий введенный код клавиши в буфер клавиатуры без его удаления. NEXTKEY() используется вместо INKEY(), когда осуществляется выбор кода клавиши.
За полным списком INKEY-кодов и констант из файла описаний Inkey.ch следует обратиться к Приложению В.
Этот пример иллюстрирует типичное применение LASTKEY() для проверки кода ключа, использованного для выхода из команды READ. Если выход осуществляется по любому ключу, отличному от <Esc>, и GET-объект изменялся, заданный файл базы данных также изменяется: #include "Inkey.ch" // USE Customer NEW MEMVAR->balance = Customer->Balance @ 10, 10 SAY "Текущий остаток" GET MEMVAR->balance READ // IF ( LASTKEY() != K_ESC) .AND. UPDATED() REPLACE Customer->Balance WITH MEMVAR->balance ENDIF
MCOL() --> nCurrentMouseColumn
No arguments
MCOL() returns the mouse cursor's current screen column position.
MDBLCLK([<nNewSpeed>]) --> nSpeed
MDBLCLK() returns the current double-click speed threshold.
MHIDE() --> NIL
No arguments
MHIDE() always returns NIL.
MHIDE() hides the mouse pointer. This function should be used together with MSHOW() when updating the screen. It is important to hide the mouse pointer before changing the screen display and then show it again after the change.
Note: The MSETCURSOR() function should be used in place of MSHOW() and MHIDE(). It is kept here for compatibility.
This example uses the mouse pointer: MHIDE() @ 10, 20 say "Hi there, folks!!!" MSHOW() You can automate calls to MHIDE()/MSHOW() by modifying parts of your header files (*.ch). For example: #command @ <row>, <col> SAY <xpr>;[PICTURE <pic>]; [COLOR <color>]; => DEVPOS(<row>, <col>); DEVOUTPict(<xpr>, <pic> [, <color>]) // Can be changed to #command @ <row>, <col> SAY <xpr>; [PICTURE <pic>]; [COLOR <color>]; => MHIDE(); DEVPOS(<row>, <col>); DEVOUTPict(<xpr>, <pic> [, <color>]); MSHOW()
MLEFTDOWN() --> lIsPressed
No arguments
MLEFTDOWN() returns true (.T.) if the left mouse button is currently pressed; otherwise, it returns false (.F.).
MPRESENT() --> lIsPresent
No arguments
MPRESENT() returns true (.T.) if a mouse is present; otherwise, it returns false (.F.).
MRESTSTATE( <cSaveState> ) --> NIL
No arguments
MRESTSTATE() always returns NIL.
MRIGHTDOWN() --> lIsPressed
No arguments
MRIGHTDOWN() returns true (.T.) if the mouse's right button is currently pressed; otherwise, it returns false (.F.) .
MROW() --> nCurrentMouseRow
No arguments
MROW() returns the mouse cursor's current screen row position.
MSAVESTATE() --> cSaveState
No arguments
MSAVESTATE() returns a character string that describes the mouse's current state.
MSETBOUNDS( [<nTop>], [<nLeft>], [<nBottom>], [<nRight>] ) --> NIL
<nTop> | defines the uppermost allowable screen row for the mouse |
cursor or 0 if omitted. This value may range from 0 to the value of | |
<nBottom> | . |
<nLeft> | defines the leftmost allowable screen column for the mouse |
or 0 if omitted. This value may range from 0 to the value of <nRight>. | |
<nBottom> | defines the bottommost screen row for the mouse cursor or |
MaxRow() if omitted. This value may range from the value of <nTop> to | |
MaxRow(). | |
<nRight> | defines the rightmost allowable screen column for the mouse |
or MaxCol() if omitted. This value may range from the value of <nLeft> | |
to MaxCol(). |
MSETBOUNDS() always returns NIL.
MSETCLIP([<nCoord list>], [<nMode>])
<nCoord List> | contains the coordinates of the inclusion region which |
is represented as a comma-separated list of four coordinates whose | |
interpretation differs depending on mode. If <nMode> is LLM_COOR_TEXT, | |
the coordinates look like this: <nTop>, <nLeft>, <nBottom>, <nRight>. | |
If <nMode> is LLM_COOR_GRAPH, the coordinates are <nX1>, <nY1>, <nX2>, | |
<nY2> | . |
<nMode> | is one of the following two constants: |
Coordinate Type Constants ------------------------------------------------------------------------ Constant Description ------------------------------------------------------------------------ LLM_COOR_TEXT Specifies that the coordinates are given in lines and columns of text LLM_COOR_GRAPH Specifies that the coordinates are given in pixels ------------------------------------------------------------------------ |
MSETCLIP() returns an array of coordinate information. The coordinates of the inclusion area are given in pixels and then in row/col format:
aRegions := {nIncX1, nIncY1, nIncX2, nIncY2,; nIncR1, nIncC1, nIncR2, nIncC2,; nCoorType}
MSETCLIP() controls mouse pointer movements. It allows you to restrict movement to a region. When an inclusion is defined and the user tries to move the mouse pointer out of the rectangle, it remains stuck at the edge of the area, but is still visible. This mode should be used to restrict the range of user choices for moving or clicking the mouse.
This example shows how the MSETCLIP() function works: // Define an inclusion region and save the current // inclusion region in the array aOldInc aOldInc := MSETCLIP(5, 5, 20, 75,LLM_COOR_TEXT) // Code for selecting objects and buttons // Restore old inclusion region MSETCLIP(aOldInc[5],; aOldInc[6],; aOldInc[7],; aOldInc[8],; LLG_VIDEO_TEXT)
MSETCURSOR( [<lVisible>] ) --> lIsVisible
MSETCURSOR() returns the mouse cursor's previous visibility state if <lVisible> is passed; otherwise, it returns its current visibility state.
MSETPOS( <nRow>, <nCol> ) --> NIL
No arguments
MSETPOS() always returns NIL.
MSHOW([<nCol>, <nRow>, <nStyle>]) --> nOldCursorShape MSHOW([<nCursorShape>]) --> nOldCursorShape MSHOW([<nCursorShape>] | [<nCol>, <nRow>, <nMode>]) --> nOldCursorShape
<nCol> | and <nRow> define mouse pointer coordinates. |
<nStyle> | defines the style of mouse pointer using one of the |
constants listed in the table below: | |
Text and Graph Constants ------------------------------------------------------------------------ Constant Description ------------------------------------------------------------------------ LLM_COOR_TEXT Specifies that the coordinates are passed in rows and columns of text LLM_COOR_GRAPH Specifies that the coordinates are passed in pixels ------------------------------------------------------------------------ | |
<nCursorShape> | is a numeric value representing the mouse cursor |
shape. The following are the possible values predefined for this | |
parameter: | |
Cursor Shape Constants | |
------------------------------------------------------------------------ | |
Constant Description | |
------------------------------------------------------------------------ | |
LLM_CURSOR_ARROW Standard pointer | |
LLM_CURSOR_SIZE_NS North South arrow | |
LLM_CURSOR_SIZE_WE West East arrow | |
LLM_CURSOR_SIZE_NW_SE North-West South-East arrow | |
LLM_CURSOR_SIZE_NE_SW North-East South-West arrow | |
LLM_CURSOR_HAND Hand | |
LLM_CURSOR_FINGER Hand with one pointing finger | |
LLM_CURSOR_CROSS Cross | |
LLM_CURSOR_WAIT Hourglass | |
------------------------------------------------------------------------ |
MSHOW() returns the previously used cursor shape. See <nCurorShape> above for further information.
MSHOW() displays the mouse pointer. It is generally used without parameters to simply redisplay the mouse pointer at the position where MHIDE() hid it (assuming the user has not moved the mouse).
It is possible to use two sets of parameters with this function.
Specify the coordinates where the pointer should appear. In this case, three parameters must be passed: the mode and its coordinates. In text mode, coordinates are passed as row and column. In graphic mode, you can pass either text or graphic coordinates. Conversion is done automatically based on the font size of the current characters.
You can also specify the mouse cursor shape to be displayed when the mouse is visible. This feature is available in graphic mode only.
It is important to hide the mouse pointer before any new screen display, and then show it again. See MHIDE() for further information on how to do this.
Note: The MSETCURSOR() function should be used in place of MSHOW() and MHIDE(). It is kept here for compatibility.
The following example hides the mouse pointer before using an @...SAY command and then redisplays it. Next, the mouse pointer is repositioned, hidden, changed to an hour-glass, and then restored to its previous shape: LOCAL nOldShape := 0 MHIDE() @ 10, 20 say "Hello world!!!" MSHOW() // Position the pointer at the center of the screen MSHOW(MAXCOL() / 2, MAXROW() / 2, LLM_COOR_TEXT) MHIDE() @ 10, 20 say "Please wait ..." // Display an hour glass cursor nOldShape := MSHOW(LLM_CURSOR_WAIT) // Your code // Restore previously used cursor MSHOW(nOldShape)
MSTATE() --> aState | 0
No arguments
MSTATE() Return Array ------------------------------------------------------------------------ Position Description ------------------------------------------------------------------------ LLM_STATE_X State of X position. LLM_STATE_Y State of Y position. LLM_STATE_ROW State of column position. LLM_STATE_COL State of line position. LLM_STATE_LEFT State of left mouse button. LLM_BUTTON_DOWN means down and LLM_BUTTON_UP means up. LLM_STATE_RIGHT State of right mouse button. LLM_BUTTON_DOWN means down and LLM_BUTTON_UP means up. LLM_STATE_VISIBLE State of mouse pointer. True (.T) means visible and false (.F) means invisible. (See MSHOW() and MHIDE() for more information.) LLM_STATE_DRIVER Indicates version of mouse driver. LLM_STATE_SHAPE Mouse cursor shape. (See note below.) LLM_STATE_CLICKS_LEFT Number of left clicks since last MSTATE() call. LLM_STATE_CLICKS_RIGHT Number of right clicks since last MSTATE() call. ------------------------------------------------------------------------
Note: The following are the possible values predefined for this return array position: LLM_CURSOR_ARROW, LLM_CURSOR_SIZE_NS, LLM_CURSOR_SIZE_WE, LLM_CURSOR_SIZE_NW_SE, LLM_CURSOR_SIZE_NE_SW, LLM_CURSOR_HAND, LLM_CURSOR_FINGER, LLM_CURSOR_CROSS, LLM_CURSOR_WAIT. For a description of these values see the MSHOW() table of Cursor Shape Constants.
If the mouse is missing, 0 is returned.
The number of clicks (i.e., aState[LLM_STATE_CLICKS_LEFT] and aState[LLM_STATE_CLICKS_RIGHT]) is reset each time MSTATE() is called. Use MSTATE() to reset the mouse settings when needed.
MSTATE() returns information on the mouse state, i.e., the current screen position of the pointer, the state of the left and right mouse buttons, the visibility status of the mouse pointer, and the version of the mouse driver.
This example shows how to use MSTATE() function: // Show the mouse pointer MSHOW() DO WHILE INKEY() != K_ESC // Retrieve mouse state aState := MSTATE() // Line position @ 24, 0 SAY aState[LLM_STATE_ROW] // Column position @ 24, 10 SAY aState[LLM_STATE_COL] // State of left button @ 24, 20 SAY "Left" + If(aState[LLM_STATE_LEFT]==LLM_BUTTON_DOWN,; "Down" ,; "Up") // State of right button @ 24, 40 SAY "Right " + If(aState[LLM_STATE_RIGHT]== ; LLM_BUTTON_DOWN ,; "Down" ,; "Up") ENDDO // Hide the mouse pointer MHIDE()
NEXTKEY() --> код клавиши
No arguments
NEXTKEY() возвращает целое число, которое находится в интервале от -39 до 386 или от 1001 до 1007 для событий мыши. Если буфер клавиатуры пуст, NEXTKEY() возвращает 0. Если командой SET TYPEAHEAD установлен размер буфера - ноль, то NEXTKEY() возвращает ноль.
NEXTKEY() - функция работы с клавиатурой, которая считывает код очередной нажатой клавиши без его удаления из буфера клавиатуры. Возвращаемые значения - это INKEY-коды нажатых клавиш - такие же, что возвращают функции INKEY() и LASTKEY(). NEXTKEY() возвращает значения кодов для всех ASCII символов, функциональных клавиш, <Alt>-функциональных клавиш, <Ctrl>-функциональных клавиш, <Alt>-символов, <Ctrl>-символов. NEXTKEY() похожа на функцию INKEY(), но отличается одним основным свойством. INKEY() удаляет код нажатой клавиши из буфера клавиатуры, изменяя значение LASTKEY(). NEXTKEY() считывает, но не удаляет код нажатой клавиши из буфера клавиатуры и не изменяет значения LASTKEY().
Поскольку NEXTKEY() не удаляет клавишу из буфера клавиатуры, можно использовать эту функцию для опроса клавиатуры и затем передавать управление программе, которая использует состояние ожидания для того, чтобы извлечь клавишу из буфера. Полный список INKEY-кодов и описаний констант файла описаний Inkey.ch приведен в приложении С этой книги.
В этом примере в буфер клавиатуры помещается значение клавиши <Esc> и затем показываются отличия между INKEY(), LASTKEY() и NEXTKEY(). #include "Inkey.ch" // CLEAR TYPEAHEAD KEYBOARD CHR(K_ESC) // ? NEXTKEY(), LASTKEY() // Результат: 27, 0 ? INKEY(), LASTKEY() // Результат: 27, 27 ? NEXTKEY() // Результат: 0
SETKEY(<INKEY-код>, [<блок кода>]) --> текущий блок кода
SETKEY() возвращает блок кода, связанный в текущий момент с заданной клавишей или NIL, если заданная клавиша не связана ни с каким блоком кода.
SETKEY() является функцией работы с клавиатурой, используемой для установки или запроса автоматического действия, связанного с нажатием конкретной клавиши в режиме ожидания. Режим ожидания - это любой режим, при котором программа ожидает ввода информации с клавиатуры. Режим ожидания создается функциями ACHOICE(), DBEDIT(), MEMOEDIT(), и командами ACCEPT, INPUT, READ и WAIT. Функция INKEY() в эту группу не входит. Одновременно может назначаться до 32 клавиш. По умолчанию система автоматически назначает клавишу F1 для выполнения процедуры или функции пользователя с названием Help.
Когда назначенная клавиша нажимается во время состояния ожидания, соответствующему блоку кода в качестве параметров передаются значения PROCNAME(), PROCLINE() и READVAR(), и он выполняется путем передачи его функции EVAL(). Однако нет необходимости перечислять эти аргументы при задании значения аргумента <блок кода>, если вы не планируете их использование.
SETKEY() подобна команде SET KEY, которая связывает вызов процедуры с определенной клавишей.
В данном фрагменте программы показано, как связать блок кода с клавишей, чтобы позднее выполнить его с помощью функции EVAL() после получения кода клавиши путем использования INKEY(): #include "Inkey.ch" SETKEY(K_DN, { |cProc, nLine, cVar| MyProc(cProc, nLine, cVar) }) ... ...<операторы> ... DO WHILE .T. nKey := INKEY(0) DO CASE CASE (bAction := SETKEY(nKey)) != NIL EVAL( bAction, PROCNAME(), PROCLINE(), READVAR()) CASE nKey = K_PGUP Previous() CASE nKey = K_PGDN Next() CASE nKey = K_ESC EXIT ENDCASE ENDDO
Пред. | Начало | След. |
DATE/TIME | Уровень выше | GAME |