Author Topic: Prevent touch  (Read 558 times)

Phrog30

  • Guest
Prevent touch
« on: July 25, 2017, 03:28:16 PM »
I have a clean screen that has a single button that you must hold for "x" time, then the form closes.  The form is on top of the main display/parent.  If there is a button or some other control directly beneath this button on the clean screen, once the clean screen is closed and mouse released, that control event will fire.  Any nice/easy way to prevent this?

James

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Prevent touch
« Reply #1 on: July 25, 2017, 03:36:55 PM »
Another option is to use the ScreenCleanButton which will clear itself after the ScreenCleanTimeInterval

Phrog30

  • Guest
Re: Prevent touch
« Reply #2 on: July 25, 2017, 03:52:32 PM »
I don't like the timed screens.  A button hold is much better.  So, no ideas? :)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Prevent touch
« Reply #3 on: July 25, 2017, 04:16:39 PM »
What about capture time on MouseDown event, then on MouseUp check elapsed time and close if exceeds hold time.
Code: [Select]
    Private MouseDownTime As Date
In MouseDownEvent Handler
Code: [Select]
        MouseDownTime = Now

In MouseUpEvent handler:
Code: [Select]
Dim LapsedSeconds As Integer = DateAndTime.DateDiff(DateInterval.Second, MouseDownTime, Now)
if LapsedSeconds>3 then
  '* Close the form
End if
« Last Edit: July 25, 2017, 07:04:57 PM by Archie »

Phrog30

  • Guest
Re: Prevent touch
« Reply #4 on: July 25, 2017, 08:43:02 PM »
I just added code that required the user to release mouse before exiting.  I didn't think I would like how it worked, but it's actually not bad.  Thanks for the help.