Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing bound control value and buffer
Message
 
 
To
17/04/2011 12:34:01
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01507653
Message ID:
01507655
Views:
36
>>Hi,
>>
>>I have come across the following issue and hope that I am missing something simple. Here is the summary of the situation:
>>
>>A textbox on a form is bound to a cursor with buffering 5. When user changes the value of the control the method InteractiveChange of the textbox calls a method of the form. This method checks if there are any changes in the buffer using
>>
>>cRetVal = GETFLDSTATE( -1, "C_CURSNAME" )
>>
>> And the return from GetFldState() has all "1"s as if nothing has been changed.
>>
>>Yes, if I put SET STEP ON in the method and step through the code, the GetFldState() returns the string that has one "2" as it should be. My question is, why without debugger the GetFldState() does not see any changes and with the debugger it does? I also tried using CURVAL() for the field and the same thing happens. Without debugger the CURVAL() returns old value but with the debugger the change is perceived.
>>
>>UPDATE. Looks like calling REFRESH() takes care of the problem.
>>UPDATE 2. No, REFRESH() does not solve the problem.
>
>
>Dmitry,
>
>If memory serves .... As long as your textbox has the focus, getfldState() will not see the changes
>
>Solution - (add error handling)
>
>If thisform.ActiveControl has a ControlSource
>   if( eval(m.thisform.ActiveControl.ControlSource) <> thisform.ActiveControl.Value )
>     =m.thisform.ActiveControl.SetFocus()  && you may get an error here due to the fieldValidation rule
>  endif
>endif
>
You are probably right. Since SET STEP ON moved the focus away from the current textbox, the GetFldState() see the changes. I will try to apply your suggestion to get around this issue. Although I was hoping that a simple call to REFRESH() would do it.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform