Is it possible to lock the size of an object?

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
Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Is it possible to lock the size of an object?

Post by Newbie4 » Sun Sep 30, 2012 1:59 am

I am creating graphics problematically for the user to move around but I do not want the user to be able to change the size of them. Is there a way to do this? There is a lockLoc but no lockSize, lockWidth or lockHeight
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Is it possible to lock the size of an object?

Post by FourthWorld » Sun Sep 30, 2012 4:54 am

lockLoc could more accurately be called lockRect, as it locks all aspects of the object's position.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: Is it possible to lock the size of an object?

Post by Newbie4 » Sun Sep 30, 2012 3:52 pm

Thank you for the reply
That is the problem, lockLoc locks everything.
I do want to let them move it around. I just do not want them to accidentally change the sizes.
I want to lock the size but not prevent the users from positioning it
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Is it possible to lock the size of an object?

Post by FourthWorld » Sun Sep 30, 2012 4:05 pm

Don't provide a pointer tool mode for your users and they'll have no means of resizing the objects.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Is it possible to lock the size of an object?

Post by Klaus » Sun Sep 30, 2012 6:32 pm

Yep, please spread the word: Standalone <> IDE! :D

In a standalone the user will only be able to do things that YOU, the developer, will allow him!

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Is it possible to lock the size of an object?

Post by sturgis » Sun Sep 30, 2012 7:36 pm

Look at "grab" in the dictionary. As the others mentioned, you don't have to provide a way to "select" the object (as in edit mode of the ide) if you want it movable, just use grab to allow it to be moved around and the problem goes away entirely.

Newbie4
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 332
Joined: Sun Apr 15, 2012 1:17 am
Contact:

Re: Is it possible to lock the size of an object?

Post by Newbie4 » Mon Oct 01, 2012 12:34 am

Thank you all. Those are all good answers and conceptually, they make sense.

The problem is, I do not know how to do what you are suggesting and can't find any examples or documentation on it. I looked in the Dictionary, Resources, Lessons and found not much to help on those topics. I read a number of forum links but they are mostly on interactive/developer tasks

I hate to bother you again but...
1) How do you use the "grab" to grab an object, drag it and then let it go? At that point I want to lock the location of that graphic.
2) How do you turn off the 'pointer tool mode' for the user?

Thank you all for your help and I apologize for being dumb and asking so many questions.
Cyril Pruszko
https://sites.google.com/a/pgcps.org/livecode/
https://sites.google.com/a/setonhs.org/app-and-game-workshop/home
https://learntolivecode.com/

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: Is it possible to lock the size of an object?

Post by sturgis » Mon Oct 01, 2012 1:32 am

To see how it might work (this is a VERY simple example, hard to know how to give a more concrete example without knowing what you're trying to end up with)

Create a new mainstack.

Drop a graphic on it, I used a rectangle.

Set the "opaque" property of the rectangle to true in the inspector.

Edit the script of the rectangle and put the following

Code: Select all

on mouseDown
grab me
end mouseDown
Apply the changes to the script, then go into run mode, click and drag the square and it should follow right along. Release the mouse button and it stays where you put it.
As indicated by Klaus, when you build a standalone, run mode is the default, you have to specifically go out of your way to code methods to select objects so that you can access their "handles". In the IDE of course thats not the case.

Also, don't know if you've been referred to these resources yet..
http://www.runrev.com/developers/docume ... rs-course/
http://lessons.runrev.com/

Both are very helpful when you're just starting out.

Post Reply