MOUSE command problem (FW 2.1.14730) - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: MOUSE command problem (FW 2.1.14730) (/thread-20280.html) |
MOUSE command problem (FW 2.1.14730) - komame - 08-07-2023 03:02 PM I tried to read the touch screen status in a loop. It's important that it's not a blocking function (like WAIT) because other tasks are executed in the meantime. I used the MOUSE() command, but it behaves oddly. First, I'll provide an example of a program that works, but doesn't quite meet my expectations: Code:
Above, the coordinate retrieval is done by calling MOUSE() twice, which is not very neat, and with very fast movements, it can lead to returning the x coordinate from one point and the y from another, combining them into a single mismatched point on the screen that might not have been touched at all. A better solution would be to retrieve the MOUSE() result into a variable once and then operate on its components: Code:
Unfortunately, such a solution doesn't work. Despite the infinite loop, the program stops after several iterations of the loop and it doesn't even report an error. Moreover, MOUSE2 can only be run from the 'Program Catalog', but from the command line in 'Home', it returns "Error: Invalid input". Is this a bug? Regards Piotr Kowalewski RE: MOUSE command problem (FW 2.1.14730) - gehakte_bits - 08-07-2023 06:06 PM check for a return of an empty list of lists on mouse() and maybe slow down.. Code:
RE: MOUSE command problem (FW 2.1.14730) - komame - 08-07-2023 07:05 PM Your correction indeed works! However, it doesn't change the fact that when the program is launched from the 'Program Catalog', it should signal an error instead of freezing. Thanks. RE: MOUSE command problem (FW 2.1.14730) - matalog - 08-08-2023 07:58 PM Does this work as you wanted it to? Code: EXPORT pointer2() edit: Oh, I see you didn't want a Wait(-1). RE: MOUSE command problem (FW 2.1.14730) - matalog - 08-08-2023 08:07 PM There is something strange about the Mouse driver though, whether it is hardware or software based, i'm not sure. If you move your finger onto the screen from any side of the screen everything is fine, unless the side you move on from is the bottom, then MOUSE() will only register the initial x position and hold the 239 value as bottom of screen. PS: I just realised as I was typing the last part that they must have kept the same code for the soft button menus in place for even MOUSE, as it would be a decent decision to ignore movements in from the bottom of screen if there were definitely going to be soft buttons there. Not a great decision when there are not definitely going to be soft buttons there. |