viewport

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Steve
Posts: 30
Joined: Fri Nov 07, 2008 10:46 pm
Contact:

viewport

Post by Steve » Wed Jul 28, 2010 2:49 am

I am trying to create what, in other languages, is often called a viewport. That is, I have a large image, but I want to show only a small rectangular part of it. I don't want to create a huge mask to cover the rest of the image, as that blocks out lots of other objects on the card. I want to be able to (somehow) define just the small rectangle that lets that part of the larger object show through.

I had assumed this can be done with some choice of Blends and transparency, but I have tried many combinations and cannot create a viewport effect. I can always block what's under the small rectangle, but I cannot "allow through" what's under the small rectangle.

Any suggestions?
Steve Alessi
Associate Professor
The University of Iowa

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

Re: viewport

Post by FourthWorld » Wed Jul 28, 2010 3:15 am

Put the image object in a group control.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Steve
Posts: 30
Joined: Fri Nov 07, 2008 10:46 pm
Contact:

Re: viewport

Post by Steve » Thu Jul 29, 2010 4:05 am

Thanks, Richard! That worked. I learned that I also need to "lock" the location of the group, or it changes along with changes to the images location.

Steve
Steve Alessi
Associate Professor
The University of Iowa

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

Re: viewport

Post by FourthWorld » Thu Jul 29, 2010 3:39 pm

Glad that was helpful. Yes, locking the interior objects can help in a good many uses of groups.

You may also want to explore the boundingRect property for groups. You won't need it all the time, but if you want to have multiple objects in a group which has a scrolling area larger than their collective bounds, the boundingRect will let you define the effective area of the group so you can do some nice canvas-like things with them.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply