Inactivity on a View

Is there a way to check for complete inactivity on a view?

My example is that I have a view that is basically an htmlviewer. I need to timeout that view and go back to a login page if there is no activity on that htmviewer after a time period I set.

I have put a timer on the page that would check a variable I set for activity to be true. Just did not know what my options from the OS were to tell me if there had been any activity.

If it’s your html you could use a meta refresh tag to set a timeout. It’s not really the best way to handle something like security, but hey it works.

Sorry for confusion. The timeout within the htmlviewer will come from the server I am connecting too. What I am actually wanting is a check for activity on the IOSview that contains the htmlviewer. In case someone walks off leaving it on the page that is displayed I want the app to go back to its login page. So I am wanting something to check for any activity at all on the IOS device.

I might be able to hack something for this together with declares. It will probably be Thursday before I have the time though since it is fairly involved for this.

If you don’t mind me asking: since the server will time out, why do you have to do anything?

Because this is an IOS app that happens to show some stuff from a webserver if the user chooses. If that user walks off I want the app to return to the main IOS app page.

Thanks Jason! No rush, whenever you get a chance. It would be greatly appreciated. Another feature I hope would eventually get incorporated into the xojo framework.

Unfortunately they don’t seem to want to allow generalized subclassing of the app delegate which is what would be required (its made a bunch of other features either difficult to implement or impossible in Xojo) so I doubt this will be possible in straight Xojo code for a while (if ever).

Since interaction with an iOS app is essentially based on gestures (scroll as well as keyboard, swipe, etc.), it should be possible to get that event with the gesture handler. UIKit may already do that.

Then pushing back a single timer each time it happens would ensure it does not fire, unless no gesture is done.

[quote=258962:@Michel Bujardet]Since interaction with an iOS app is essentially based on gestures (scroll as well as keyboard, swipe, etc.), it should be possible to get that event with the gesture handler. UIKit may already do that.

Then pushing back a single timer each time it happens would ensure it does not fire, unless no gesture is done.[/quote]
That is what I will do. The best way is to do this at the app level otherwise gesture events on buttons and other views won’t work properly.

Any luck with coming with a way to do this?

Without declares you will need to place code in every control.

  • Drag a timer over the view
  • Make it’s period 60000 // One minute
  • Make its mode off
  • Place a canvas over the back of the view
  • Add a handler for PointerDown and Pointerdrag ; Pointerdrag captures swipes.
    Code in both events :

Timer1.Mode = Timer.Modes.Off Timer1.Mode = Timer.Modes.Single

Put the same code in the Textchange event of TextFields, TextArea, button Action

Add the Action event to the timer. Place in there the code that takes the user back to the login view.

Every time the code executes, it resets the timer so it does fire as long as it has not reached its period. If there is no user action, the Action event of the timer fires at the end of the period.

I haven’t had time to do this yet, sorry. Depending on how my evening goes I will either finish it tonight or tomorrow afternoon.

No rush Jason! You already helped me so much! Just when you have a chance.

I’m experiencing a weird crash with this right now so I’m going to need to look into it some more.

Sorry its giving you trouble. Take as much time as you need Appreciate very much your assistance

… wb ?

View is primarily an htmlviewer. Have no such events to be able to add timer to so your example unfortunately would not work in my situation. Thanks though for an example I can use on other pages.

Jason King at one point had worked on enabling ExecuteJavaScript plus some events. It would not take much to use a JavaScript timer and CancelLoad to detect activity from Xojo.
https://forum.xojo.com/19271-ios-what-we-want-roadmap/20

Its a real pity that Xojo iOS be so dismally impaired as compared to desktop. Yeach.

I hear you Michel. Sounds as if 2016R2 is going to get some IOS work. Meanwhile if there is a way to do what I need, I will gladly implement it, even if it requires declares.