xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

MCol()

Determines the screen column position of the mouse cursor.

Syntax

MCol() --> nMouseCol

Return

The function returns the column position of the mouse cursor as a numeric value.

Description

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.

Info

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

Example

// 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

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