Hi,

I am using a horizontal scrollbar to control a graph I show in a gadget.
I expect to catch the sclExit and sclRepeat events to redraw my graph
correctly. 
This mostly work fine, but when I click the car, the scrollbar resets itself
to zero right after I let the sclEnter event pass by unhandled, and before I
receive a sclRepeat event.

Also I wonder if it is really needed to call SclSetScrollBar with values I
recalculate based on which value activeRegion has. I would really expect
this to happen automatically.

I am using PalmOS 3.5 and I have tried to make the scrollbar vertical with
the same result. 

My sclExit code is this:

case sclExitEvent:
{
    Int16 newThumbPosition = eventP->data.sclRepeat.newValue;
    if (newThumbPosition == oldThumbPosition){
        Int16 value,     minval, maxval, pageSize;
        SclGetScrollBar (eventP->data.sclExit.pScrollBar, &value,
                           &minval, &maxval, &pageSize);
        Int16 activeRegion =
                  eventP->data.sclExit.pScrollBar->attr.activeRegion;
        switch (activeRegion) {
            case sclUpArrow:
                value--;
                if (value < minval) value = minval;
                break;
            case sclDownArrow:
                value++;
                if (value > maxval) value = maxval;
                break;
            case sclUpPage:
                value-= pageSize;
                if (value < minval) value = minval;
                break;
            case sclDownPage:
                value+= pageSize;
                if (value > maxval) value = maxval;
                break;
            case sclCar:
                if (value > maxval)
                    value = maxval;
                break;
        };
        if (activeRegion != sclCar) {
            SclSetScrollBar (eventP->data.sclExit.pScrollBar, value, minval,
                    maxval, pageSize);
            newThumbPosition = value;
        }
    }
    if (newThumbPosition != oldThumbPosition) {
        oldThumbPosition = newThumbPosition;
        this->UpdateGraphs();
    }
    handled = true;
    break;
}

Thanks for any hints,

Henrik Dalgaard



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to