Finish textbox and grid editing on Menu click ?

E

elijahs

This seems like an obvious one but it has me stumped.

I have a complex form with a bunch of databound grids and textbox
controls. There is a MainMenu control, and a toolbar control with
shortcuts to some of the most common commands - for instance, Save.

When I click on a toolbar control, I can catch the ItemClick event and
do a toolbar.Focus call to switch focus to the toolbar, thereby
pulling focus from whatever input control was previously focused.
This allows the LostFocus event to finish up whatever editing
operation was in, so that the Save command executes with all object
fields updated correctly.

But I can't figure out how to trap a similar event on the MainMenu
item. Do I really have to put a Focus call into every MenuItem.Click
event? That seems rather hacky; I'd be surprised if there's no way
to determine that the MainMenu has been clicked on or received focus
or something?

thanks!

elijah
 
C

Cor Ligthert[MVP]

elijah,

I really cannot get what is your goal.

It sounds as it is the EndEdit (for version 2003 EndCurrentEdit because
there EndEdit has a bug) what you are looking for.

That pushes all data in the controls to the datasource.

Whatever focus there is on. (I am talking about Microsoft controls, I know
controls with bugs who don't do this).

Cor
 
E

elijahs

ok - my goal is to pull focus from whatever control has it, when any
menuitem is clicked. This is so that the control with focus at the
time can validate before the menu command executes.

With the toolbar, I can handle the ItemClick event and execute
Toolbar.Focus to get this done. I'm wondering how to do a similar
thing with a MainMenu control, without putting code into every
MenuItem click event...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top