How to determine the column under the mouse

Requirement: bBrowser 1.4

 

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