Constrained Grab

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

Post Reply
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Constrained Grab

Post by richmond62 »

Well: not perfect:
codeSnip.png
slideRuleS.jpg
Here's the stack: https://www.dropbox.com/s/il0n1wa3ol0gl ... e.zip?dl=0

Images "stolen shamelessly" from here:

http://www.stefanv.com/calculators/aristo970/index.html
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Constrained Grab

Post by richmond62 »

2 hours on a dentist's chair while she does a "happy" root-canal thing on me, and another, almost as painful,
operation on my bank account; and the result is that I trip out on the anaesthetic (not quite up the the standard of
Bill Atkinson's LSD I'm afraid) and do this:
BloodyM.png
BloodyM.png (9.52 KiB) Viewed 12542 times
Another thing I really LOVE about Livecode is that when loads of people make
really intelligent suggestions about how to do things I can still be a thorn in the flesh
and go for another way to do that.
codeSnip2.png
Here's the second version of the Slide-Rule: https://www.dropbox.com/s/fb868icd5cg3x ... e.zip?dl=0
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Constrained Grab

Post by richmond62 »

In the second method it is almost impossible for an end-user to move the slide of the slide-rule with any precision.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Constrained Grab

Post by richmond62 »

After a longish time, here's version 3 of my Slide Rule stack:

https://www.dropbox.com/s/td1dbu923rh3t ... e.zip?dl=0

The underlying scripts are both different and considerably simpler: although the slides still
wobble in a most annoying fashion.
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Constrained Grab

Post by bogs »

richmond62 wrote: Wed Dec 20, 2017 9:46 pm ... although the slides still wobble in a most annoying fashion.
I do too on occaision :)
Image
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Constrained Grab

Post by richmond62 »

Face facts: most of us are kinky in one way or another; and as a person who believes in "letting it all hang out" I'm offering you the chance to do just that with this:
kinky.png
Better than unwrapping another pair of socks from your ancient aunty in Melbourne!
Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Constrained Grab

Post by Da_Elf »

Ok ive got a button inside of a group that you click the button to drag the group. The first post in here looked like it should have worked but it doesnt.

Code: Select all

local returnLocation
local currentScroll

on mouseDown
   set the idleRate to 0
   put the location of the owner of me into returnLocation
   grab the owner of me
   put (item 1 of the loc of the owner of me,item 2 of returnLocation) into resetloc
   set the text of fld "testlocation" to resetloc
   set the loc of the owner of me to resetloc
end mouseDown
on mouseStillDown
   put (item 1 of the loc of the owner of me,item 2 of returnLocation) into resetloc
   set the text of fld "testlocation" to resetloc
   set the loc of the owner of me to resetloc
end mouseStillDown
on mouseUp
   put the location of the owner of me into newlocation
   put item 1 of newlocation into xclocation
   put item 1 of returnLocation into xrlocation
   if (xclocation > (xrlocation + 200)) then
      --do something
   end if
   set the location of the owner of me to returnLocation
end mouseUp
  
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Constrained Grab

Post by jmburnod »

Hi,
A way using mouse move.
Btn script

Code: Select all

local cX,yLoc,sMove,sLaCible
on mousedown
   put the owner of the target into sLaCible
   put true into sMove
   put (the mouseH - item 1 of the loc of sLaCible) into cX
   put (the mouseV - item 2 of the loc of sLaCible) into yLoc
end mousedown

on mousemove x,y
   if sMove then
      if there is a sLaCible then
         set loc of sLaCible to x-cX,y-yLoc
      end if
   end if
end mousemove

on mouseup
   put false into sMove
end mouseup
Best regards
Jean-Marc
https://alternatic.ch
Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Constrained Grab

Post by Da_Elf »

Still doesnt work. i will try to strip down the project to post it
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2734
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Constrained Grab

Post by jmburnod »

Hi Da_Elf,
If you want drag a group when you click only on a btn of this group as I understand your prev post
a button inside of a group that you click the button to drag the group
It should work
Jean-Marc
https://alternatic.ch
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Constrained Grab

Post by richmond62 »

diagon.png

Code: Select all

on mouseDown
   grab me
   put item 1 of the loc of me into WUN
   set the idleRate to -1
   set the loc of me to WUN,WUN
   put the loc of me into fld "LOQ"
end mouseDown

on mouseMove
   set the idleRate to -1
   put item 1 of the loc of me into WUN
   set the loc of me to WUN,WUN
   put the loc of me into fld "LOQ"
end mouseMove

on mouseUp
   set the idleRate to -1
   put item 1 of the loc of me into WUN
   set the loc of me to WUN,WUN
   put the loc of me into fld "LOQ"
end mouseUp
This is a "Right load of cobblers" as things get badly stuck on mouseUp.
Diagonally.livecode.zip
(8.76 KiB) Downloaded 347 times
Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Constrained Grab

Post by Da_Elf »

I cant seem to open that file.
This is my file
Attachments
swipe.zip
(4.93 KiB) Downloaded 338 times
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10416
Joined: Fri Feb 19, 2010 10:17 am

Re: Constrained Grab

Post by richmond62 »

Um:
I cant seem to open that file.
Screen Shot 2017-12-22 at 12.04.46 pm.png
2 can play at that game :cry:

Someone maybe about to get his prawns cut off for accidently releasing a confidential file; THIS
is what was inside "swipe.zip":
whatsThis.png
Post Reply