[Q] Move the cursor programatically
Andreas Raab
andreas.raab at gmx.de
Wed Sep 10 17:09:28 UTC 2003
> That was my first attempt. Only problem was that the dialog sometimes
> appeared parially off-screen if the mouse was at the edge of the
> screen. I think I know how to avoid this.
Simple enough -- try the following (hit Alt-Period to exit):
aDialog := Morph new.
aDialog extent: 400 at 400.
aDialog openInWorld.
aWorld := aDialog world.
[true] whileTrue:[
"Set the unconstraint position"
aDialog center: aWorld primaryHand position.
"Now keep it in the world"
box := aWorld bounds.
trial := aDialog fullBounds.
delta := trial amountToTranslateWithin: box.
aDialog position: aDialog position + delta.
"And do a world cycle so something happens"
World doOneCycle.
].
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|