How to use MOUSE
|
02-24-2020, 10:46 PM
Post: #1
|
|||
|
|||
How to use MOUSE
Hi all,
For user input on the screen there is the command MOUSE. According to the description, this command provides two lists with the following content: {#x, #y, #originalx, #originaly, #type}. To see what the actual output of this command looks like, I have created a small program, see the code below. The output is as follows: {{#125:-16h;#EF:-16h;#125:-16h;#EF:-16h;#1:16h};{}}. With repeated program execution, a number of values change, probably depending on where you press the screen. If I compare the description with the output, I notice that each of the fields in the list corresponds to 2 values. I would like to know which of these values I must use to be able to operate a program from the screen. I cannot find a good description of this command in the manual, as well as an example in which this is used. I would like to have some more documentation of this command, as well as some examples in which this is used. Can someone help me with that? Thanks in advance! Sincerely, Karel. Code:
I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
02-25-2020, 12:05 AM
Post: #2
|
|||
|
|||
RE: How to use MOUSE
In my experience the WAIT(-1) command is more reliable and preferred. Returns a real for key press (or -1 after 1 minute timeout), or a list for mouse events. You can use WAIT(-1) inside a REPEAT clause until you have the type of result you want. While paused, the command puts the calculator into a lower power state as well, IIRC. Here's an example:
Code: REPEAT What is your intended use case? |
|||
02-25-2020, 03:07 AM
Post: #3
|
|||
|
|||
RE: How to use MOUSE
Dear Mr. Wall,
Thank you very much for your response! I don't have a specific application at the moment, but I do work a lot with menu keys in my programs, and in the future also with screen touches. I also often work with menu keys on the HP-50g, so it won't be any different on the HP Prime. The Prime reports that there is an error in line 2 in your program. Maybe you can check your program for errors. I will experiment with this program as soon as the errors are removed. Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
02-25-2020, 04:05 AM
Post: #4
|
|||
|
|||
RE: How to use MOUSE
The code I posted was just a subset of an idea, the 'Error' is due to the variable MK_in not being declared.
Here's a slightly more developed example that will run. NOTE it is intentionally designed to handle only 'click' events from the touch screen, event type 3. I have found this to be very suitable for GUI applications, with CASE structures to handle any and all possible inputs from the screen or keyboard. Code: #pragma mode( separator(.,;) integer(h32) ) |
|||
02-25-2020, 06:46 AM
Post: #5
|
|||
|
|||
RE: How to use MOUSE
Hello,
MOUSE is for "dynamic" UI detection. It shows/represent the real time mouse information. In comparison, WAIT(-1) returns mouse/keyboard information from the event queue, which means that if you are slow in getting the data, you can get old data. The use case for these 2 functions is different. WAIT is useful for a UI type program with buttons and the like where you DO want to respond to user interaction, even if it is "late". MOUSE (and ISKEYDOWN) return the realtime status and is best suited for realtime applications like games and the like where you need to act immediately on user actions. MOUSE returns what is basically the internal state of the mouse buffers. The current position, where the pointer was first detected down and a state indicator telling you what the system has detected so far (new, completed, drag, stretch, rotate, long click)... But if your program is too slow, it can miss transient events such as new, or long click... I hope that this helps. 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. |
|||
02-26-2020, 09:39 PM
Post: #6
|
|||
|
|||
RE: How to use MOUSE
Dear Mr. Wall,
Thank you for this new program. I tested it and it works. I will study it carefully in the coming period, and then make a program myself with the techniques that are included in this program. Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
02-26-2020, 10:37 PM
Post: #7
|
|||
|
|||
RE: How to use MOUSE
(02-25-2020 06:46 AM)cyrille de brébisson Wrote: Hello,Dear sir de Brébisson, It is all a bit too complicated for me at the moment. I especially need a command that does not matter how long it takes before the user gives a response. This is important because the programs I want to make may not stop prematurely, or get other weird cures. At the moment I think that command is MOUSE, although it is not yet clear to me how to use this command. I will study the sample programs that I have received. Still, I hope to get more documentation or sample programs elsewhere or from someone else. In any case, I want to thank you very much for your contribution. Sincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
02-28-2020, 06:18 PM
Post: #8
|
|||
|
|||
RE: How to use MOUSE
Hello,
in this old thread we analized the different behaviour of the two touch detecting commands WAIT and MOUSE. i found this thread very interesting. i hope it helps in your research. https://www.hpmuseum.org/forum/thread-10...ight=mouse thanks Giancarlo |
|||
02-29-2020, 02:27 AM
Post: #9
|
|||
|
|||
RE: How to use MOUSE
(02-28-2020 06:18 PM)Giancarlo Wrote: Hello, Dear Giancarlo, Thank you very much for your response. I will have to study it carefully, and that will take time. Cincerely, Karel. I use HP-16C, WP-34S emulator, HP-35s, HP-48GX, HP-50g, and HP Prime G2. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)