xHarbour Reference Documentation > Function Reference |
Determines the screen column position of the mouse cursor.
MCol() --> nMouseCol
The function returns the column position of the mouse cursor as a numeric value.
MCol() is used in full screen or console window applications to determine the current screen column position of the mouse cursor. The leftmost column has number zero, while the rightmost column has number MaxCol().
Note to obtain proper mouse input from the user, function Inkey() should be called including mouse events.
See also: | Inkey(), MDblClk(), MHide(), MLeftDown(), MRightDown(), MRow(), MSetCursor(), MShow(), SET EVENTMASK |
Category: | Mouse functions |
Source: | rtl\mouseapi.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example changes the event mask for Inkey() to ALL events // and displays the mouse cursor position when the left button is pressed. #include "Inkey.ch" PROCEDURE Main LOCAL nEvent, nRow, nCol, cPos CLS MShow() ? "Click with left mouse button (press ESC to quit)" SET EVENTMASK TO INKEY_ALL DO WHILE Lastkey() <> K_ESC nEvent := Inkey(0) IF nEvent == K_LBUTTONDOWN nRow := MRow() nCol := MCol() cPos := LTrim( Str(nRow) ) + "," + LTrim( Str(nCol) ) // display current mouse cursor position @ nRow, nCol SAY cPos ENDIF ENDDO RETURN
http://www.xHarbour.com