Text event on main form
Giovanni Carletti
Dear All,suppose to have SBO open with standard menu on the left, and customer press "Hello" on the keyboard (you don't see anything ôn your video): how can intercept this string?
Regards,
Giovanni
Friederike Mundt
Hi Giovanni,I am not sure what the issue is. Could you be a bit more specific at what exactly you are doing?
Kind Regards,
Friederike
Anders Olsson
Hello Giovanni,You can intercept keypresses by subscribing to the SwissAddonFramework.Global.ItemEvent event. Below is a code example that waits for the sequence h-e-l-l-o and shows a messagebox when entered. This can be placed in a startup rule.
System.Text.StringBuilder sb = new System.Text.StringBuilder();
SwissAddonFramework.Global.ItemEventHandler del = null;
del = delegate(string formUID, ref SAPbouiCOM.ItemEvent ev, ref bool bubbleEvent)
{
if (!ev.BeforeAction)
{
int c = ev.CharPressed;
if (sb.Length == 5)
{
sb.Remove(0, 1);
}
sb.Append(((char)c).ToString());
string str = sb.ToString();
if (str == "hello")
{
MessageBox.Show("User entered hello", "OK");
}
}
};
SwissAddonFramework.Global.ItemEvent += new Global.ItemEventHandler(del);
Regards,
Anders
0
Please sign in to leave a comment.
Comments
0 comments