I have few buttons in my windows application which has mnemonics.Now if i press multiple keys the events of the button clicks gets fired as i have used mnemonics. But the behaviour is not as expected,because second button event handler is getting executed before the first button event handler has finished its execution,and also i have written my code in such a way that in the event handler of first button i am disabling my second button,still the second button event handler is getting executed.The problem here is due to mnemonics.PLease suggest me a better way to handle mnemonics as soon as possible. Thanks in advance.
Asked
Active
Viewed 165 times
-1
-
1Please give us some code to work with so we won't have to make wild guesses. – staafl Mar 14 '13 at 06:55
-
Hi,if possible can you suggest me a better way or any COM component for handling mnemonics,I have found one i.e is IKeyBoardinputsink interface but it is present in .NET framework 3.0 and i'm using .netframework 2.0,if possible kindly suggest me any workaround or any reference which will provide me an interface to handle this – Shyam Pramanik Mar 14 '13 at 07:14
-
No. There is nothing inherently wrong with .NET's mnemonics implementation and the problem is almost certainly in your application logic. – staafl Mar 14 '13 at 07:20
-
Hi,i am pressing the keys simultaneously.Due to this, problem is occuring, mnemonic of second button is not realizing that it is not suppose to execute the event handler as i have already disabled it before.. – Shyam Pramanik Mar 14 '13 at 07:28
1 Answers
0
If your logic is tied to your buttons, change that. Let your buttons merely manipulations an object that implements your logic. You can then check in this object whether the requested action is allowed (i.e. whether the previous operation has finished.
Alternatively you can just disable buttons when running and re-enable then when.finished.

CodeCaster
- 147,647
- 23
- 218
- 272
-
Hi, i cannot change the code..but if possible can you suggest me a better way or any COM component for handling mnemonics,I have found one i.e is IKeyBoardinputsink interface but it is present in .NET framework 3.0 and i'm using .netframework 2.0,if possible kindly suggest me any workaround or any reference which will provide me an interface to handle this. – Shyam Pramanik Mar 14 '13 at 07:10
-
IKeyBoardinputsink interface is an interface present in System.Windows.Interop namespace....but in .NET framework 2.0 this referenece is not present – Shyam Pramanik Mar 14 '13 at 07:24
-
You have a bug in your software, applying some COM interface isn't going to magically solve that. – CodeCaster Mar 14 '13 at 07:33