Results 1 to 18 of 18
  1.    #1  
    Hi,

    I make some kind of RSS reader and has faced with a problem.

    All messages are in Mojo.List and I catch listTap on entries. But! If entry has link (<a href="http://....">link</a>) then a click on link make 2 events: first is listTap and secondary - palm runs Browser. So, my question is: How to disable listTap if user taps link?
    Last edited by Shura; 09/30/2010 at 09:08 AM. Reason: grammar
    Phone: HP Veer
    Jabber: shura0@ya.ru
  2. #2  
    I don't think you can disable list tap. :-(
  3. #3  
    Just a friendly suggestion...
    If you don't want users to click the URL link, then why are you including it in the list widget in the first place? You should parse your data before displaying it in the list widget. If you still want the link visible but not clickable, then strip away the href formatting off of it before displaying it.
    Developer of: FFplayer - a file/folder based music player. FFplayer home
  4. #4  
    Event.stop?
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.
  5.    #5  
    unfairSurprisery
    like this? http://forums.precentral.net/web-os-...ml#post2672312
    And last line in handler will be event.stop, right?
    Phone: HP Veer
    Jabber: shura0@ya.ru
  6. #6  
    Quote Originally Posted by Shura View Post
    unfairSurprisery
    like this? http://forums.precentral.net/web-os-...ml#post2672312
    And last line in handler will be event.stop, right?
    Yep. Just try .stop. =-@
  7. #7  
    Possibly, you could put the link in a div. I'm not certain but I'd think it would stop the tap event from falling to the List underneath.

    EDIT: You might have to add a tap event to the div but just leave the event function empty.
  8.    #8  
    thank you, I'll try
  9.    #9  
    That does not work. Event listTap works early that onClick.
    Last edited by Shura; 10/02/2010 at 04:48 AM.
    Phone: HP Veer
    Jabber: shura0@ya.ru
  10. #10  
    Hmm, that's all I have I'm afraid. At this point I would normally start assigning '-webkit-palm-mouse-target:ignore;' indiscriminately to the list and it's child elements until it worked. I wouldn't recommend it though.
  11. #11  
    Set custom events on the links and within those events, call event.stopPropagation() and event.preventDefault() (I think those are correct). You'll need to handle launching the browser yourself, but that's easy.

    Alternatively, check the event.target on listTap and do nothing if it happens to be the link and not the parent div.
  12. #12  
    You should be able to use event.element() to figure out exactly what html element was tapped on and just ignore it if it was a link. something like:
    Code:
    MyAssistant.prototype = {
    setup: function(){
    ...
      this.mylisttaphandler_bound = this.mylisttaphandler.bindAsEventListener(this);
    ...
    }
    ...
    mylisttaphandler: function( event ){
      if(event.element().inspect().split(0,3)!='<a '){
        ...your stuff here...
      }
    ...
    }
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.
  13.    #13  
    Quote Originally Posted by joshsharp View Post
    Set custom events on the links and within those events, call event.stopPropagation() and event.preventDefault() (I think those are correct). You'll need to handle launching the browser yourself, but that's easy.
    It does not work because onClick event works after listTap.
    Phone: HP Veer
    Jabber: shura0@ya.ru
  14.    #14  
    unfairSurprisery
    Does not work too.
    event.element().inspect() always returns <div id="mainlist" class="listClass">. It's List element.
    Phone: HP Veer
    Jabber: shura0@ya.ru
  15. #15  
    That's odd... event.element() is supposed to return the actual element that triggered the event. I wonder if listTap events are done differently.

    Ok, a couple of new solutions(i hope)...
    *You could check the coordinates of your listTap event against the coordinates of your links.
    *Don't use listTap. Instead set an event listener for when your list is updated and manually handle a set of 'tap' events on each list item. Or even ditch the mojo events altogether and use prototype's event system directly replacing 'tap' with 'click'. I mention this, because I know from painful experience that in prototype, when you set a click event on a container and then click on one of its child elements, the event.element() function returns the child element you clicked on.
    danNielson.com - Slalom - twitter - facebook
    A posted thanks dies with the thread. Clicking the button lasts until the admins get bored with this site and throw it in the recycling bin.
  16. #16  
    Did you try event.target?
    My apps:
    ReWeather - Attractive weather app that reflects current conditions
    Suburbly UK (trial version) - Search for properties to rent, share or buy all over UK.

    Twitter: @joshsharp / @recursivemedia
  17.    #17  
    joshsharp
    Yes, all the same <div id="mainlist" class="listClass">
    Phone: HP Veer
    Jabber: shura0@ya.ru
  18.    #18  
    I found!

    event.originalEvent.target returns link target!
    Phone: HP Veer
    Jabber: shura0@ya.ru

Tags for this Thread

Posting Permissions