Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Output window bar ( touch error ? )

dave1707dave1707 Mod
edited December 2012 in Bugs Posts: 9,616

If I run this program and touch the Parameters window bar and slide my finger sideways on it, I will get 'began', 'moving', as long as my finger is moving, and 'ended' printed in the output window. If I do the same thing with the Output window bar, I will get 'began', 'moving', varies 1 to 9 times, but never an 'ended' printed in the output area. I ran into this when I was trying to figure out why I had more 'began' then 'ended' in a program I was writing and using the output area.


function setup() end function draw()     background(40, 40, 50) end function touched(t)     if t.state==BEGAN then         print("began")     end     if t.state==MOVING then         print("moving")     end     if t.state==ENDED then         print("ended")     end end

Comments

  • Dave, can you check if you get any touch event at all by simply printing t.state? Especially look out for the undocumented state CANCELLED (which equals to 3 on Codea 1.5) and verrrrry unlikely STATIONARY (4 on Codea 1.5).

  • dave1707dave1707 Mod
    Posts: 9,616

    ..@Codeslinger You're correct. I get a state value of 2 (ENDED) only if I get a 0 (BEGAN) and don't get a state value of 1 (MOVING). But I get a state value of 3 when I get a 0 (BEGAN) and a 1 (MOVING). It doesn't make sense to have a CANCELLED. Once you touch the screen, you have to end the touch at some point, either by lifting your finger or moving it off the screen.

  • I found a way to reproduce the creation of the CANCELLED event myself. I have to play Gremlin and wiggle my finger at the upper edge of the screen so that the small notifications window handle appears and disappears and appears and disappears ... After some seconds I get a CANCELLED event. I wasn't able to create such an event at other screen locations and also not in a systematic way that could be described other than "wiggle my finger".

  • dave1707dave1707 Mod
    Posts: 9,616

    .. @Codeslinger I changed the above program to print cancelled if none of the other touch events are matched. I wasn't able to get cancelled to print doing it your way, but I can get it all the time by moving the Output bar. If you move your finger sideways on the Output bar, you'll get moving, but as soon as you move your finger up or down, you'll get cancelled.


    function setup() end function draw()     background(40, 40, 50) end function touched(t)     if t.state==BEGAN then         print("began")     elseif t.state==MOVING then         print("moving")     elseif t.state==ENDED then         print("ended")     else         print("cancelled")     end     end
Sign In or Register to comment.