Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » event between the display and the system.
event between the display and the system. [message #453782] Fri, 08 April 2005 20:15 Go to next message
bbskill is currently offline bbskillFriend
Messages: 26
Registered: July 2009
Junior Member
can anyone detailly tell me how the system post a event such as keyEvent
to a display .
I can't find it in the source of swt. can anyone give more information
about that?
And But if the display (neither its shells ) is not focus,
how can the display (or shell)listen to
the key pressed of the OS ?
What I want is to set a shortcut key for my application .
that is , when my applicatin isn't in focus ,maybe running
in the background,it will react to the some keys of the OS when they are
pressed.
so I want to know whether can the display actively detect the key's
pressed event
of the system.
Thanks for your help !
Re: event between the display and the system. [message #453838 is a reply to message #453782] Mon, 11 April 2005 20:30 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Background: The system posts events to the event queue for the process. All
SWT programs include an event loop. The call to Display.readAndDispatch()
gets the next event from the event queue and dispatches it to the
appropriate widget. If you don't have an event loop, key and mouse events
won't get dispatched and your appliacation will appear hung.

If a shell is not in focus, then the key is not going to SWT, so it can't be
detected. There are low level Windows calls that allow you to see key
presses no matter which process is running but this is beyond the scope of
SWT.

"bbskill" <bbkills@tom.com> wrote in message
news:d36gqm$hji$1@news.eclipse.org...
> can anyone detailly tell me how the system post a event such as keyEvent
> to a display .
> I can't find it in the source of swt. can anyone give more information
> about that?
> And But if the display (neither its shells ) is not focus,
> how can the display (or shell)listen to
> the key pressed of the OS ?
> What I want is to set a shortcut key for my application .
> that is , when my applicatin isn't in focus ,maybe running
> in the background,it will react to the some keys of the OS when they are
> pressed.
> so I want to know whether can the display actively detect the key's
> pressed event
> of the system.
> Thanks for your help !
Re: event between the display and the system. [message #453854 is a reply to message #453838] Tue, 12 April 2005 15:34 Go to previous messageGo to next message
bbskill is currently offline bbskillFriend
Messages: 26
Registered: July 2009
Junior Member
I have found out that the relationship between the event loop and the
display by going through the source of swt before.but I just can't find
the low level Windows calls by which the OS posts key events to the
event queue of the display . the information about the low level calls
between swt and the OS is little.
and the display can detect the position of mouse while it is not in
focus by calling a specific low level windows call . but the key event
is not the same as the OS will not help you application hold the key
event ,it just post the event to the display once the key event occurs.
so the display only can wait for the evet posted by OS passively,and it
is hard to check out which key pressed actively.
also Thanks for your opinion .

Steve Northover wrote:
> Background: The system posts events to the event queue for the process. All
> SWT programs include an event loop. The call to Display.readAndDispatch()
> gets the next event from the event queue and dispatches it to the
> appropriate widget. If you don't have an event loop, key and mouse events
> won't get dispatched and your appliacation will appear hung.
>
> If a shell is not in focus, then the key is not going to SWT, so it can't be
> detected. There are low level Windows calls that allow you to see key
> presses no matter which process is running but this is beyond the scope of
> SWT.
>
> "bbskill" <bbkills@tom.com> wrote in message
> news:d36gqm$hji$1@news.eclipse.org...
>
>>can anyone detailly tell me how the system post a event such as keyEvent
>>to a display .
>>I can't find it in the source of swt. can anyone give more information
>>about that?
>>And But if the display (neither its shells ) is not focus,
>>how can the display (or shell)listen to
>>the key pressed of the OS ?
>>What I want is to set a shortcut key for my application .
>>that is , when my applicatin isn't in focus ,maybe running
>>in the background,it will react to the some keys of the OS when they are
>>pressed.
>>so I want to know whether can the display actively detect the key's
>>pressed event
>>of the system.
>>Thanks for your help !
>
>
>
Re: event between the display and the system. [message #453901 is a reply to message #453854] Wed, 13 April 2005 17:17 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You will have to search the MSDN for the API you need. I believe you can
get what you want using Windows Hooks.

"bbskill" <bbkills@tom.com> wrote in message
news:d3ghuk$a8p$1@news.eclipse.org...
> I have found out that the relationship between the event loop and the
> display by going through the source of swt before.but I just can't find
> the low level Windows calls by which the OS posts key events to the
> event queue of the display . the information about the low level calls
> between swt and the OS is little.
> and the display can detect the position of mouse while it is not in
> focus by calling a specific low level windows call . but the key event
> is not the same as the OS will not help you application hold the key
> event ,it just post the event to the display once the key event occurs.
> so the display only can wait for the evet posted by OS passively,and it
> is hard to check out which key pressed actively.
> also Thanks for your opinion .
>
> Steve Northover wrote:
> > Background: The system posts events to the event queue for the process.
All
> > SWT programs include an event loop. The call to
Display.readAndDispatch()
> > gets the next event from the event queue and dispatches it to the
> > appropriate widget. If you don't have an event loop, key and mouse
events
> > won't get dispatched and your appliacation will appear hung.
> >
> > If a shell is not in focus, then the key is not going to SWT, so it
can't be
> > detected. There are low level Windows calls that allow you to see key
> > presses no matter which process is running but this is beyond the scope
of
> > SWT.
> >
> > "bbskill" <bbkills@tom.com> wrote in message
> > news:d36gqm$hji$1@news.eclipse.org...
> >
> >>can anyone detailly tell me how the system post a event such as keyEvent
> >>to a display .
> >>I can't find it in the source of swt. can anyone give more information
> >>about that?
> >>And But if the display (neither its shells ) is not focus,
> >>how can the display (or shell)listen to
> >>the key pressed of the OS ?
> >>What I want is to set a shortcut key for my application .
> >>that is , when my applicatin isn't in focus ,maybe running
> >>in the background,it will react to the some keys of the OS when they are
> >>pressed.
> >>so I want to know whether can the display actively detect the key's
> >>pressed event
> >>of the system.
> >>Thanks for your help !
> >
> >
> >
Re: event between the display and the system. [message #453932 is a reply to message #453901] Thu, 14 April 2005 11:07 Go to previous message
bbskill is currently offline bbskillFriend
Messages: 26
Registered: July 2009
Junior Member
en,I also thought about it before . but I usually work on Linux.
and it has to use JNI,I don't want that my application depends on some
platform.I just want to see whether the SWT solved this problem .

Steve Northover wrote:
> You will have to search the MSDN for the API you need. I believe you can
> get what you want using Windows Hooks.
>
> "bbskill" <bbkills@tom.com> wrote in message
> news:d3ghuk$a8p$1@news.eclipse.org...
>
>>I have found out that the relationship between the event loop and the
>>display by going through the source of swt before.but I just can't find
>>the low level Windows calls by which the OS posts key events to the
>>event queue of the display . the information about the low level calls
>>between swt and the OS is little.
>>and the display can detect the position of mouse while it is not in
>>focus by calling a specific low level windows call . but the key event
>>is not the same as the OS will not help you application hold the key
>>event ,it just post the event to the display once the key event occurs.
>>so the display only can wait for the evet posted by OS passively,and it
>>is hard to check out which key pressed actively.
>>also Thanks for your opinion .
>>
>>Steve Northover wrote:
>>
>>>Background: The system posts events to the event queue for the process.
>
> All
>
>>>SWT programs include an event loop. The call to
>
> Display.readAndDispatch()
>
>>>gets the next event from the event queue and dispatches it to the
>>>appropriate widget. If you don't have an event loop, key and mouse
>
> events
>
>>>won't get dispatched and your appliacation will appear hung.
>>>
>>>If a shell is not in focus, then the key is not going to SWT, so it
>
> can't be
>
>>>detected. There are low level Windows calls that allow you to see key
>>>presses no matter which process is running but this is beyond the scope
>
> of
>
>>>SWT.
>>>
>>>"bbskill" <bbkills@tom.com> wrote in message
>>>news:d36gqm$hji$1@news.eclipse.org...
>>>
>>>
>>>>can anyone detailly tell me how the system post a event such as keyEvent
>>>>to a display .
>>>>I can't find it in the source of swt. can anyone give more information
>>>>about that?
>>>>And But if the display (neither its shells ) is not focus,
>>>>how can the display (or shell)listen to
>>>>the key pressed of the OS ?
>>>>What I want is to set a shortcut key for my application .
>>>>that is , when my applicatin isn't in focus ,maybe running
>>>>in the background,it will react to the some keys of the OS when they are
>>>>pressed.
>>>>so I want to know whether can the display actively detect the key's
>>>>pressed event
>>>>of the system.
>>>>Thanks for your help !
>>>
>>>
>>>
>
>
Previous Topic:Double click to set breakpoint doesn't work ???
Next Topic:Color Combobox - how to do ?
Goto Forum:
  


Current Time: Fri Feb 26 04:22:36 GMT 2021

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

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

Back to the top