Sunday, June 24, 2012 1:16 PM
Hi, I have the following problem:
I created an isolated shell program
with DataGrid and OleMenuCommand that it's keybinding is 'F4'
I try to disable the comboBox open event with 'F4' and instead call the OleMenuCommand that is keybinding is 'F4' ( maybe user changed the keys, so need to check if there is any??).
How do I check in the if there is a command with 'F4' key in the WindowPane ? How to call it?
Sunday, June 24, 2012 5:32 PMModerator
F4 is, by default, bound to the command that shows the properties window, at least at the global scope. For it to be triggering a combo open/close it implies VS did not find a keybinding that matched against an enabled command. It would be necessary to know at least the following for your situation:
1: How are you declaring your command (VSCT I assume) and associating the keybinding with it?
2: What is the scope of the keybinding (global, tied to a specific toolwindow, etc...)?
Monday, June 25, 2012 7:30 AM
I declared the command in the VSCT file
<RemoveShortcut Command="View.PropertiesWindow" Scope="Global">F4</RemoveShortcut>
<Shortcut Command="MyCommand" Scope="Global">F4</Shortcut>
- Edited by Idan2000 Monday, June 25, 2012 7:31 AM
Monday, June 25, 2012 3:44 PMModerator
Are you using WPF or WinForms or Win32 for your toolwindow UI?
The only way the UI layer (WPF, WinForms, etc..) would get the key in such a way as to possibly use it for interaction with a combo box is if VS didn't translate it into a command (we run the message pump so we see all messages before WPF/WinForms/Win32 UI would).
It sounds like either:
A) You are using WinForms for your UI, WindowPane (from MPF) for your toolwindow pane and you have not overridden PreProcessMessage to prevent the keystroke from being passed on the WinForms.
B) You have overridden PreProcessMessage to explicitly pass the message on yourself.
C) Your command is not reporting as enabled thus the keybinding matchup fails and we pass the message on the the UI framework.
- Marked As Answer by Ego JiangMicrosoft Contingent Staff, Moderator Tuesday, July 03, 2012 7:43 AM
Tuesday, July 03, 2012 7:43 AMModerator
I will mark Ryan's reply as answer.
If it is not the answer you want, please unmark it.
MSDN Community Support | Feedback to us