Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Endless loop - need a hand to get out
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00706602
Message ID:
00707936
Views:
28
Hi Terry,

I found, that the validation in the grid the way I implemented it (using AfterRowColChange and BeforeRowColChange) doesn't work as I want it to. May be I can do validation in grid TextBoxes KeyPress up/down arrows? But how then I find out, if I clicked on a row by mouse?

If we would have VFP7, I would not need to try that hard to overcome all this problems with grid's validation...


>Nadya
>I used to ask a Valid Event to help with data validataion - I USE too! I have learned that using combinations of LostFocus, Tag, and When is seems [more] understandable (does anyone really know what valid is up to?)
>
>These are a few guidelines:
>1) Off subject: But to prevent a Grids re-firing of an After/Before RowColumnChange, I will place trans(recno()) in the Grids tag. The After/BeforeRowColumnChange will as the question:
>
if transform(recno())#oGrid1.tag && Don't fire the AfterChange event
>
>2) To prevent focus until a valid state is complete, I use When.
>For example:
>Lets say txtBoxMortRate cannot accept an entry until the txtLender entry is complete and the txtMortAmt has been entered. In the txtMortRate WHEN event I would have a statement like this:
>
return !empty(.txtLender.Value) and LenderIsValid(.txtLender.Value) and;
>            !empty(.txtMortAmt.Value) and MortAmtIsValid(.txtMortAmt.Value)
>
>I have nothing against Valid - except he has his own rules. Its easier to fire a 'custom' validation off LostFocus and use When to control downstream focus. In some (well most - err all) cases, when my projects start a 'fresh' form, every thing is turned off until appropriate entries are completed. For example: Why have a save button enabled for a blank form, etc.
>
>Let us know how it go!
>
>>Hi everybody,
>>
>>Ok, now after I explained my frustration I hope to get some help on the following problem:
>>
>>I have a grid on a form to type additional mortgage info. E.g. each main sale/mortgage record may have up to 5 additional mortgage records.
>>
>>In the grid I have a method to validate user's entry. Some code is in BeforeRowColChange, AfterRowColChange, textbox.Valid, Valid method of the grid, etc.
>>
>>Everything seems to be working now except for the following:
>>
>>I have a validation, that if Lender is not empty, Mortgage should be not empty too. In addition, user must re-type Amount using separate form.
>>
>>Now this is that happening: I type amount, re-type it, then click in a control on a page (outside of the grid). I get a message, that Amount could not be empty if Lender is not empty. It looks like the Valid of the grid fires before the valid of grid's column textbox fires, e.g. the value, I typed, have not been written to the table yet, therefore this message is issued.
>>
>>How should I fix this problem? I suppose, in Grid's Valid event I have to ensure, that valid of ActiveColumn textbox already fired... Can you give me a hint, please?
>>
>>My manager just came and said, that DataEntry is my first priority, sorry...
>>
>>Oh, well...
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform