Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data is different from menu?
Message
 
To
03/09/1997 11:00:06
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00048278
Message ID:
00048473
Views:
19
>I have a menu which repeats the command buttons on a form. One of them is Save. The command on the menu is _screen.activeform.cmdsave.click(). The click event runs code very similar to that found in the Wizbtns class of the screen wizard. When we hit Wizbtns.UpdateRows() basically a TableUpdate() is performed. If I choose Save from the menu, not only is the TableUpdate not performed correctly, but the changes are reverted. If I step through the code, the update IS performed correctly.
>
>I have done some Debugout() in the UpdateRows method and found something very odd...
>
>When the click() is fired by the menu, OLDVAL(Field, Table) and Table.Field will return exactly the same thing (the old value), even though the Table.Field value has been changed on the form. But they return different (correct) values when fired by clicking on the command button.
>
>I'm using optimistic table buffering, but, just for grins, I changed it to NO buffering and the same thing happens!!
>
>What's going on here? Any ideas? I'm stumped.
>
>Thanks.
Valerie,

A control will update its controlsource when it looses focus. Menus and Toolbars NEVER get focus so when you click the menu the current control does not lose focus and therefore does not update its controlsource. You can fix this by adding this to your menu code;

IF TYPE("_screen.activeform.activecontrol.name") = "C" && check for a valid control
_screen.activeform.activecontrol.setfocus() && set fopcus to that control so it loses and regains focus thus
&& updating it controlsource
ENDIF
_screen.activeform.cmdSave.click()
Previous
Reply
Map
View

Click here to load this message in the networking platform