Page 1 of 1

ActionKeys

Posted: Wed Mar 14, 2007 4:14 am
by behdad
Hi Jeno,

I tried to incorporate the action keys into my code but the test run terminates prematurely. The code I used was somthing similar to:

Code: Select all

Application.SetActionKey(Action.Pause, System.Windows.Forms.Keys.F2);
As soon as I comment this out it will work again. I get Ranorex.CommandFailedException at the point when I try to select an item from a context menu.

Can you please help?

Also what would you use to combine keys? is it '|'?

Thank you.
Behdad.

Posted: Wed Mar 14, 2007 9:23 pm
by webops
behdad wrote:I get Ranorex.CommandFailedException at the point when I try to select an item from a context menu.
We could also reproduce a problem with the ActionKey 'Pause' and a context menu. But it happens only if the ActionKey will be pressed while the context menu is open.

Did you press the ActionKey or do you have the same shortcut as the action key in your application?

behdad wrote:Also what would you use to combine keys? is it '|'?
Yes, you can combine the action key and a key modifier with '|':

Code: Select all

Application.SetActionKey(Action.Exit, System.Windows.Forms.Keys.F2 | System.Windows.Forms.Keys.Control);
Jenö
Ranorex Team

Posted: Thu Mar 15, 2007 1:16 am
by behdad
Hi Jeno,

No I didn't press any key while the test was running. It also happens when I use the Exit instead of Pause.

Behdad.

Posted: Fri Mar 16, 2007 12:08 am
by webops
behdad wrote:I get Ranorex.CommandFailedException at the point when I try to select an item from a context menu.
First idea:

Ranorex uses global keyboard hooks if you set an action key, the whole system is a little bit slower as usual.
It can happen, that the context menu comes a little bit later in the tested application as without the action key.
Can you please try to insert a Sleep between Mouse.Click(RightButton) and ContextMenu.SelectItemText.

Code: Select all

Mouse.Click(MouseButtonType.RightButton, ...)
Application.Sleep(200);
ret = ContextMenu.SelectItemText("ContextMenuItem");
Jenö
Ranorex Team

Action Keys

Posted: Mon Mar 19, 2007 1:15 am
by behdad
Jeno,

That did work. It is strange, I did thought that it is a timing issue but I didn't get it right.

Thanks again.
Cheers,
Behdad.