LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting a button release with a touch screen

I'm trying to convert my hardware command panel of a machine into a virtual one with a touch screen panel. I'm using LW2017 and W10PRO.

I need to send  1 when the operator press and keep pressed the button, and 0 as soon as he release the button.

The only event i detect with my button callback and with my panel callback as well is EVENT_MOUSE_POINTER_MOVE. So, I'm using this to set to 1.

Then, to set safely to 0 I'm using a OR with:

EVENT_LEFT_CLICK_UP,

EVENT_RIGHT_CLICK_UP,

EVENT_LOST_FOCUS,

EVENT_CLOSE,

EVENT_DISCARD

in both callbacks, control and panel.

My problem is: depending how the operator release the button, sometimes the events CLICK UP (LEFT if the touch is short, RIGHT if the touch is long) did'nt declare at all, and the last event is again EVENT_MOUSE_POINTER_MOVE, so my code send again 1 and it remains forever.

There is some way to detect no touching at all on a touch screen?

EnableExtendedMouseEvents() can be helpful, or it is obsolete? the documentation is not clear about.

 

Some Suggestions? thankYou in advance.

 

0 Kudos
Message 1 of 7
(3,040 Views)

Hello,

 

Since the Touchscreen Toolkit for LabVIEW is provided by Aledyne Engineering I suggest to you contact them:

 

Email: support@aledyne.com 
Web: aledyne.com/contactus

 

Best regards,

Andres 

Andrés Alvarez
Staff Technical Support Engineer
CLD, CTD, CTA
0 Kudos
Message 2 of 7
(3,000 Views)

Andres, since this is the LabWindows/CVI board and the user is programming in CVI, your suggestion is probably out of target Smiley Wink

 

You NI folks very often forget that there isn't a one-to-one correspondence between "programming" and "LabVIEW" Smiley LOL



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 7
(2,997 Views)

Roberto is right. I'm searching a way  -on CVI- to detect "nobody is touching the screen right now" status, and not transition events.

For the moment I solve the situation like this:

SET:

- I send command to 1 only with EVENT_LEFT_CLICK arrives to the button ( only in the control callback) . This way ( not using anymore EVENT_MOUSE_POINTER_MOVE to set to 1) made the system less responsive, You need to press the button in a convinced way, to have the command You want. But is ok. 

- I disabled the automatic right click  timer of the touchscreen driver, so the operator can keep pressing and the command will be always 1. (before, when the timer elaps, the command went to 0 even if you keep pressing).

RESET:

- I send command to 0 with   EVENT_LEFT_CLICK_UP or EVENT_RIGHT_CLICK_UP in the callbacks of the button AND the panel.

- I send as well the command to 0 when the panel receive one EVENT_MOUSE_POINTER_MOVE that was not received by the the control. In this way, I try to detect the user is abandon the button by dragging out his gloved finger. But this practice is not 100% effective, and if you do it fastly sometimes the bir remains to 1. so for the moment I program a timeout in the PLC side, setting to 0 all the commands after 5 seconds. Tis is not elegant and not comfortable for the operator, because he need to insist every 5 seconds when the movement stops.

 

ThankYou for any suggestion.

0 Kudos
Message 4 of 7
(2,992 Views)

I don't have a touch screen to test this out myself, but you could try registering for the WB_GESTURE message and checking for GID_END. You'll need to use InstallWinMsgCallback.

 

Edit: I'm not sure how this would work with multi-touch... If each touch sends its own message, this would be an invalid approach.

 

Hope this helps!

Trent

 

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 5 of 7
(2,979 Views)

ThankYou for Your reply, WireWeaver, and sorry for the delay.

I'm trying to test Your suggestion, but I'm having problems to use the WM_GESTURE message, even if I have

#include <windows.h>

in my code, the compiler gives me the "UNDECLARED IDENTIFIER" error. 

windows.h includes winuser.h, but WM_GESTURE is not defined there.

I have winuser.h in the directory

C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1

what is missing? is this the last sdk?  thankYou in advance.

0 Kudos
Message 6 of 7
(2,918 Views)

Sorry, I solve the include issue, i wrote WD_GESTURE instead WM_GESTURE installing the callback for the windows messages.... now I can compile but no callbacks arrives, because my buttons are in a child panel..... need to spend a little more of time with this.... as soon as I can I will report news...

0 Kudos
Message 7 of 7
(2,914 Views)