Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing bound control value and buffer
Message
From
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:
01507654
Views:
44
>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
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform