As for data validation, you can do that by programming the applicable textbox of the column where the data is first entered, ie the item code in my invoice example (please refer to the articles I wrote on the UniversalThread, quoted in a previous post)

You validate data in the valid method of the textbox and act on the validated input with code in the lostfocus method of the same textbox. If the data is so validated, then the grid will naturally take you to the next column, unless you return false in the when method of that column's textbox.

In my example, you put validation code in the valid method of the textbox in the item code column. If the validation passes, then the item description is shown in the next column, otherwise, an error message pops up and the cursor remains in the first column until you either enter a valid code or press the escape key.

In the keypress method of that textbox you can put this code:

if nKeyCode = 27   && escape key pressed
   release thisform
endif

You should pay particular attention to the way events fire. This is the way to get it right.


Rafael Copquin



El 23/04/2013 03:25 p.m., Gene Wirchenko escribió:
At 14:46 2013-04-19, Frank Cazabon <[email protected]> wrote:
I've always heard people say that editing data in grids is problematic, but I've been doing it since VFP3 released back in 1995 (or whenever) without a problem. What sort of problems did you encounter?

     Data validation.

I like to validate input data. It was awkward for some cases. I think it had to do with interactions between different rows.

[snip]

Sincerely,

Gene Wirchenko


[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.

Reply via email to