Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Sending CTRL + F10 to a SWTBotEclipseEditor
Sending CTRL + F10 to a SWTBotEclipseEditor [message #20049] Thu, 05 February 2009 23:55 Go to next message
Joe Luebker is currently offline Joe LuebkerFriend
Messages: 36
Registered: July 2009
Member
Hello,

Is there a way to send a Ctrl + F10 keyboard event via a
SWTBotEclipseEditor? I see the notifyKeyboardEvent() methods but I do
not need to send a character which those methods require as an argument.
I only need to send a particular keyboard event.

In my case I am actually trying to open the context menu of the vertical
ruler in a source editor.

Thanks,
Joe
Re: Sending CTRL + F10 to a SWTBotEclipseEditor [message #20457 is a reply to message #20049] Fri, 06 February 2009 11:31 Go to previous messageGo to next message
Michael Wagner is currently offline Michael WagnerFriend
Messages: 1
Registered: July 2009
Junior Member
Hi,

>Is there a way to send a Ctrl + F10 keyboard event via a SWTBotEclipseEditor?

Not directly an answer but this helped me from time to time:

Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_F10);
robot.keyRelease(KeyEvent.VK_F10);
robot.keyRelease(KeyEvent.VK_CONTROL);

Would be interested in a better way, too.

Michael - who can luckily post over his bugzilla-account since news are
not allowed on my side:-) Thanks for this service!
Re: Sending CTRL + F10 to a SWTBotEclipseEditor [message #20458 is a reply to message #20049] Fri, 06 February 2009 13:16 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Joe,

Here's the event that's generated. Based on this I suppose you'll need
to call: notifyKeyboardEvent(SWT.CTRL, 0, SWT.F10);

protected Event keyEvent(int modificationKey, char c, int keyCode) {
Event keyEvent = createEvent();
keyEvent.stateMask = modificationKey;
keyEvent.character = c;
keyEvent.keyCode = keyCode;
return keyEvent;
}

-- Ketan

On 6/2/09 05:25, Joe Luebker wrote:
> Hello,
>
> Is there a way to send a Ctrl + F10 keyboard event via a
> SWTBotEclipseEditor? I see the notifyKeyboardEvent() methods but I do
> not need to send a character which those methods require as an argument.
> I only need to send a particular keyboard event.
>
> In my case I am actually trying to open the context menu of the vertical
> ruler in a source editor.
>
> Thanks,
> Joe
Re: Sending CTRL + F10 to a SWTBotEclipseEditor [message #20490 is a reply to message #20458] Fri, 06 February 2009 15:05 Go to previous message
Joe Luebker is currently offline Joe LuebkerFriend
Messages: 36
Registered: July 2009
Member
Thanks, that was very close. I actually had to call:
notifyKeyboardEvent(SWT.CTRL, (char)0, SWT.F10); as '0' wasn't accepted
as a character.

I seem to be having issues interacting with the context menu that is
displayed after sending that keyboard event. I may post again about that
if I don't find a solution quickly.

Thanks again,
Joe

Ketan Padegaonkar wrote:
> Joe,
>
> Here's the event that's generated. Based on this I suppose you'll need
> to call: notifyKeyboardEvent(SWT.CTRL, 0, SWT.F10);
>
> protected Event keyEvent(int modificationKey, char c, int keyCode) {
> Event keyEvent = createEvent();
> keyEvent.stateMask = modificationKey;
> keyEvent.character = c;
> keyEvent.keyCode = keyCode;
> return keyEvent;
> }
>
> -- Ketan
>
> On 6/2/09 05:25, Joe Luebker wrote:
>> Hello,
>>
>> Is there a way to send a Ctrl + F10 keyboard event via a
>> SWTBotEclipseEditor? I see the notifyKeyboardEvent() methods but I do
>> not need to send a character which those methods require as an argument.
>> I only need to send a particular keyboard event.
>>
>> In my case I am actually trying to open the context menu of the vertical
>> ruler in a source editor.
>>
>> Thanks,
>> Joe
>
Previous Topic:GET SUBTEXT
Next Topic:Nightly builds now available!
Goto Forum:
  


Current Time: Sat Nov 09 01:42:25 GMT 2024

Powered by FUDForum. Page generated in 0.03119 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top