| View previous topic :: View next topic |
| Author |
Message |
behdad
Joined: 22 Nov 2006 Posts: 16 Location: Australia
|
Posted: Wed Mar 14, 2007 5:14 am Post subject: ActionKeys |
|
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: click into code to enlarge
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. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Wed Mar 14, 2007 10:23 pm Post subject: |
|
| 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: click into code to enlarge
Application.SetActionKey(Action.Exit, System.Windows.Forms.Keys.F2 | System.Windows.Forms.Keys.Control);
Jenö
Ranorex Team |
|
| Back to top |
|
 |
behdad
Joined: 22 Nov 2006 Posts: 16 Location: Australia
|
Posted: Thu Mar 15, 2007 2:16 am Post subject: |
|
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. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Fri Mar 16, 2007 1:08 am Post subject: |
|
| 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: click into code to enlarge
Mouse.Click(MouseButtonType.RightButton, ...)
Application.Sleep(200);
ret = ContextMenu.SelectItemText("ContextMenuItem");
Jenö
Ranorex Team |
|
| Back to top |
|
 |
behdad
Joined: 22 Nov 2006 Posts: 16 Location: Australia
|
Posted: Mon Mar 19, 2007 2:15 am Post subject: Action Keys |
|
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. |
|
| Back to top |
|
 |
|