Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data is different from menu?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de menu & Menus
Divers
Thread ID:
00048278
Message ID:
00048620
Vues:
24
>>>>>>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.
>>>>>>>Valerie (and Bret) the reason for this is that if you click on a menu or toolbar button the focus in NOT removed from your activecontrol. As long as the focus is still there, the table.field value isn't updated to what's in the buffer.
>>
>>When you de-bugged, you changed the focus - so it worked correctly. Your SetFocus() workaround simple moves the focus an extra time. Another way to do this is to have an invisible object as part of your base form class. Every toolbar button sets focus to that object before calling its own code/action.
>>
>>HTH
>>Barbara
>
>Hi Barbara,
>
>I'm interested in this technique you use for forcing the control to lose focus. I understand that you can subclass the toolbar button and write generic code to move the focus, but what about menus. Would it be necessary to code into each menu option the command to SetFocus to this invisible object?
>
>Personally, I have been using the WriteBuffer method that both Tastrade and Codebook uses. The only problem is it doesn't work well when a grid is the active control!
>
>Just looking for alternatives!
>
>Darrel

Darrel, I don't (personally) use toolbars and menus for Next/Prev or Save/Undo type actions. However, the easiest way around the menu problem is to

1. If there is a matching toolbar button, simply call the toolbar-button click method. One set of code.....

2. If you're calling a second form and want to save data from your active form before it's deactivated, then put code for this in your form deactivate. Can be done at class level. (This I DO have in many forms)

The WriteBuffer method also has problems with Edit Box editing when you have a popup form to edit a memo.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform