Skip to main content



      Home
Home » Eclipse Projects » SWTBot » How to identify keystroke
How to identify keystroke [message #24976] Sun, 01 March 2009 09:54 Go to next message
Eclipse UserFriend
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] Sun, 01 March 2009 20:55 Go to previous messageGo to next message
Eclipse UserFriend
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 10:16 Go to previous messageGo to next message
Eclipse UserFriend
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] Mon, 02 March 2009 22:42 Go to previous messageGo to next message
Eclipse UserFriend
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] Mon, 02 March 2009 23:37 Go to previous messageGo to next message
Eclipse UserFriend
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 18:54 Go to previous message
Eclipse UserFriend
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: Sun Jun 08 05:17:30 EDT 2025

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

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

Back to the top