Android Question Difference between Reflection onTouchEvent and Panel_Touch

Discussion in 'Android Questions' started by pauleffect, Sep 14, 2014.

  1. pauleffect

    pauleffect Member Licensed User

    Ok, I read a post, this one and my curiosity went over 9000.

    I was trying to make my own floating options panel and the "jitter" was through the roof. I even tried using timers to filter out touch events, to animate between drags and whatever.

    Then I tried erel's draggable class and boom!

    As he used ontouchevent instead of a regular panel_touch, he inserted a comment saying his reason deserved a thread.

    I can't believe nobody asked until now. Well, here it goes:

    Looking forward to the answer!
    Last edited: Sep 14, 2014
    lemonisdead likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    See agraham's note about DoEvents / modal dialogs:

    Starting from Android 4.03 it was no longer possible to process the message queue inside some of the events.
    DoEvents calls or MsgBox calls cause the app to crash when done during these events.
    (Search for: recycled twice to see the errors).

    The solution was to send the event to the message queue instead of processing it immediately. This way the developer code was safe as it wasn't executed inside the event.

    However in the case of Touch event it is not perfect. Your code is not synchronized with the touch events. This causes the movement to be very jumpy, because the panel has already moved when your code executes. So I'm using reflection to add the touch event handle it directly. If you try to put a breakpoint in this sub (which is equivalent to a modal dialog) then the program will crash.
    pauleffect and lemonisdead like this.
  3. pauleffect

    pauleffect Member Licensed User

    I was going bananas. Literally. And I have to say, after seeing that custom control work, i smelled something fishy. on a dual core(arm as it is, but still) it's unthinkable not to be able to smoothly drag a panel.

    thanks, i was looking forward to this!
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice