Simple way to drag a graphic across the screen?- Solved

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

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Simple way to drag a graphic across the screen?- Solved

Post by bogs » Thu Sep 14, 2017 3:28 pm

For mobile devices yes, but if you (future guests) are looking to accomplish it on the desktop, not so much :)
Lc lesson wrote:* You will require a touch screen device that support multi-touch, ie the iPhone and most modern android devices.
For desktop, I wonder if the select command might work in conjunction with the grab/move commands.
Lc Dictionary wrote: Platforms: Desktop, Server, Web and Mobile
Summary:
Selects part of the text of a field, or places the insertion point in a field, or removes the insertion point, or Selects one or more objects.
Use the select command to select objects or text in order to change them, or to deselect all objects and text.
Image

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Simple way to drag a graphic across the screen?- Solved

Post by sphere » Thu Sep 14, 2017 6:19 pm

but a laptop or mini-pc on a big 32-points touch screen maybe yes

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Simple way to drag a graphic across the screen?- Solved

Post by bogs » Thu Sep 14, 2017 7:28 pm

LOL that is probably true :) unless it is based on the os running it instead of the hardware using it (more likely).
Image

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Simple way to drag a graphic across the screen?- Solved

Post by sphere » Fri Sep 15, 2017 11:37 am

Yes you're correct Bogs, i was a bit to quick.
The mentioned method in the lessons of course does not work on Windows connected to a multitouch screen, i just tested. It is probably only for mobile.
Then it needs grab.

The screens are automatically HID, or mouse mode or you can set it to TUIO an open source touch protocol.
I did not test it on screens with Android in them, we have them too. So maybe then it will use the method as mentioned in the lesson. Have to test it when i get my hands on it.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Simple way to drag a graphic across the screen?- Solved

Post by bogs » Fri Sep 15, 2017 1:31 pm

sphere wrote:I did not test it on screens with Android in them...
I would suspect that would work, unfortunately I don't have these various things for testing (dumb phone, no tablets or other toys), so I'll depend on you to tell us :D
Image

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Simple way to drag a graphic across the screen?- Solved

Post by jacque » Fri Sep 15, 2017 9:37 pm

One kludge to move several objects at once using "grab" might be to temporarily select and group the objects, then issue the "grab" command. On mouseUp, ungroup the controls. There are some down sides, mainly that it will disrupt the layering order of everything on the card, so if that's important you'd have to relayer after the move finishes.

I'm talking off the top of my head again, haven't tried it. But if the layout permits, you could just permanently group the objects if you know what they will be.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Simple way to drag a graphic across the screen?- Solved

Post by sphere » Sat Sep 16, 2017 10:10 am

Exactly, that's the idea, i was playing with that to get it, but it's not going yet the way i want, so have to try some more.

My idea is to double tap to select an object (doublemouseup), say you select 3 objects and then when touching a 4th object (mousedown), it will create a group and while keeping mousedown drag it (grab) somwhere, then when untap (mouseup) uncreate the same group.

Easy to simulate on desktop as the behaviour is the same mouse/touch. different on mobile.

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

Re: Simple way to drag a graphic across the screen?- Solved

Post by richmond62 » Sat Sep 16, 2017 12:18 pm

My idea
That makes perfect sense on a desktop computer,

BUT it does not make sense of HOW end-users may work with their pointing device:

How are you going to let end-users know about what to double-click?

Personally I'd go for a right click on a 2 or 3 button mouse instead.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Simple way to drag a graphic across the screen?- Solved

Post by sphere » Sat Sep 16, 2017 8:50 pm

It makes sense, you could explain in advance.
But a Right click on a touch screen is MouseStillDown, (so a long single finger tap), that would also be a possibility
On Windows: for example on the desktop the submenu comes up, same as when you right click.
Of course with gestures settings you could change this to 2 fingers is a right click

But i think i'll stick to double tap to select more than 1 object to get a group to move, this is not needed when only moving 1 object, then only mousedown is sufficient

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7230
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Simple way to drag a graphic across the screen?- Solved

Post by jacque » Sat Sep 16, 2017 10:03 pm

Typical Android (and possibly iOS) interface for multiple selections is this:

Long-press the first control. The app goes into "selection mode" and indicates the object is selected by changing its color, or outline, or something else visible to the user. Subsequent taps on other controls add those to the selected list unless the control is already selected, in which case it is deselected.

Long-press any of the selected controls and the app executes an action on all the selected objects; in this case, group them and issue a "grab" command. After the grab, reset the visual cues and turn off the selection mode flag.

Tapping outside any control (on the card perhaps) removes all selections. Or more commonly on Android, there is a back arrow that restores the card to non-selection mode.

You can identify a long-press by putting the milliseconds on mouseDown into a script local variable and comparing that with the time at mouseStillDown or mouseUp. If it is more than 500 ms or so, it's a long-press.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Simple way to drag a graphic across the screen?- Solved

Post by sphere » Sat Sep 16, 2017 10:40 pm

got it so far (on windows now) that all objects(btns) with doublemouseup the background will turn blue
-the select is set to true
-then the group is created
-but grab group"MoveIt" is not working, and i have to try a bit more, maybe something while creating the group is not going so well.

In fact we're trying to (sort of) mimic the same behaviour as when the stack is not running, then you draw a square around the preferred objects and click Group.
Now we doubleclick a few objects and when mousestilldown the GROUP is created

This last piece of Klaus helped a nice bit: viewtopic.php?f=9&t=24320&p=125743&hili ... ts#p125741

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Simple way to drag a graphic across the screen?- Solved

Post by sphere » Tue Sep 19, 2017 9:41 pm

So i think i let it rest for a while.
I tried some different approaches which i've found here on the forum.
Group them, select them, copy them into a group and trying to delete the old btn. (it may be images also instead)
Still not having the succes i would like. All to just select it by double clicking it(double tap) then while moving one object, the rest of the selected will follow.

Every attempt leads me to a new obstacale (which probably i'm not smart enough for to find a solution for)
So i'm a bit tired trying. i'll come back when i have new energy for this, refocus and put some of my tryings here :|

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Simple way to drag a graphic across the screen?- Solved

Post by bogs » Wed Sep 20, 2017 4:42 am

sphere wrote:Every attempt leads me to a new obstacale (which probably i'm not smart enough for to find a solution for)
I doubt that is true, but
i'll come back when i have new energy for this, refocus and put some of my tryings here
...this sounds like what I do a lot. Put it down, stretch your brain somewhere else, sometimes it hits when you least expect it :)
Image

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Simple way to drag a graphic across the screen?- Solved

Post by sphere » Wed Sep 20, 2017 7:52 pm

Thanks Bogs! getting new energy here !

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Simple way to drag a graphic across the screen?- Solved

Post by bogs » Wed Sep 20, 2017 9:50 pm

Time for some pie ! (MIB3) :D
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”