Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

ScrollView and Window event bug

I have spent 4 hours hacking this ridiculous event system, no luck. I've waisted 10 hours to make 2D game design that just cannot be realized using Appcelerator because of it's buggy event system.

The idea: Very simple. Items are on the scrolling panel, I scroll to the needed item, drag it and drop it to another view.

The code:

var win = Titanium.UI.createWindow();

var newItem = Titanium.UI.createImageView({
    url:'images/icn1.png',
    width:65,
    height:65
});

win.addEventListener('touchmove', function(e)
{
    newItem.center = {x:e.x,y:e.y};
});

var scrollItem = Titanium.UI.createImageView({
    url:'images/icn1.png',
    width:65,
    height:65
});

var scrollView = Titanium.UI.createScrollView({
    top:5,
    left:5,
    height:65,
    width:320,
    backgroundColor:'00FF00'
});

scrollView.add(scrollItem);

win.add(scrollView);

win.add(newItem);

win.open();

The problem: I have ScrollView in the Window, I have Images on ScrollView, when I drag Image from ScrollView and drag it a little bit to the side - it BLOCKS Window's touchmove event (!) and this Image just freezes and ScrollView starts scrolling. It is not possible to have current touchmove position of the window all the time, ScrollView blocks it!

The way to fix it: Window events always should have #1 priority, even if ScrollView is scrolling I should have the ability to get current Window's touchmove position. Now it's just ridiculous - Windows's touchmove is getting x>320 because of ScrollView.

PS. I am sick of those stupid surprises, I develop already half a year and EVERY time if I dig deeper and want to use some control as it should function, I just cant, because "Not implemented in this version" or I just don't get any satisfying answer. My 6 questions are ripping 6th week, some of Ti's support tried to solve that problems but they are still unsolved. I really don't believe that they can be solved even if I got $200 subscription.

— asked May 28th 2010 by Vitali Virulaine
  • bug
  • event
  • scrollview
0 Comments

2 Answers

  • Same problem here !

    When i try to detect the touchmove event..on my scrollview, it works only in a small area. After that it's over.

    Any clue ?

    — answered August 2nd 2011 by Greg Carlin
    permalink
    0 Comments
  • I had a similar issue. A window with a scrollview that had some text in it. The scrollview only covered about 30% of the screen. I wanted the user to be able to swipe anywhere on the page to fire a custom page turn event. When I attached my touchstart and touchend event listeners, it would only work on the area of the scrollview.

    To fix this, I layered on a scrollview over the entire screen on top of everything else and added my eventListeners for touchstart and touchend to the overlay scrollview. This let my touchstart and touchend events to go beyond the area of my smaller scrollview.

    — answered November 8th 2011 by Harry Park
    permalink
    1 Comment
    • It works with just a View. I don't need a ScrollView to overlay everything.

      — commented November 8th 2011 by Harry Park
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.