Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to using Enter key on a text box
How to using Enter key on a text box [message #1006109] Tue, 29 January 2013 23:20 Go to next message
Minnie P is currently offline Minnie PFriend
Messages: 15
Registered: January 2013
Junior Member
I have been trying to use the enter key on a text box but somehow i can never get it working.I dont have any errors but it does not click enter.

Situation is I have a text box and i need to fill in a text and click enter and only then i have items that load . I have been trying this code

setText(labelname, text, dialogtitle);
key.pressShortcut(SWT.CR,SWT.LF);

Could anyone help me out on how to get this working??

Here is the screenshot
Capture.jpg index.php/fa/13150/0/ shows before clicking enter
Capture2.jpg index.php/fa/13151/0/ shows after clicking enter
  • Attachment: Capture.JPG
    (Size: 23.77KB, Downloaded 1730 times)
  • Attachment: Capture2.JPG
    (Size: 21.75KB, Downloaded 1697 times)
Re: How to using Enter key on a text box [message #1006223 is a reply to message #1006109] Wed, 30 January 2013 13:52 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I think you need to call pressShortcut on the Text control instead of a key, as you want to press a key while the text control has the focus. At least this is how I understand it.
Re: How to using Enter key on a text box [message #1006312 is a reply to message #1006223] Wed, 30 January 2013 19:04 Go to previous messageGo to next message
Minnie P is currently offline Minnie PFriend
Messages: 15
Registered: January 2013
Junior Member
Hey Dirk,
Yeah i tried that too.But it doesnt work.DO we need to add anything else for this to work??

SWTBotText botText = bot.text("High-level qualifier:");
botText.pressShortcut(SWT.CR,SWT.LF);


Thanks,
Minnie
Re: How to using Enter key on a text box [message #1006382 is a reply to message #1006312] Thu, 31 January 2013 08:13 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Well, two questions on that, do you have the correct text reference? As it seems you like to get a Text control for a label, but you are using the method for searching a Text control for the specified text. Otherwise you should use textWithLabel() or something that fits your needs.

If you have the correct reference, than maybe you need to first set the focus to the control.
Re: How to using Enter key on a text box [message #1006389 is a reply to message #1006312] Thu, 31 January 2013 08:34 Go to previous message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

On 01/30/2013 08:04 PM, manali pattem wrote:
> Hey Dirk,
> Yeah i tried that too.But it doesnt work.DO we need to add anything
> else for this to work??
>
> SWTBotText botText = bot.text("High-level qualifier:");
> botText.pressShortcut(SWT.CR,SWT.LF);

Hi,

Have you read this: http://www.eclipse.org/forums/index.php/t/14207/ ?

pressShortcut won't work because it sends events simultaneously, whereas
the ENTER key usually sends 2 successive events.

Maybe botText.typeText(KeyStroke.getInstance(SWT.CR) + " " +
KeyStroke.getInstance(SWT.LF), 0)
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:SWTBot for custom SWT control
Next Topic:View Toolbar button issue while SWTBot and Eclipse Juno
Goto Forum:
  


Current Time: Thu Apr 25 07:44:26 GMT 2024

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

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

Back to the top