<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Mouse Events</title><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/6838d84e37/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/CODESYS-V2/thread/6838d84e37/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/CODESYS-V2/thread/6838d84e37/</id><updated>2020-02-27T19:03:49.754000Z</updated><subtitle>Recent posts to Mouse Events</subtitle><entry><title>Mouse Events</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/6838d84e37/?limit=25#2ff5" rel="alternate"/><published>2020-02-27T19:03:49.754000Z</published><updated>2020-02-27T19:03:49.754000Z</updated><author><name>shooter</name><uri>https://forge.codesys.com/u/shooter/</uri></author><id>https://forge.codesys.comde468f06d5ba01b9bb4c0ac872348bfd274416cd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The mouse will be very slow, and not all events will be seen by the program, however this is one of the better solutions.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Mouse Events</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/6838d84e37/?limit=25#7326" rel="alternate"/><published>2020-02-27T19:03:48.553000Z</published><updated>2020-02-27T19:03:48.553000Z</updated><author><name>egret</name><uri>https://forge.codesys.com/u/egret/</uri></author><id>https://forge.codesys.comd921a9fbc9ca7f4df9e5edcf4714c07888e4c1a5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I've now got this working. Just in case anybody needs to do this in the future here's an example of how to implement mouse events.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;PROGRAM&lt;/span&gt; &lt;span class="nt"&gt;MAIN&lt;/span&gt;
&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="nt"&gt;leftMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;MOUSEEVENT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;rightMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;MOUSEEVENT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;mouseMoveEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;MOUSEEVENT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;span class="nt"&gt;GetLastLeftMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;leftMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;span class="nt"&gt;GetLastRightMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;rightMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;span class="nt"&gt;GetLastMouseMoveEvent&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;ADR&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;mouseMoveEvent&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;span class="nt"&gt;MouseShowCursor&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>Mouse Events</title><link href="https://forge.codesys.com/forge/talk/Codesys%2520V2.3/thread/6838d84e37/?limit=25#fac9" rel="alternate"/><published>2020-02-27T19:03:45.159000Z</published><updated>2020-02-27T19:03:45.159000Z</updated><author><name>egret</name><uri>https://forge.codesys.com/u/egret/</uri></author><id>https://forge.codesys.com83297ef57b548567511328224d75c0343c3ede92</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I would like to use mouse events in my Twincat project. To do this I have included the TcMouseEvents.lib library in my project.&lt;/p&gt;
&lt;p&gt;This library has the following functions:&lt;br/&gt;
GetLastLeftMouseDownEvent&lt;br/&gt;
GetLastLeftMouseUpEvent&lt;br/&gt;
GetLastMouseMoveEvent&lt;br/&gt;
GetLastRightMouseDownEvent&lt;br/&gt;
GetLastRightMouseUpEvent&lt;br/&gt;
MouseShowCursor&lt;br/&gt;
SetWindowToForeground&lt;br/&gt;
UseSIP&lt;/p&gt;
&lt;p&gt;My target is a WinCE based panel with an ARM processor.&lt;/p&gt;
&lt;p&gt;If I try to use any of the functions that contain a POINTER TO MOUSEEVENT then my project does not run. It will compile and download but when the applications tries to start I get the following error:&lt;/p&gt;
&lt;p&gt;Communication Error (# 0): Performed Logout"&lt;/p&gt;
&lt;p&gt;Examples of functions that use a POINTER TO MOUSEEVENT include:&lt;/p&gt;
&lt;p&gt;GetLastLeftMouseDownEvent&lt;br/&gt;
GetLastLeftMouseUpEvent&lt;br/&gt;
GetLastMouseMoveEvent&lt;/p&gt;
&lt;p&gt;On the other hand if I use the MouseShowCursor function (which does not include a POINTER TO MOUSEEVENT) my project will run as expected.&lt;/p&gt;
&lt;p&gt;From this it seems that the library is linking ok but I'm having trouble with functions that use a "POINTER TO MOUSEEVENT"&lt;/p&gt;
&lt;p&gt;A very simple project looks like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;PROGRAM&lt;/span&gt; &lt;span class="nt"&gt;MAIN&lt;/span&gt;
&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="nt"&gt;pLeftMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;POINTER&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;MOUSEEVENT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;pRightMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;POINTER&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;MOUSEEVENT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;pMouseMoveEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;POINTER&lt;/span&gt; &lt;span class="nt"&gt;TO&lt;/span&gt; &lt;span class="nt"&gt;MOUSEEVENT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;bGetLastLeftMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;bGetLastRightMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;bGetLastMouseMoveEvent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;BOOL&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;
&lt;span class="nt"&gt;bGetLastLeftMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;GetLastLeftMouseDownEv&lt;/span&gt; &lt;span class="nt"&gt;ent&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;pLeftMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;bGetLastRightMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;GetLastRightMouseDown&lt;/span&gt; &lt;span class="nt"&gt;Event&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;pRightMouseDownEvent&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;bGetLastMouseMoveEvent&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;GetLastMouseMoveEvent&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;pMou&lt;/span&gt; &lt;span class="nt"&gt;seMoveEvent&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;MouseShowCursor&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;FALSE&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I've included the following libs:&lt;br/&gt;
TcMouseEvents.lib&lt;br/&gt;
STANDARD.LIB&lt;br/&gt;
SysLibVisu.lib&lt;br/&gt;
SysLibTargetVisu.lib&lt;/p&gt;
&lt;p&gt;Has anybody been able to get mouse events to work on a CE target? &lt;/p&gt;
&lt;p&gt;The CoDeSys manual says the following but I'm not sure how to implement it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
The mouse handling also has to meet certain special requirements. As the visualisation code can not be executed often, mouse actions have to be saved so that later on, during the next run through the corresponding code area, they can be processed. For this purpose an array should be occupied which is able to save an even number of mouse-click actions. The same applies for all mouse movements after the activation of a tap (toggle FALSE) button, they too have to be saved.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Any help with this would be much appreaciated.&lt;/p&gt;
&lt;p&gt;Regards, Ben&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>