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: Klaus, FourthWorld, heatherlaine, kevinmiller

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

Constrained Grab

Post by richmond62 » Mon Jul 25, 2016 1:50 pm

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: 6151
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Constrained Grab

Post by richmond62 » Tue Jul 26, 2016 12:59 pm

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 5920 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: 6151
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Constrained Grab

Post by richmond62 » Tue Jul 26, 2016 4:57 pm

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: 6151
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Constrained Grab

Post by richmond62 » Wed Dec 20, 2017 9:46 pm

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: 5432
Joined: Sat Feb 25, 2017 10:45 pm

Re: Constrained Grab

Post by bogs » Wed Dec 20, 2017 10:31 pm

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: 6151
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Constrained Grab

Post by richmond62 » Thu Dec 21, 2017 7:18 am

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 » Thu Dec 21, 2017 5:48 pm

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: 2642
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Constrained Grab

Post by jmburnod » Thu Dec 21, 2017 6:21 pm

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 » Thu Dec 21, 2017 6:39 pm

Still doesnt work. i will try to strip down the project to post it

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2642
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Constrained Grab

Post by jmburnod » Thu Dec 21, 2017 7:21 pm

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: 6151
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Constrained Grab

Post by richmond62 » Thu Dec 21, 2017 9:41 pm

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 140 times

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: Constrained Grab

Post by Da_Elf » Thu Dec 21, 2017 10:33 pm

I cant seem to open that file.
This is my file
Attachments
swipe.zip
(4.93 KiB) Downloaded 121 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6151
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Constrained Grab

Post by richmond62 » Fri Dec 22, 2017 11:05 am

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

Return to “Getting Started with LiveCode - Complete Beginners”