VOTools for Visual Objects  
and Vulcan.NET  

bBrowser => Tips & Tricks => How to determine the cell under the mouse    




 from bBrowser
1.4
  bBrowser 1.4 (Limited)
yes
 

How to determine the cell under the mouse

At first with the API function GetCursorPos() the position of the mouse must be determined. Because the API function returns the mouse position relative to the upper left corner of the screen, the position must be mapped to the upper left corner of the bBrowser. For this the API function ScreenToClient() can be used. With the method bBrowser:GetCellToPoint() for the mouse position the cell can be determined. The cell contains the column, row and record number.

The following code fragment demonstrates the proceeding:

  LOCAL sPoint    IS _winPOINT
LOCAL oCell     AS bCell

GetCursorPos(@sPoint)
ScreenToClient(oBrowser:Handle(), @sPoint)
oCell := oBrowser:GetCellToPoint(Point{sPoint.X, sPoint.Y})

? "Column: "+NTrim(oCell:Column)
? "Row:    "+NTrim(oCell:Row)
? "RecNo:  "+NTrim(oCell:RecNo)

Copyright © 2003-2015 BEFO GmbH