Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Event on the button (SWT)  RSS feed

 
Lukasz Kaleta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wont to click on the button (in SWT) and this button must generete the same result when I push CAPS_LOCK on the keyboard. How to do this, please write some code example
 
Stephen Holder
author
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand your question... do you mean that clicking the button in your UI should activate the Caps Lock key on your keyboard? Off the top of my head, I'm not sure that is possible. If you can explain your situation & requirements a bit more clearly, I'll try to help you out.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Stephen is correct in his assumption I would have to agree with him. However, you could emulate this funcationallity. When the button is pressed you could make sure that whatever is typed in the text area is converted to all caps as it is typed. Although the light on the keyboard will not change.
 
Stephen Holder
author
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg is right, emulating this in an SWT text area is not hard. The most straightforward approach is to listen for button presses, and when they occur simply update a flag indicating whether or not to capitalize. Then you can use a VerifyListener on the Text widget to capitalize text as it is entered, if the flag is turned on.

And, as a happy coincidence, capitalizing text with a VerifyListener is the very example that starts off Chapter 5 of our book .
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stephen Holder:
And, as a happy coincidence, capitalizing text with a VerifyListener is the very example that starts off Chapter 5 of our book .


Hey, was this whole thread staged.
 
Lukasz Kaleta
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, thanks. I write a Keyboard for PDA in JAVA. I have also problem with arrow_up_button and arrow_down_button and I don't now how to emulate this buttons on me Text area. If you have some suggestion to help me... . Sorry for me style of writing this message. I'am not good in English
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!