Input Delegate

I have an input delegate in my code, that when selected via a tap event, changes the data displayed on the datafield. I have set it up so that the change in data only occurs when the screen is tapped in a particular location. In this case, at the bottom of the screen.

The problem that I have is I am running this on an edge 1030. When you normally tap the screen on the edge unit it brings up an option to go to the home screen or scroll left and right. When the input delegate is running, it overrides this so that it won't come up.

Is there anyway to limit the input delegate to part of the screen so that the home screen option still comes up, or do I have to do it some other way?

  • In your delegate are you returning true of false based on where the tap occurs?

  • Thanks Jim. As soon as I read your response I knew the answer.

    I had an if function for tap location and the 'return true' was outside the if function. The annoying thing is I spent hours looking at it to try and figure it out. The answer is always so simple.

  • Jim, can you help me please. I have just updated to a edge 1040. Running SDK 4.1, it has changed the way an input delegate works. I use it for a clickevent, but only at the bottom of the screen. When you click the middle, it brings up the home screen button on the screen. This is how it worked on my 1030. On the 1040 the input delegate works, but the home screen button will not come up. I have tried reading the notes in the SDK, but there is nothing about an input delegate change. Also, in Eclipse, when I save it brings up 'some but not all code paths return a value'.

    Code in question:

    class TouchBehaviorDelegate extends WatchUi.BehaviorDelegate {
    function initialize() {
    BehaviorDelegate.initialize();
    }

    function onTap(clickEvent) {
    var TapLocation = clickEvent.getCoordinates();
    var TapType = clickEvent.getType();
    if (TapLocation[1] > 400 && TapType == 0) {
    Screen += 1;
    }
    if (Screen > 2) {
    Screen = 1;
    }
    if (TapLocation[1] > 400 ) {
    return true;
    }
    }
    }
     

  • Looks to me you only do a proper return if tapLocation[1]>400.  You want to return true of false in all situations,