Post Reply 
Graphic cursor problem
01-13-2021, 02:27 AM
Post: #5
RE: Graphic cursor problem
(01-12-2021 05:39 AM)cahlucas Wrote:  Dear Mr. Han,
During debugging, the program works properly. So it must be something else that the original image of the underlying app appears. The question now is what needs to be changed to ensure that this does not happen again. I could use some help with this, because there are a lot more people in this community who have a lot more experience programming the Prime, including you. Therefore, I would like to see suggestions on how to address this problem. Thanks in advance! Sincerely, Karel.

A likely reason why it seems to work during debugging is that (perhaps) you are not accounting for "mouse-up" events. So when a "mouse-down" even occurs (i.e. your finger touches the screen) and the code follows into DEBUG mode, everything looks fine. But the DEBUG mode probably gets in the way of the "mouse-up" event (when you lift your finger from the screen). So the cursor is indeed being drawn correctly at the precise moment you touch the screen, but perhaps your code is not accounting for what happens when your finger lifts up from the screen. But without the code in its entirety (at least without the mouse/keyboard handling portion), it's hard to say precisely what the cause is. A generic mouse/keyboard handler would look something like:

Code:
EXPORT KMINPUT()
BEGIN
  LOCAL run:=1, key;

  // change run to 0 to exit the while loop
  key:=WAIT(-1);
  CASE
    IF TYPE(key)==6 THEN
      // we have touchscreen events
      CASE
        IF key(1)==0 THEN kmMouseDown(); END;
        IF key(1)==1 THEN kmMouseUp(); END;
        // ... more mouse events
        IF key(1)==7 THEN kmMouseLongClick(); END;

        kmMouseEvent(); // default handler
      END;
    END; // end of touch events

    // at this point, all touch events were handled due to the
    // TYPE(key)==6 check; so only key-presses are left
    // and if a touch event occurred, these tests below are
    // never reached

    IF key==0 THEN kmDoAppsKey(); END;
    // ... more key definitions here
    IF key==50 THEN kmDoPlusKey(); END;

    kmOtherEvents(); // handle all remaining undefined keys
  END;

END;

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Graphic cursor problem - cahlucas - 01-09-2021, 09:20 PM
RE: Graphic cursor problem - Han - 01-10-2021, 09:45 PM
RE: Graphic cursor problem - cahlucas - 01-12-2021, 05:39 AM
RE: Graphic cursor problem - Han - 01-13-2021 02:27 AM
RE: Graphic cursor problem - C.Ret - 01-12-2021, 12:13 PM
RE: Graphic cursor problem - cahlucas - 01-13-2021, 05:52 AM



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