>At 12:46 PM +0200 13/10/1999, Eva Isotalo wrote:
>>Hi everybody,
>>
>>When dragging an image and at the same time clicking the second
>>mouse button (Win98) the image "sticks" to the the mouseloc and
>>nothing else can be done.
>>
>>Any one have an idea of how I can prevent this?
>
>>The script in the image looks something like following:
>>
>>on mouseDown
>> repeat until the mouse is up
>> set loc of me to the mouseLoc
>> end repeat
>># and other stuff here
>>end mouseDown
>>
>>I've found the 'repeat' to be better in my case than the 'grab'.
>>
>>Thanks in advance.
>
>Hi Eva
>
>I have some experience of this. Not pleasant. :(
>
>I don't have the scripts to hand, so this is from memory. But I think
>when a user clicks the second mouse button while the first one is
>down, a second mouseDown is sent. The problem is with the mouseUps. I
>can't remember exactly, but depending on the organisation of objects,
>the mouseUps may not be received by the object in question, or even
>be received at all. (I think the missing mouseUp problem only occurs
>when the clicked object is part of a group.) In my case, also a
>dragging thing, I set a local (declared at the top of the script) in
>the mouseDown, and checked this before performing any action. And
>then forced a mouseUp if this flag hadn't been set. My dragging
>routine used a mouseMove handler, so your solution may be different.
>It was something like this:
>
>local lcDragging
>on mouseDown
> if not lcDragging then
> put true into lcDragging
> -- do stuff here
> else
> mouseUp
> end if
>end mouseDown
>
>on mouseMove
>if lcDragging then
> --do drag stuff here
>end if
>end mouseMove
>
>on mouseUp
> if lcDragging then
> -- do stuff here
> put false into lcDragging
> end if
>end mouseUp
>
>on mouseRelease
> mouseUp
>end mouseRelease
>
>The result was that a click on a second mouse button was the same as
>releasing the mouse button. I liked this, because it discouraged such
>clicking behavior among users, and was far kinder than cutting off
>their fingers. :)
>
>Cheers
>Dave Cragg
>
>
>Hi Eva,
>
>The simple:
>
>on mouseMove x,y
> if the mouse is down then set the loc of me to x,y
>end mouseMove
>
>The more efficient:
>
>local lMouseDown
>
>on mouseDown
> put true into lMouseDown
>end mousedown
>
>on mouseUp
> put false into lMouseDown
>end mouseUp
>
>on mouseMove x,y
> if lMouseDown then set the loc of me to x,y
>end mouseMove
>
>The latter example is more efficient because the state of the mouse is not
>continuously evaluated using the mouse() function. A variable is queried
>instead which is a much less intensive operation, especially on Unix systems
>where the mouse() function is slower. Depending on what you are doing, the
>first method is likely to be sufficient for your needs. HTH
>
>Cheers,
>
>Alan
Thank you Alan and Dave for your help!
This worked fine. Another problem arised though. Typical.. :o(
I have palette windows where an image of something I "carry" is shown. A 'mouseDown'
in the background of this image closes the palette window and shows the 'real' image
at the mouseloc. This 'real' image can be moved around emidiately (no mouseUp after
the mousedown on the palette window). But with this new script, the 'real' image shows
up at the mouseloc but can't be move emidiately, only after a new mouseDown.
>From the palette window a 'send "mouseDown" to image "boot"' is sent.
I have approx. 300 images with different behavior in different situations. Since I'm a
"self learned programmer" I can't figure out how to fix this situation since I don't
understand why using the local variable is working so well. ??? And why is the 'send'
not working with this new script.
Here the new script from one of the "real images":
on mouseEnter
lock cursor
set cursor to 1
end mouseEnter
on mouseLeave
unlock cursor
end mouseLeave
local lBoot
on mouseDown
put true into lBoot
end mouseDown
on mouseMove
if lBoot then grab me -- grab me worked
--better now than 'loc to'. Strange.
end mouseMove
on mouseUp
if lBoot then
global gBought
put "Boot" into gBought
set layer of me to 90
if intersect (me,grc "Carry") then
BoxWindowOpen -- opening the palette window and
-- showing the image. Hiding the 'real' image.
exit mouseup
end if
checkBorder -- checking if outside the window
end if
put false into lBoot
end mouseUp
-----------------------------------
Regards,
Eva