Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
There are 4 views used in my application, I have shortcut keys for each. I want to ignore all the messages to the another views when the one view is activated. e.g. When I am writing in the edit control of the edit view only the edit control reacts to keypresses, so no another views should get the key pressed event .

How to know that i am editing in the application. i.e Editor mode is on . and not to pass the key pressed events to another view.? as it may be shortcut keys of that another view
Posted
Updated 17-Jun-11 1:45am
v3
Comments
Sergey Alexandrovich Kryukov 17-Jun-11 1:22am    
Not clear at all. What is that mode? There is no such concept. Please explain what do you mean.
--SA
gopal.ambhore 17-Jun-11 1:36am    
there are 4 views used in my application. Now i had shortcut keys for each view. I want to ignore all the messages to the another views when the one view is activated. Fir eg i am writing in the edit control of the one view and i want that i am presently editing that control. so no another views should get the key pressed event .
Keith Barrow 17-Jun-11 7:48am    
Please update your question (I have done this for you as an example) rather than replying in the comments: this makes it easier for all people reading the Question to understand your problem.
Keith Barrow 17-Jun-11 7:52am    
As an initial answer I'd say that when you switch between views you set a variable of some sort which keeps track of the state (e.g. to "Edit") and only the form with the current state reacts.
I haven't cut any c++ for *quite* a while so this may be ignorance on my part, but my guess is your UI design is wrong: why would a non-edit form react to events on the edit form? This would be easier to know if you post some code!

1 solution

I don't really use the MFC Document/View architecture much, but this MSDN article on multiple views may help:

http://msdn.microsoft.com/en-us/library/s199bks0(v=vs.80).aspx[^]

You should record which view you are in when switching from one to another, and then refer back to that when handling the key-press events.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900