By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,247 Members | 1,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,247 IT Pros & Developers. It's quick & easy.

Finish textbox and grid editing on Menu click ?

P: n/a

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?


Feb 16 '08 #1
Share this Question
Share on Google+
2 Replies

P: n/a

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).


Feb 16 '08 #2

P: n/a
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...
Feb 22 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.