Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to identify keystroke
How to identify keystroke [message #24976] Sun, 01 March 2009 14:54 Go to next message
Manju Mathew is currently offline Manju MathewFriend
Messages: 3
Registered: July 2009
Junior Member
Hello,

Is it possible to track keystrokes like SWT.TAB, SWT.CTRL+'S' using
Swtbot.

Regards,
Manju
Re: How to identify keystroke [message #25015 is a reply to message #24976] Mon, 02 March 2009 01:55 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
Err...

What is it that you're trying to do ? Why does swtbot need to track
keystrokes ?

-- Ketan

On 1/3/09 20:24, Manju Mathew wrote:
> Hello,
>
> Is it possible to track keystrokes like SWT.TAB, SWT.CTRL+'S' using Swtbot.
>
> Regards,
> Manju
>
Re: How to identify keystroke [message #25339 is a reply to message #24976] Mon, 02 March 2009 15:16 Go to previous messageGo to next message
Hans Schwaebli is currently offline Hans SchwaebliFriend
Messages: 70
Registered: July 2009
Member
If you mean to use it and not to record it, I made a helper class for it:
http://rafb.net/p/CcIB3a33.html

Sometimes a event is fired after TAB is pressed, so I need to invoke it in
an automated way.
Re: How to identify keystroke [message #25379 is a reply to message #25339] Tue, 03 March 2009 03:42 Go to previous messageGo to next message
Manju Mathew is currently offline Manju MathewFriend
Messages: 3
Registered: July 2009
Junior Member
The editor we are using is a Form based editor.
1) There are many widgets which will be visible only if we scroll the
page. It would have been good if SWTBot can listen to keystokes like TAB,
so as to navigate to different widgets.
2) CTRL+'A' to select the entire content of a text box widget.
3) DEL key to delete an item from a tree viewer.

Above are some of the usecases.

~Manju
Re: How to identify keystroke [message #25420 is a reply to message #25379] Tue, 03 March 2009 04:37 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan PadegaonkarFriend
Messages: 873
Registered: July 2009
Senior Member
This is a classic case for providing support for forms based editors.
There's no support for forms out of the box, and I've not had the time
to do a spike about it either.

On 3/3/09 09:12, Manju Mathew wrote:
> The editor we are using is a Form based editor. 1) There are many
> widgets which will be visible only if we scroll the page. It would have
> been good if SWTBot can listen to keystokes like TAB, so as to navigate
> to different widgets.

bot.button("foo").setFocus();
bot.button("foo").traverse(Traverse.TAB_NEXT);

> 2) CTRL+'A' to select the entire content of a text box widget.

You probably want to just call setText():

bot.textbox().setText("some text");

> 3) DEL key to delete an item from a tree viewer.

There is no API to send keystrokes to any widget. You may use
Display.post(event) with the DEL key to achieve this. If you open a bug
about this someone could provide a nicer API to send keystrokes to widgets.

> Above are some of the usecases.
>
> ~Manju
>
Re: How to identify keystroke [message #25616 is a reply to message #25379] Tue, 03 March 2009 23:54 Go to previous message
Ketan Patel is currently offline Ketan PatelFriend
Messages: 68
Registered: July 2009
Member
This is pretty easy to do in SWT...you should look at class Hans posted in
this thread

http://www.eclipse.org/newsportal/article.php?id=391&gro up=eclipse.swtbot#391
Previous Topic:Recent Junit 4.5 issues and some explanations
Next Topic:Clicking a link insider an editor
Goto Forum:
  


Current Time: Thu Mar 28 21:54:23 GMT 2024

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

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

Back to the top