Hi Richard
Yes, I think I will use your code. Its late here now but I'll test it
tomorrow.
What I really need to do is to migrate an old FOX DOS program to VFP9.
There are browse windows and actions triggered by on key labels
according to which windows the DOS mouse clicks on (actually, the user
clicks on a certain column of the browse window and a different program
triggers)
I am not using on key labels in VFP9, replacing them with the keypress
event. The browse windows are replaced by grids. However, I have some
difficulty with the routines called by the on key labels and wanted to
make sure everything fires correctly when the user clicks on the correct
column on the correct grid.
So gridhittest is the solution.
Thank you very much for this code
Rafael Copquin
El 24/07/2013 04:39 p.m., Richard Kaye escribió:
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
[excessive quoting removed by server]
_______________________________________________
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/[email protected]
** 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.