Post Reply 
CLICK LONG
10-11-2015, 11:50 AM
Post: #1
CLICK LONG
BONJOUR
Depuis le début, je n'arrive pas à obtenir le click long avec MOUSE.
Le code suivant ne s'arrête jamais sauf avec ON :

HELLO
Since the beginning , I did not get along with click MOUSE.
The following code never stops except with ON:

Code:

EXPORT TEST()
BEGIN
 REPEAT
 UNTIL MOUSE(4)==5;
END;
???

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-12-2015, 07:24 AM
Post: #2
RE: CLICK LONG
Hello,

MOUSE reports the 'instantaneous', state of the mouse (like KEYISDOWN), as a result, it is very unlikely that you will ever get a transient event such as (LONG) CLICK.

To get these event, use WAIT(-1)

EXPORT TEST()
BEGIN
L1:={};
REPEAT
local s:= WAIT(-1);
L1(0):= s;
rect_p;
TEXTOUT_P(s, 0, 0);
UNTIL 0;
END;

Will return an event of type 7 (long click)

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-12-2015, 09:30 AM
Post: #3
RE: CLICK LONG
Bonjour
Je viens de tester, cela fonctionne bien, je n'utilise pas
beaucoup WAIT(-1), je préfère la syntaxe MOUSE(x) plutôt que
d'utiliser des listes, mais je vais me forcer un peu.

Merci Cyrille pour l'information.

Hello
I just tested , it works well , I do not use
lot WAIT ( -1) , I prefer the syntax MOUSE ( x ) rather than
to use lists , but I'll force myself a little.

Cyrille thank you for the information.

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-12-2015, 03:07 PM
Post: #4
RE: CLICK LONG
Hello,

The advantage of WAIT(-1) is that the device goes into lower power mode while waiting, so there is less battery consumption.

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-15-2015, 05:40 PM
Post: #5
RE: CLICK LONG
It is nice to see two French people making the effort to communicate in English for the benefit of us all!

(Malgré que je suis espagnol, j'ai beaucoup travaillé en France et j'ai toujours un petit appartement au 66 pour les week-ends)
Find all posts by this user
Quote this message in a reply
10-20-2015, 09:56 PM (This post was last modified: 10-20-2015 10:03 PM by Tyann.)
Post: #6
RE: CLICK LONG
Bonjour
Après quelques essais, voici une boucle qui détecte : un click simple, un click long ou un déplacement.
X et Y = coordonnées de départ
V et W = coordonnées de fin
et E le type d'événement.

Hello
After some tests , here is a loop that senses : a simple click , long click or displacement .
X and Y = starting coordinates
V and W = End coordinates
E the type of event .

Code:

EXPORT TEST()
BEGIN
A:=1;E:=0;
WHILE A DO
 L1:=WAIT(-1);
 CASE
  IF L1(1)==0 THEN X:=L1(2); Y:=L1(3); END;
  IF L1(1)==1 THEN V:=L1(2); W:=L1(3); E:=1; END;
  IF L1(1)==2 AND E==1 OR L1(1)==3 OR L1(1)==7 THEN
    A:=0; E:=L1(1);
   END;
 END;
END;
{X,Y,V,W,E};
END;

Cela vous semble t-il correct ?
Des remarques ?
Merci d'avance.

This will seem right?
Remarks ?
Thank you in advance.

Sorry for my english
Find all posts by this user
Quote this message in a reply
10-21-2015, 06:27 AM
Post: #7
RE: CLICK LONG
Hello,

I do not think that L1:= Wait(-1); is a good idea.
The reason for it is that Wait will also return on a key press, which is a number in the 1 to 50 range. so you will not be able to detect if it was a mouse event or a key press.
I suggest using a local variable and testing the type
Local Event= Wait(-1);
if type(Event)=6 and size(Event)>=1then
case
if Event(1).....
end;
end;

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
10-21-2015, 11:23 AM
Post: #8
RE: CLICK LONG
Bonjour
C'est une excellente remarque.
Merci Cyrille.

Hello
That's an excellent point .
Cyrille thank you .

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




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