I think there should be two modes for setting text. The simple one is to use 
the setText(...) method directly (inside SWTBot of course).

The other one are keypress events for each letter which needs to be set as text.

A commercial tool had a recording option to either record all the keypress 
events when text is input or to use the much simpler setText(...) command.



--- On Sat, 11/15/08, Phil Quitslund <[EMAIL PROTECTED]> wrote:
From: Phil Quitslund <[EMAIL PROTECTED]>
Subject: Re: [SWTBot-users] question about SWTBotText.notifyKeyboardEvent(..)
To: [email protected]
Date: Saturday, November 15, 2008, 10:57 PM

Hey Ketan,

Thanks for this.  On the surface it does work but it has (for me) the 
unfortunate side effect that my running test needs to have keyboard focus. 
Ideally, I'd like not to have to require this.  Since this is really part
of a 
bigger theme, I've picked up on it in a separate thread (re: Background 
Exceution).  I look forward to your thoughts!


-phil



Ketan Padegaonkar wrote:
> Hi Phil,
> 
> This snippet perhaps? It worked on macosx for me.
> 
> private void traverse(Display d) {
>       // tab ten times
>       for (int i = 0; i < 10; i++) {
>               d.post(tabDown());
>               d.post(tabUp());
>               try {
>                       Thread.sleep(100);
>               } catch (InterruptedException niceTry) {
>               }
>       }
> }
> 
> private Event tabDown() {
>       Event event = new Event();
>       event.type = SWT.KeyDown;
>       event.keyCode = SWT.TAB;
>       event.character = SWT.TAB;
>       return event;
> }
> 
> private Event tabUp() {
>       Event event = new Event();
>       event.type = SWT.KeyUp;
>       event.keyCode = SWT.TAB;
>       event.character = SWT.TAB;
>       return event;
> }
> 
> -- Ketan
> 
> 
> Phil Quitslund wrote:
>> Hey all,
>>
>> Looking at SWTBotText.notifyKeyboardEvent(int, char, int), I notice
that after 
>> key down and up events are posted a setText(..) is called.  Is there
no other 
>> way?   (Programmatic setting of text values doesn't feel quite
right and 
>> generates behavior that's a bit different than the "real
thing" --- notably the 
>> cursor does not advance...)  I tried removing it and, unsurprisingly,
the 
>> desired text was not entered/typed.  My next thought was to fill in
more of the 
>> event details. Specifically by synthesizing and posting the
VerifyEvent and 
>> ModifyEvent that occur between the key down and up but nothing doing.
>>
>> Any thoughts?
>>
>> Thanks!
>>
>>
>> -phil
>>
>>
>>
-------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
>> Build the coolest Linux based applications with Moblin SDK & win
great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> SWTBot-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/swtbot-users
>> http://swtbot.org/ - a functional testing tool for SWT/Eclipse
>>
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
> Build the coolest Linux based applications with Moblin SDK & win great
prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> SWTBot-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/swtbot-users
> http://swtbot.org/ - a functional testing tool for SWT/Eclipse
> 
> 

-- 
Phil Quitslund
Instantiations, Inc.
http://www.instantiations.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse




      
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to