how to catch a press key event?
cedric therency
Hi,I want to catch an [ENTER] press key in order to bypass the current event that click to the item "1" of a form (button : Create,Update)
i've tried this piece of code to detect a key press(keyDown) on a form:
try{
SwissAddonFramework.UI.EventHandling.ItemEvents.FormKeyDownEventHandler del = null;
del = delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.FormKeyDown evt){
MessageBox.Show("keydown", "OK");
};
pVal.Form.AddHandler_KeyDown(ModeComponent.FormModes.ALL, null, del);
}
catch(System.Exception ex){
string message = ex.Message;
Debug.WriteMessage(message, SwissAddonFramework.Messaging.Debug.DebugLevel.Exception);
StatusBar.WriteError(message);
}
return true;
but it don't work!!!
Please, can i have some help please?? :bang:
Manuel Marhold
Hi Cedric,just set the button as defaultbutton, the system will do what you want.
cedric therency
Thanks for your answer but I don't know what you mean!!But can i catch a press key event in c# through CoreSuite Customize when i'm on a form and have you got a piece of code to do that.
Thanks again for your help!
Manuel Marhold
Hi ,I think you want folliwing behavior:
If the user presses ENTER, the button on lower left (Update, Ok, Add, Search) will be activated (pressed).
You can do this by setting Form.DefaultButton =
I don't know if "DefaultButton" is the corrwct name, but something like this.
and you have to replace with the UniqueID of the button.
Sascha Balke
Hi CedricSamples:
Button.GetFromUID(pVal.Form, "2").Click(Item.ClickType.Regular);
or
SwissAddonFramework.UI.Components.MenuItem.GetFromUID("your menuid").Activate();
or
SwissAddonFramework.Messaging.SendKeys.Send("your key");
http://msdn.microsoft.com/de-de/library/system.windows.forms.sendkeys%28VS.80%29.aspx
hth
0
Please sign in to leave a comment.
Comments
0 comments