Fred beat me to it, Rafael, but here's an example of how I've used gridhittest.
I've forgotten where I pinched the concepts from so if this looks like
something that someone else here has offered in the past, I say thanks!
Here's a working example. Two columns of a grid bound to a table use checkbox
controls and I want to allow the user to check and uncheck as needed but I
don't want to allow cell selection in the grid. (Actually there are several
grids in this form and I have repeated as needed.)
Rather than bind directly to the mousedown event as in the example that Fred
linked to, I put codce like this in the mousedown event that just stores the
coordinates to a couple of form properties that I've added to my base form
class:
LPARAMETERS m.nButton, m.nShift, m.nXCoord, m.nYCoord
WITH thisform
.nGridX=m.nXCoord
.nGridY=m.nYCoord
ENDWITH && thisform
I have a form level method (markProject) that does the work. In the init of the
grid, I bind its click event to my form level handler method:
BINDEVENT(this,[Click],thisform,[markProject])
I then use gridhittest in that method to determine what to do. It looks like
this:
LOCAL m.lnRelCol, m.lnRelRow, m.lnWhere
STORE 0 TO m.lnWhere, m.lnRelRow, m.lnRelCol
This.pf1.pgProjects.grdProjects.GridHitTest(This.nGridX, This.nGridY, @lnWhere,
@lnRelRow, @lnRelCol)
IF m.lnWhere=3 && Cell
DO CASE
CASE m.lnRelCol=7 && column 7
IF projects.delivered
REPLACE projects.delivered WITH .f.
ELSE
REPLACE projects.delivered WITH .t.
ENDIF
CASE m.lnRelCol=8 && column 8
IF projects.complete
REPLACE projects.complete WITH .f.
ELSE
REPLACE projects.complete WITH .t.
ENDIF
ENDCASE
ENDIF
Hopefully that gets you started.
--
Rk
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Rafael
Copquin
Sent: Wednesday, July 24, 2013 3:09 PM
To: [email protected]
Subject: gridhittest
I have a form with 3 grids.
When the user hovers the mouse over any of the grids, I want to determine on
which column and row (ie wich cell) the mouse is hovering on.
I think I could determine where the mouse is on each grid by using gridhittest,
but I can't understand the explanation given on help or the examples found in
the web.
Can anyone post some code here to guide me, please?
Rafael Copquin
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/DF1EEF11E586A64FB54A97F22A8BD04422845C76D3@ACKBWDDQH1.artfact.local
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.