Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
richmond62
- Livecode Opensource Backer

- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Post
by richmond62 » Wed Oct 11, 2023 9:18 am
-
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.
-
richmond62
- Livecode Opensource Backer

- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Post
by richmond62 » Wed Oct 11, 2023 9:27 am
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.
-
richmond62
- Livecode Opensource Backer

- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Post
by richmond62 » Wed Oct 11, 2023 1:33 pm
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
-
-
Klaus
- Posts: 14191
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Oct 11, 2023 1:52 pm
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
-
richmond62
- Livecode Opensource Backer

- Posts: 10097
- Joined: Fri Feb 19, 2010 10:17 am
Post
by richmond62 » Wed Oct 11, 2023 2:05 pm
You are still 'The man' Klaus!