KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to prevent an object in 4D Draw from being resized
PRODUCT: 4D Draw | VERSION: | PLATFORM: Mac & Win
Published On: February 16, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

In 4D Draw, you are given the ability to lock an object's attribute both programmatically and manually. However, nothing prevents users from unlocking those properties. This tech tip describes how to prevent users from resizing an object whose size is locked. This applies when, for example, you want users to be able to alter any other property for an object but not allow them to resize it. In this example we use an object that is created programmatically, so its size is a known value.

Intercepting the event:

Before you can prevent the resizing of the picture, you need to trap the event and install an "on event" procedure. The following code makes sure the method EventProc is executed each time users attempt to resize any object. This code is placed in the form method.



Preventing the resize:

To better understand how to prevent this from happening, we need to go through the method that creates the object.



When the object is created, you need to create two reference process variables. The object's own reference and its size. The size variable will be used to compare to its new size after it is resized. Also the Size attribute is locked at the creation of the object.

Resizing the object to its original size:

The EventProc method is responsible for that action.