Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to send a key event in code?
How to send a key event in code? [message #438927] Sun, 04 July 2004 07:43 Go to next message
Hank is currently offline HankFriend
Messages: 10
Registered: July 2009
Junior Member
I want to fire a key event in code to make the program act as if a user
pressed a key.Is this possible? And how to?
Thanks and regards,

Hank
Re: How to send a key event in code? [message #438938 is a reply to message #438927] Mon, 05 July 2004 15:06 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
You can generate an OS key event with Display.post(Event). Alternatively if
you just want to notify a widget's listeners then use
Widget.notifyListeners(...).

Grant

"Hank" <hzhou@actuate.com> wrote in message news:cc8ce2$795$1@eclipse.org...
> I want to fire a key event in code to make the program act as if a user
> pressed a key.Is this possible? And how to?
> Thanks and regards,
>
> Hank
>
>
Re: How to send a key event in code? [message #439122 is a reply to message #438938] Tue, 06 July 2004 11:10 Go to previous messageGo to next message
Hank is currently offline HankFriend
Messages: 10
Registered: July 2009
Junior Member
Thanks for your reply. But I can't find Display.post(Event). There is only
Display.postEvent(Event), but it is not a public method, so I cannot use it.
Is there any other way?

"Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
news:ccbqp3$7e2$1@eclipse.org...
> You can generate an OS key event with Display.post(Event). Alternatively
if
> you just want to notify a widget's listeners then use
> Widget.notifyListeners(...).
>
> Grant
>
> "Hank" <hzhou@actuate.com> wrote in message
news:cc8ce2$795$1@eclipse.org...
> > I want to fire a key event in code to make the program act as if a user
> > pressed a key.Is this possible? And how to?
> > Thanks and regards,
> >
> > Hank
> >
> >
>
>
Re: How to send a key event in code? [message #439177 is a reply to message #439122] Tue, 06 July 2004 16:19 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
It's new for 3.0.

"Hank" <hzhou@actuate.com> wrote in message news:cce1ai$mlq$1@eclipse.org...
> Thanks for your reply. But I can't find Display.post(Event). There is only
> Display.postEvent(Event), but it is not a public method, so I cannot use
it.
> Is there any other way?
>
> "Grant Gayed" <grant_gayed@ca.ibm.com> wrote in message
> news:ccbqp3$7e2$1@eclipse.org...
> > You can generate an OS key event with Display.post(Event).
Alternatively
> if
> > you just want to notify a widget's listeners then use
> > Widget.notifyListeners(...).
> >
> > Grant
> >
> > "Hank" <hzhou@actuate.com> wrote in message
> news:cc8ce2$795$1@eclipse.org...
> > > I want to fire a key event in code to make the program act as if a
user
> > > pressed a key.Is this possible? And how to?
> > > Thanks and regards,
> > >
> > > Hank
> > >
> > >
> >
> >
>
>
Re: How to send a key event in code? [message #439441 is a reply to message #438927] Mon, 12 July 2004 18:23 Go to previous message
Douglas Pollock is currently offline Douglas PollockFriend
Messages: 84
Registered: July 2009
Member
Hank wrote:
> I want to fire a key event in code to make the program act as if a user
> pressed a key.Is this possible? And how to?

Also, you can use AWT's Robot class to do this.



cheers,
d.
Previous Topic:Hyperthreading, SWT and Windows 2003
Next Topic:Bug in Eclipse?
Goto Forum:
  


Current Time: Fri Apr 26 06:11:05 GMT 2024

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

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

Back to the top