Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6SP5 - How to know that a txt.value has changed
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00797581
Message ID:
00797921
Vues:
29
Thanks Renoir, I haven't checked up yet but is CompObj() a VFP function?. If so this becomes very easy to compare two similar objects like you mentioned. My requirement was a bit different. I wanted to change a corner of the form to a different color as soon as a user modifies the vaule. If he changes back to the original value the save is not required but otherwise it is. Justto show he modified data I wanted to change the color and so I wanted something not very perfect but blazingly fast. I think interactivechange will the be the best way. I hope it does not fire if the user just presses enter to leave the field untouched. Keep you posted.

That's the real key. InteractiveChange() will fire as soon as the user hits a key (the enter key alone won't fire the event). If the user changes back to the original as you note above, none of the methods mentioned (InteractiveChange, ProgrammaticChange, GetFldState) will help you. They will all imply that the value has changed. Renoir's method is much better. You can use GetFldState to narrow down the fields you need to check, but I doubt it will save you very much. Also, though, keep in mind that with GetFldState(), you can check the first bit to see if the record has been deleted by passing -1 instead of a field number. I'm not sure that Scatter Name with CompObj will give you that information.

Alan


>>Bhavbhuti,
>>
>>Alan makes an excellent point. I'm currently working in an application that constantly is asking, "Do you want to save this record?" when all the user did was go in, click on something then try to leave. In the past I have put a record into an object using Scatter Name when entering a form and then compared it to another object of the same record using CompObj when leaving the form (thanks to Cetin for that tip a couple years ago). I will eventually start to change the current application to do that as well.
>>
>>Renoir
>>
>>
>>>>Just keep in mind though, that GetFldState(), InteractiveChange(), and ProgrammaticChange(), tell you that the field has been messed with. They don't really tell you if the value is different than it was coming in.
>>>
>>>Yes I have put it in the LostFocus() and I just wanted to know if the user modified once just to set a portion of the screen in a diff. color to get the users attention that save will be required.
>>>
>>>>
>>>>If you truly want to know if the value is changed, you need to do your own comparisons.
>>>>
>>>>Alan
>>>>
>>>>>Thanks a lot David.
>>>>>
>>>>>>GetFldState()
>>>>>>
>>>>>>>I wanted a quick & efficient way to find out if say for eg. the text in a textbox / cbo or the status of a checkbox has changed.
>>>>>>>
>>>>>>>The controlsource for all these controls will be a view.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform