Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Elusive problem
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01251169
Message ID:
01251184
Vues:
16
This message has been marked as a message which has helped to the initial question of the thread.
>>>Hi everybody,
>>>
>>>Somehow I can not figure out what's causing the form of my colleague to give 'Do you want to Save?" question upon exit even if I just saved the changes. I tried to use Event tracking, tried to put some strtofile or messageboxes in the places I would suspect, but so far I can not figure out the culprit.
>>>
>>>The form has a pageframe with 4 pages, a toolbar and some buttons and comboboxes directly on the form bellow the pageframe. Almost every textbox on the first page has a code in its valid method changing the two fields (the fields that are reported to be changed in the DataChanged method of the form which is called in Save and from the QueryUnload). I made sure that this code is only firing when the value in the textbox was really changed by saving the original value in the GotFocus event.
>>>
>>>Still apparently one of the textboxes valid fires and it's thinking that the textbox's tag property is not equal to the value.
>>>
>>>I'm wondering if you can suggest some approaches to attack this problem more efficiently, because I already spent several hours trying to figure this out.
>>>
>>>Appreciate your help in advance.
>>
>>What is the logic that make this question to appear?
>
>If we detect that there are unsaved changes, then this question is asked.
>
>Here is the DataChanged method (I overwrote the original base form behavior since it was just using getfldstate and most of the forms are using record level buffering, but for this one I changed it to be table level buffering):
>
>
>LOCAL llChanged, lnI, lnNextModified, lcState
>llChanged = .f.
>lnI = 1
>DO while lnI <= ALEN(thisform.aDE,1) AND NOT m.llChanged
>    lnNextModified = GETNEXTMODIFIED(0, thisform.aDE[m.lnI])
>    DO WHILE m.lnNextModified <> 0 AND NOT m.llChanged
>        GOTO m.lnNextModified IN (thisform.aDE[m.lnI])	
>        lcState = GETFLDSTATE(-1, thisform.aDE[m.lnI])          	
>        llChanged = not ISNULL(m.lcState) or 2 $ m.lcState or 4 $ m.lcState
>
>        IF NOT m.llChanged
>	        lnNextModified = GETNEXTMODIFIED(m.lnNextModified, thisform.aDE[m.lnI])
>	    endif
>    ENDDO
>    lnI = m.lnI + 1
>ENDDO
>
>RETURN m.llChanged
You could do:
....
lcState = GETFLDSTATE(-1, thisform.aDE[m.lnI])          	
llChanged = not ISNULL(m.lcState) or 2 $ m.lcState or 4 $ m.lcState
ASSERT NOT llChanged
....
After your application stops check the value of lcState and see WHAT field is changed. Then you could check WHERE you changed the value of the field (ot the control bound to that field). Keep in mind that even you replace the same value in the field GETFLDSTATE() will return that the field is changed.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform