AdvancedHMI Software

General Category => Support Questions => Topic started by: Phrog30 on July 25, 2017, 03:28:16 PM

Title: Prevent touch
Post by: Phrog30 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
Title: Re: Prevent touch
Post by: Archie on July 25, 2017, 03:36:55 PM
Another option is to use the ScreenCleanButton which will clear itself after the ScreenCleanTimeInterval
Title: Re: Prevent touch
Post by: Phrog30 on July 25, 2017, 03:52:32 PM
I don't like the timed screens.  A button hold is much better.  So, no ideas? :)
Title: Re: Prevent touch
Post by: Archie 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
Title: Re: Prevent touch
Post by: Phrog30 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.