Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GETFLDSTATE not working consistently?
Message
From
24/07/2014 08:26:39
 
 
To
24/07/2014 07:09:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01604554
Message ID:
01604560
Views:
91
This message has been marked as the solution to the initial question of the thread.
>Hello,
>
>I have a form where somem values are to be computed on save. But the computytion should only happen when certain fields are changed. I try to do this with some GETFLDSTATE() calls that set a trigger. Prior tosaving I call a function to compute the values if the trigger is .T.. This workes. But if I change one of the fields and click on the save button without first leaving the field the tigger is not set.
>
>If this know behaviour?
>How do I circumvent it?
>Else, what do I miss?

Yes, this is known behavior if the Save button is on a toolbar, not the form itself. It's because buttons on a toolbar don't ever get focus, so the textbox's LostFocus event doesn't fire and things that happen when the textbox loses focus (such as the new value being stored to the ControlSource) don't happen.

You need to force focus to move. Try putting this code at the top of your Click code in toolbar buttons:
IF TYPE(“_screen.ActiveForm.ActiveControl.Name”) = “C”

     IF PEMSTATUS(_screen.ActiveForm.ActiveControl,”SetFocus”,5)

          _screen.ActiveForm.ActiveControl.SetFocus()

     ENDIF

ENDIF
Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform