Dragging Wd in Rev2.0

Sarah sarahr at genesearch.com.au
Sun May 25 18:19:01 EDT 2003


It sounds like the mouseDown message is sent when you click in the  
menubar, but the mouseUp never happens. This means that dragWd is set  
to true and startX & startY store how far you are away from you window,  
so now whenever you move the mouse, the window moves accordingly.

I think you need to check "the target" in your mouseDown handler before  
setting dragWd to true e.g. something like:

on mouseDown
if the target contains "Menubar" is false then
-- do dragging stuff
else
pass mouseDown
end if

Alternatively, you could check the position of the mouse on mouseDown  
and only trigger the move if it is within the rect of your moving  
window.

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/


On Friday, May 23, 2003, at 09:17  pm, sims wrote:

> Am testing the rev proj  "DragWindow.rev"  (I think it was made by  
> Scott Rossi)
> using Rev 2.0  (using Mac OSX).
>
> It works nicely, enabling me to grab anywhere in the wd and move the  
> wd.
>
> I used the menu tool and made a Mac menubar  for the stack.
>
> Now, after I use the menubar  (don't even have to choose an item from  
> it),
> I cannot get my cursor near the wd...the wd will move as I enter the wd
> with my mouse.
>
> This seems to only happen after I have clicked in the menubar at the  
> top of
> my desktop (mac menubar). If I restart the stack and do not touch the
> menubar, I can move the wd all I want.
>
> Does this happen with other Mac users?
>
> Anything wrong with this script?
>
> The grab script is:
>
> ---------------------------------------------------------------
> local startX, startY, dragWd
>
> on mouseDown
>   put true into dragWd
>   put the mouseH into startX
>   put the mouseV into startY
> end mouseDown
>
> on mouseMove newMouseH, newMouseV
>   if dragWd then
>     set the loc of this stack to item 1 of the loc of this \
>     stack - startX + newMouseH,item 2 of the loc of this stack -  
> startY + newMouseV
>   end if
> end mouseMove
>
> on mouseUp
>   put false into dragWd
> end mouseUp
>
>
> on mouseRelease
>   put false into dragWd
> end mouseRelease
> ----------------------------------------------------------------------- 
> --
>
> tia
>
> sims





More information about the use-livecode mailing list