Page 1 of 1
Alternative Drag Bar
Posted: Wed Oct 11, 2023 9:18 am
by richmond62
-
I want to be able to drag my stack around the screen by click-dragging on the brown graphic at the bottom of the stack . . .
But this:
Code: Select all
on mouseDown
grab me
end mouseDown
on mouseMove
set the bottomleft of stack "edge drag" to the bottomleft of me
end mouseMove
Screws up badly:
1. obviously being called far too often as there is major screen flicker.
2. the graphic ends up off-screen.
Re: Alternative Drag Bar
Posted: Wed Oct 11, 2023 9:27 am
by richmond62
And this is equally useless:
Code: Select all
on mouseDown
grab me
end mouseDown
on mouseMove
put item 1 of the location of stack "edge drag" into LR
put item 2 of the location of stack "edge drag" into UD
set the left of stack "edge drag" to (LR - (the left of me))
set the bottom of stack "edge drag" to (UD + (the bottom of me))
end mouseMove
as the graphic ends up being ungrabbable and the stack jinks around the screen for no obvious reason.
Re: Alternative Drag Bar
Posted: Wed Oct 11, 2023 1:33 pm
by richmond62
The problem with this:
Code: Select all
on mouseMove
if the mouse is down then set the loc of this stack to the screenMouseLoc
end mouseMove
is that it results in the 'drag bar' graphic being moved to the middle of the stack when it should remain at the bottom:
BEFORE
-
-
AFTER
-
Re: Alternative Drag Bar
Posted: Wed Oct 11, 2023 1:52 pm
by Klaus
Hi richmond,
put this into the script of your graphic:
Code: Select all
local maydrag
on mouseDown
put mouseH() & "," & mouseV() into maydrag
end mouseDown
on mouseMove x,y
if maydrag is empty then
exit mousemove
end if
set the topLeft of this stack to (item 1 of the screenMouseLoc - item 1 of maydrag), (item 2 of the screenMouseLoc - item 2 of maydrag)
end mouseMove
on mouseUp
put empty into maydrag
end mouseUp
on mouserelease
mouseup
end mouserelease
Best
Klaus
Re: Alternative Drag Bar
Posted: Wed Oct 11, 2023 2:05 pm
by richmond62
You are still 'The man' Klaus!