ActionKeys

Class library usage, coding and language questions.
behdad
Posts: 16
Joined: Wed Nov 22, 2006 10:56 pm
Location: Australia

ActionKeys

Post by behdad » Wed Mar 14, 2007 4:14 am

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.

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Wed Mar 14, 2007 9:23 pm

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

behdad
Posts: 16
Joined: Wed Nov 22, 2006 10:56 pm
Location: Australia

Post by behdad » Thu Mar 15, 2007 1:16 am

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.

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Fri Mar 16, 2007 12:08 am

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

behdad
Posts: 16
Joined: Wed Nov 22, 2006 10:56 pm
Location: Australia

Action Keys

Post by behdad » Mon Mar 19, 2007 1:15 am

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.