Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ToolBar - Problem solved
Message
 
To
13/10/1999 17:59:05
Loren Fedje
Loren D. Fedje & Associates Ltd.
Chilliwack, British Columbia, Canada
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00276094
Message ID:
00276131
Views:
25
Loren,

Thanks for sharing you solution with the gang here. That is really the whole spirit of this place.

The reason for this behavior is this; A control will update its ControlSource just before the LostFocus event fires. Toolbars and Menus never get focus, so the control never loses focus adn therefore does not update its ControlSource.


Here's some code that will eliminate this problem;
* Toolbar button click
IF TYPE("_SCREEN.ActiveForm.ActiveControl.Name") = "C"
    * Ok there is a control involved
    IF PEMSTATUS(_SCREEN.ActiveForm.ActiveControl,"SetFocus",5)
       * The active control has a SetFocus method so call it
       _SCREEN.ActiveForm.ActiveControl.SetFocus()
    ENDIF
ENDIF
The reason this works is because calling the control with focus' setfocus makes the control lose focus and then gain it back again. The side effect loss of focus will cause the control to update the buffer with the changes.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform