Previous Topic Tutorial Home Page Next Topic
Using Draggables for Control Points

Here, use the draggable class from the utility library. Construct a draggable based on a small (4 mm) cube with a reactive color the color is green while dragged and red otherwise. Provide accessors to get back the image and the position point of the draggable.

class DraggableButton extends Statics {

public DraggableButton(Point2Bvr initPt2) {

NumberBvr halfDimNum = toBvr(2*mm);
ColorBvr cClr = ColorBvr.newUninitBvr();
ImageBvr blockImg = solidColorImage(cClr).
crop(point2(neg(halfDimNum), neg(halfDimNum)), point2(halfDimNum, halfDimNum));

_dragImg = new DraggableImage(blockImg, initPt2);

cClr.init(until(red, _dragImg.getGrabEvent(),
until(green, _dragImg.getReleaseEvent(), cClr)));
}

public ImageBvr getImageBvr() { return _dragImg.getImageBvr(); }
public Point2Bvr getPointBvr() { return _dragImg.getPointBvr(); }
DraggableImage _dragImg;
}


© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

Previous Topic Tutorial Home Page Next Topic