Post Reply 
MOUSE command CLICK type
03-04-2018, 11:08 AM
Post: #16
RE: MOUSE command CLICK type
Bonjour

Ce poste est très intéressant, personnellement en utilisant WAIT(-1) dans un programme pour détecté soit un click soit un glisser je me suis retrouvé confronté à un problème.
L'événement glisser a tendance à être détecté plusieurs fois, voici un peu l'architecture de mon programme:

Hello

This post is very interesting, personally using WAIT (-1) in a program to detect either a click or a drag I found myself facing a problem.
The drag event tends to be detected several times, here is a little architecture of my program:

Code:

For t FROM 1 TO 2 DO  // 2 tours autorisés  2 authorized tours
 af_tour  // routine d'affichage display routine
 REPEAT
   d:=ch_de  // appel routine de gestion écran avec WAIT(-1)  call screen management routine with WAIT (-1)
   CASE 
     if 0<d<6  THEN......
     if d==6 THEN .......
     if d==8 Then f:=1 END; // action glisser qui fait sortir de la boucle REPEAT drag action that gets out of the REPEAT loop
  UNTIL f
  .......
  .......
  .......
END;//for
 
ch_de
local ev,n
BEGIN
 while n==0 DO
  ev:=WAIT(-1);
  if TYPE(ev)==6 THEN
   if ev(1)==0 then x:=ev(2) end;
   if ev(1)==2 then  n:=IP((x-7)/40) end;
   if ev(1)==1 and ev(3)>32 then n:=8 end;
 END;
end;//while
 n;
END;
Le problème est que pour un seul glisser les 2 tours de boucle For t s'exécutent alors que 1 seul devrait le faire.
le click fonctionne très bien.
Le remède que j'ai trouvé insérer
Code:
WHILE MOUSE(4)<>-1 END;
avant
Code:
n:=8
dans ch_de qui je pense doit vider le buffer de WAIT(-1).

On voit d'ailleurs bien un temps de latence plus ou moins long selon l'amplitude du glisser.
Question peut-on vider le buffer de WAIT(-1) instantanément avec une instruction une fois nos événements acquis ?


The problem is that for a single drag the 2 rounds of loop For t execute while only 1 should do it.
the click works very well.
The remedy I found insert [code] WHILE MOUSE (4) <> - 1 END; [/ code] before [code] n: = 8 [/ code] in ch_de which I think must clear the buffer of WAIT ( -1).

We also see a latency time more or less long depending on the amplitude of the slide.
Question can we clear the buffer of WAIT (-1) instantly with an instruction once our events acquired?

Sorry for my english
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
MOUSE command CLICK type - Giancarlo - 01-25-2018, 09:59 PM
RE: MOUSE command CLICK type - Carlos295pz - 01-25-2018, 10:37 PM
RE: MOUSE command CLICK type - Giancarlo - 01-25-2018, 11:40 PM
RE: MOUSE command CLICK type - Carlos295pz - 01-26-2018, 12:30 AM
RE: MOUSE command CLICK type - Giancarlo - 01-26-2018, 06:23 PM
RE: MOUSE command CLICK type - Carlos295pz - 01-26-2018, 07:34 PM
RE: MOUSE command CLICK type - Giancarlo - 01-27-2018, 04:22 PM
RE: MOUSE command CLICK type - Carlos295pz - 01-27-2018, 04:32 PM
RE: MOUSE command CLICK type - Carlos295pz - 01-26-2018, 07:52 PM
RE: MOUSE command CLICK type - Giancarlo - 01-27-2018, 06:35 PM
RE: MOUSE command CLICK type - Giancarlo - 01-29-2018, 08:16 PM
RE: MOUSE command CLICK type - Giancarlo - 02-24-2018, 10:08 PM
RE: MOUSE command CLICK type - Tyann - 03-04-2018 11:08 AM
RE: MOUSE command CLICK type - Carlos295pz - 03-04-2018, 11:46 AM
RE: MOUSE command CLICK type - Tyann - 03-04-2018, 05:11 PM
RE: MOUSE command CLICK type - Carlos295pz - 03-04-2018, 07:50 PM
RE: MOUSE command CLICK type - Tyann - 03-06-2018, 05:58 AM
RE: MOUSE command CLICK type - Giancarlo - 03-04-2018, 09:11 PM
RE: MOUSE command CLICK type - Carlos295pz - 03-04-2018, 10:20 PM



User(s) browsing this thread: 1 Guest(s)