Send message question without diturbing the user

Post your Gambas programming questions here.
Post Reply
monteiro
Posts: 10
Joined: Monday 26th September 2016 11:40am

Send message question without diturbing the user

Post by monteiro »

Hi, guys.

I made a main form and and some other forms, these ones always as modals.

My intention is setup a timer on Main form and, at random times, show a little modal form to the user , asking for some typing.
But I would like to not disturb the user if he/she is typing or moving the mouse.

Could I check this from the main form and not initiate the messaqe question form if the user is occupied?

Thanks for any ideas.
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Send message question without diturbing the user

Post by BruceSteers »

probably easiest way is to use xprintidle but it won't work on wayland.

Shell "xprintidle" To sResult

If Val(RTrim(sResult)) > 3000 then 
  Print "idle more than 3 seconds"
Endif



The gambas way..?? I do not know about Keyboard but it should be easy to test for Mouse movement...

Dim MouseX As Integer  = Mouse.ScreenX, MouseY As Integer = Mouse.ScreenY ' Note Mouse Pos
Wait 1  ' wait one second

If MouseX <> Mouse.ScreenX Or If MouseY<> Mouse.ScreenY Then ' See if mouse has moved
Print "Mouse has moved"
Endif
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1127
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Send message question without diturbing the user

Post by cogier »

Well, here is my effort regarding this one, I hope it helps. This has not been tested on Wayland.
Attention_Tester-0.0.1.tar.gz
(14.42 KiB) Downloaded 140 times
monteiro
Posts: 10
Joined: Monday 26th September 2016 11:40am

Re: Send message question without diturbing the user

Post by monteiro »

Thank you.

I will test the ideas. Wayland is really a concern, as I don't know if the users will be using it;
Post Reply