Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » How to detect if CAPS LOCK is on?
How to detect if CAPS LOCK is on? [message #504034] Wed, 16 December 2009 21:18 Go to next message
Lewis Nguyen is currently offline Lewis Nguyen
Messages: 5
Registered: November 2009
Junior Member
I am using the typeText method to type a path into a comboBox. I want to check to make sure that CAPS LOCK is not activated before typing; and if it is, to disable it. How would I do that in SWTBot?
Re: How to detect if CAPS LOCK is on? [message #504036 is a reply to message #504034] Wed, 16 December 2009 21:24 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
This is currently not supported by swt (hence swtbot cannot support it)

However there's a workaround that you may use. See the Toolkit's
getLockingKeyState() method for more[1].

-- Ketan

[1] -
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Toolkit.htm l#getLockingKeyState(int)

On 12/16/09 1:18 PM, Lewis Nguyen wrote:
> I am using the typeText method to type a path into a comboBox. I want to
> check to make sure that CAPS LOCK is not activated before typing; and if
> it is, to disable it. How would I do that in SWTBot?
Re: How to detect if CAPS LOCK is on? [message #504207 is a reply to message #504034] Thu, 17 December 2009 16:52 Go to previous message
Lewis Nguyen is currently offline Lewis Nguyen
Messages: 5
Registered: November 2009
Junior Member
Thanks for the reply.
I don't know if it's appropriate for me to ask for further help on this workaround since it is not part of SWTBot but I created a subclass that extends the Toolkit class in order to access the methods. When I run my test, however, JUnit gets an error saying "java.lang.UnsupportedOperationException: Toolkit.getLockingKeyState".
According to the javadocs, this exception is thrown if the host system doesn't allow getting the state of this key programmatically. It is the same case for setLockingKeyState.
Is there a fix for this?
Previous Topic:SWTBOT testing trees with Label decorators applied
Next Topic:Problem while exporting plugin for headless execution
Goto Forum:
  


Current Time: Thu Sep 18 09:52:54 GMT 2014

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

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