Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Knowing if my app is being used
Knowing if my app is being used [message #459028] Thu, 28 July 2005 21:06 Go to next message
Mike Higginbotham is currently offline Mike HigginbothamFriend
Messages: 22
Registered: July 2009
Junior Member
I have an app which needs to automatically log a user out after a period
of inactivity. The timer stuff is easy enough. The problem is how do I
know the user is actively using my app? I am hoping to not have to hook
into every widget to know they typed in it, or selected it, or clicked
it, etc.

Any ideas?

Thanks,
Mike Higginbotham
Re: Knowing if my app is being used [message #459035 is a reply to message #459028] Fri, 29 July 2005 13:07 Go to previous messageGo to next message
Stefan Zeiger is currently offline Stefan ZeigerFriend
Messages: 102
Registered: July 2009
Senior Member
Mike Higginbotham wrote:

> I have an app which needs to automatically log a user out after a period
> of inactivity. The timer stuff is easy enough. The problem is how do I
> know the user is actively using my app? I am hoping to not have to hook
> into every widget to know they typed in it, or selected it, or clicked
> it, etc.

You could add an event filter to the display (Display.addFilter()) to
listen for all MouseDown and KeyPressed events that occur in your
application.

--
Stefan Zeiger - Developer of Novocode Application Framework
Build SWT-based MVC GUIs via XML: http://www.novocode.com/naf/
Re: Knowing if my app is being used [message #459061 is a reply to message #459035] Fri, 29 July 2005 17:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: seanmc42.hotmail.com

Well, presumably the widgets all hook into listeners, which call your
apps code - why not trigger off YOUR code?

Stefan Zeiger wrote:
> Mike Higginbotham wrote:
>
>> I have an app which needs to automatically log a user out after a
>> period of inactivity. The timer stuff is easy enough. The problem is
>> how do I know the user is actively using my app? I am hoping to not
>> have to hook into every widget to know they typed in it, or selected
>> it, or clicked it, etc.
>
>
> You could add an event filter to the display (Display.addFilter()) to
> listen for all MouseDown and KeyPressed events that occur in your
> application.
>
Re: Knowing if my app is being used [message #459066 is a reply to message #459035] Fri, 29 July 2005 21:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

Yes, but beware of timing users out during long-running operations. They
won't be happy, especially if the "log out" triggers strange failure
modes in the operations.

Bob

Stefan Zeiger wrote:
> Mike Higginbotham wrote:
>
>> I have an app which needs to automatically log a user out after a
>> period of inactivity. The timer stuff is easy enough. The problem is
>> how do I know the user is actively using my app? I am hoping to not
>> have to hook into every widget to know they typed in it, or selected
>> it, or clicked it, etc.
>
>
> You could add an event filter to the display (Display.addFilter()) to
> listen for all MouseDown and KeyPressed events that occur in your
> application.
>
Re: Knowing if my app is being used [message #459091 is a reply to message #459035] Mon, 01 August 2005 19:20 Go to previous messageGo to next message
Mike Higginbotham is currently offline Mike HigginbothamFriend
Messages: 22
Registered: July 2009
Junior Member
Thanks, Stefan! This is what I was looking for. I tried addListener but
for some reason totally missed addFilter. Perfect.

- Mike

Stefan Zeiger wrote:
> Mike Higginbotham wrote:
>
>> I have an app which needs to automatically log a user out after a
>> period of inactivity. The timer stuff is easy enough. The problem is
>> how do I know the user is actively using my app? I am hoping to not
>> have to hook into every widget to know they typed in it, or selected
>> it, or clicked it, etc.
>
>
> You could add an event filter to the display (Display.addFilter()) to
> listen for all MouseDown and KeyPressed events that occur in your
> application.
>
Re: Knowing if my app is being used [message #459092 is a reply to message #459061] Mon, 01 August 2005 19:23 Go to previous messageGo to next message
Mike Higginbotham is currently offline Mike HigginbothamFriend
Messages: 22
Registered: July 2009
Junior Member
The problem is that there are a number of classes/views which I have to
monitor. I could do as you suggest but any new views would have to
remember to "play nice". By using addFilter, I can keep all the timeout
code in one place and new views do not have to worry about it.

- Mike


Frank Castle wrote:
> Well, presumably the widgets all hook into listeners, which call your
> apps code - why not trigger off YOUR code?
>
> Stefan Zeiger wrote:
>
>> Mike Higginbotham wrote:
>>
>>> I have an app which needs to automatically log a user out after a
>>> period of inactivity. The timer stuff is easy enough. The problem is
>>> how do I know the user is actively using my app? I am hoping to not
>>> have to hook into every widget to know they typed in it, or selected
>>> it, or clicked it, etc.
>>
>>
>>
>> You could add an event filter to the display (Display.addFilter()) to
>> listen for all MouseDown and KeyPressed events that occur in your
>> application.
>>
Re: Knowing if my app is being used [message #459093 is a reply to message #459066] Mon, 01 August 2005 19:25 Go to previous messageGo to next message
Mike Higginbotham is currently offline Mike HigginbothamFriend
Messages: 22
Registered: July 2009
Junior Member
Luckily, I do not have any long running operations. The timeout is 15
minutes of inactivity and is reset whenever they click the mouse
(SWT.MouseUp) or press a key (SWT.KeyUp) in the application.

- Mike


Bob Foster wrote:
> Yes, but beware of timing users out during long-running operations. They
> won't be happy, especially if the "log out" triggers strange failure
> modes in the operations.
>
> Bob
>
> Stefan Zeiger wrote:
>
>> Mike Higginbotham wrote:
>>
>>> I have an app which needs to automatically log a user out after a
>>> period of inactivity. The timer stuff is easy enough. The problem is
>>> how do I know the user is actively using my app? I am hoping to not
>>> have to hook into every widget to know they typed in it, or selected
>>> it, or clicked it, etc.
>>
>>
>>
>> You could add an event filter to the display (Display.addFilter()) to
>> listen for all MouseDown and KeyPressed events that occur in your
>> application.
>>
Re: Knowing if my app is being used [message #459094 is a reply to message #459091] Mon, 01 August 2005 19:46 Go to previous message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
Look at:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=37061

It has a code snippet for exactly what you need.

-Chris

"Mike Higginbotham" <higginmi@us.ibm.com> wrote in message
news:dclsmd$jph$1@news.eclipse.org...
> Thanks, Stefan! This is what I was looking for. I tried addListener but
> for some reason totally missed addFilter. Perfect.
>
> - Mike
>
> Stefan Zeiger wrote:
> > Mike Higginbotham wrote:
> >
> >> I have an app which needs to automatically log a user out after a
> >> period of inactivity. The timer stuff is easy enough. The problem is
> >> how do I know the user is actively using my app? I am hoping to not
> >> have to hook into every widget to know they typed in it, or selected
> >> it, or clicked it, etc.
> >
> >
> > You could add an event filter to the display (Display.addFilter()) to
> > listen for all MouseDown and KeyPressed events that occur in your
> > application.
> >
Previous Topic:Hourglass!
Next Topic:TableViewer: Images in rows always have same size as image in column header
Goto Forum:
  


Current Time: Wed Apr 24 20:45:42 GMT 2024

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

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

Back to the top