VOTools for Visual Objects  
and Vulcan.NET  

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




 from bBrowser
1.4
  bBrowser 1.4 (Limited)
yes
 

How to determine the column 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:GetColumnToPoint() for the mouse position the column number can be determined. The cell contains the column, row and record number.

The following code fragment demonstrates the proceeding:

  LOCAL sPoint    IS _winPOINT
LOCAL iColNo    AS DWORD
LOCAL oColumn   AS bDataColumn

GetCursorPos(@sPoint)
ScreenToClient(oBrowser:Handle(), @sPoint)
iColNo := oBrowser:GetColumnToPoint(Point{sPoint.X, sPoint.Y})
IF iColNo>0
  oColumn := oBrowser:GetOpenColumn(iColNo)
ENDIF

Copyright © 2003-2015 BEFO GmbH