Gene,
So the issue is not the grid or validations firing, but that, when a validation fails, the appropriate row and column need to be given focus. And that the validation needs a way to trigger a messagebox. And since the columns might be re-arranged, some logic is required to know which column to set focus. And that the validations need to fire in the column order. Is this correct?
I vaguely remember having some issues with setting focus to row/columns in the grid. I think I ended up trying to set focus and then having to keyboard (or similar) some navigations so that the grid would actually show the item as desired. But it's been a while since I played with it.....
I often did not use the field level validations since often, other fields needed to be evaluated as well. So other than simple limit validations (age can't be negative, etc.) most of the validations were done in the row validation. That code could be written to test by column order, but better would be to test all values and then return a list of errors and let the grid code arrange the errors by the appropriate order before setting focus.
But I do remember having my share of frustrations with the grid, so take this all with a grain of salt....
Fletcher
Fletcher Johnson FletcherSJohnson@Yahoo.com LinkedIn.com/in/FletcherJohnson twitter.com/fletcherJ strava.com/athletes/fletcherjohnson 408-946-0960 - work 408-781-2345 - cell
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Gene Wirchenko Sent: Wednesday, January 9, 2019 10:52 AM To: ProFox Email List Subject: Re: AW: Custom Scrollbar
At 05:28 2019-01-08, Frank Cazabon frank.cazabon@gmail.com wrote:
Gene, back in April last year you were asking if anyone could write code to your specification regarding the grid problems you were having. I don't recall ever seeing your specification, maybe if you posted it someone might be able to do the code for you.
At that time, I was also having difficulties posting to the list. I thought I had come up with something, but maybe, it did not make it and I mistakenly deleted it. Let me specify something simple:
Consider a cursor or table of: thetext c(20) evennr n(3) weirdnr n(3)
The validations are: thetext>"" evennr%2=0 weirdnr%3=0 and the row-level validation is: asc(thetext)%2=weirdnr%2
When a control-level validation error occurs, throw an appropriate message box and then set focus to the control with the erroneous value.
For a row-level validation:
1) All control-level validations should be done first. Start with the current control, then do all the others from left to right. The first that fails gets the message box, and checking stops.
Then, do the row-level validation. If it fails, throw an aoppropriate message box and then set focus to the control in the first column from the left of the values that are checked. (In the example above, thetext is left of weirdnr, so set focus to thetext.)
Part 2:
The columns can now be rearranged in any order. Despite this:
The coontrol-level validations should still set focus to the correct control.
The column-level validations done at the start of the row-level validation should be done in the order current then left-to-right. NOTE THAT THIS COULD NOW BE A DIFFERENT ORDER.
The row-level validation should still set focus to the leftmost involved control. NOTE THAT THIS MIGHT BE A DIFFERENT CONTROL. (Example: If weirdnr gets moved to the left of thetext, row-level validation failing should set focus to weirdnr.)
This is basic functionality that I want/need. I have been unable to get this to work with VFP's Grid despite my efforts.
[snip]
Sincerely,
Gene Wirchenko
[excessive quoting removed by server]