static int scrollGesture(Gesture g) { Name msg; Int amount; Graphical gr; Name dir = NAME_forwards; if ( !scrollMessage(g, g->drag_scroll_event, &gr, &msg, &amount) ) fail; if ( valInt(amount) < 0 ) { dir = NAME_backwards; amount = toInt(-valInt(amount)); } if ( hasSendMethodObject(gr, msg) && send(gr, msg, dir, NAME_line, amount, EAV) ) { EventObj ev = getCloneObject(g->drag_scroll_event); /* TBD: optimise? */ DEBUG(NAME_dragScroll, Cprintf("Drag event = %s, receiver %s\n", pp(ev->id), pp(ev->receiver))); ComputeGraphical(gr); restrictAreaEvent(ev, gr); /* Normalise to area of rec */ send(g, NAME_drag, ev, EAV); synchroniseGraphical(gr, ON); doneObject(ev); } succeed; }
static status typedIntItem(IntItem ii, EventId id) { CharArray save = getCopyCharArray(ii->value_text->string); status rval = typedTextItem((TextItem)ii, id); if ( rval && !checkType(ii->value_text->string, TypeInt, NIL) && getSizeCharArray(ii->value_text->string) != ZERO ) { displayedValueTextItem((TextItem)ii, save); return errorPce(ii, NAME_cannotConvertText, ii->value_text->string, ii->type); } doneObject(save); return rval; }