Well, given that you are new to VFP, this might quite a big chunk of stuff for you to absorb. Are you sure you want to do this right now? It means having to learn some fairly advanced techniques, merely to make a small cosmetic improvement to your form.
On the other hand, it could be a good training exercise. The techniques are likely to be useful elsewhere eventually (especially creating custom properties). But I can imagine it taking you a little while to understand the details, and you might have higher priorities within your project. (That's not meant as a reflection on your learning ability, of course.)
For now, I'll give you a very quick answer to all of your questions, just to get you started:
1. How do we create a custom property? Like double clicking the grid and in the "AddProperty" event part? There's "LPARAMETERS cPropertyName, eNewValue, nVisiblity, cDescription" and I don't know how to manipulate these parameters to store the row number under the mouse.
No, that's not the correct approach. Instead, read the Help topic, "How to: Add Properties to Classes". But where you see references to "class", take those to mean references to "form". So, for example, you will open the
Form Designer, and use the
Form menu.
2. Calling the GridHitTest Method is by typing??:
LPARAMETERS nButton, nShift, nXCoord, nYCoord
this.GridHitTest
You are headed in the right direction with this one. But you need to pass parameters to GridHitTest. Look at the Help topic for GridHitTest for details. You might also need to read up on "output parameters".
3. Setting the dynamicBackColor property of all the columns seem a lot of effort clicking each of them. Is there like a shortcut to set their DynamicBackColor? In which event of the grid can I type the code for it?
Yes, there is a shortcut. It's called SetAll.
You do this in the Init of the grid. You write code that calls the SetAll method of the grid. The SetAll method will set the DynamicBackColor property for all the columns in the grid. For more about Dynamicxxx properties, see
Conditional formatting in a Visual FoxPro grid.
Finally, keep in mind that I have never done what you are trying to achieve, so I cannot be sure that what I have told you is completely correct. If I get time later, I'll try to set it up myself, just to be sure it will work. Also, one of the underlying rules of VFP is that there are always at least three different ways of achieving a given goal. So it's quite possible that someone else here might be able to give you a better answer.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
Visual FoxPro articles, tips and downloads