The Container object is primarily intended to be used as a surface for other objects. It’s similar to a group, except that objects placed on a container can be moved and edited easily. This makes the Container an excellent tool for creating sizeable publications and custom windows.
To add a Container to your publication, use the mouse to draw a rectangle where you would like the object to appear. Other objects can be attached to a Container by selecting a tool from the Tool Palette and drawing directly onto the Container’s surface. (You can even attach other Containers.) Existing objects can be moved onto a Container by cutting and pasting them from the clipboard. When using this method, make sure that the container is selected before choosing paste. To move an object off a container, select the object, cut it to the clipboard, make sure no other objects are selected, then paste. Once an object is attached to a Container, the two become linked. Moving the Container also moves any attached objects. Similarly, deleting a Container also deletes any attached objects.
You can modify a Container by right clicking the object. The Container Properties screen will be displayed, allowing you to define the object’s appearance and behavior.
The Container Properties screen is divided into two sections indicated by the icon images on the left: General and Actions. To view the settings for a section, click the corresponding icon.
If you’re planning to attach other objects to your Container, you can adjust the horizontal and vertical Margins settings to create space between those objects and the edge of the Container. In order for the margin settings to affect the placement of attached objects, you must specify a Snap Position other than None for those objects.
Container objects support the following Action Events: Resize, Mouse Enter, and Mouse Exit. Click the appropriate tab at the bottom of the Action Editor to create or edit Actions for the events you want to control. See Understanding Actions and Variables and Action Command Reference for a complete discussion of the Action Editor and Action Commands.
Creating Sizeable Publications with Containers
There are some special techniques involved in creating sizeable publications, but with careful planning the process is actually quite easy. The first thing you need to do is decide what your publication’s interface will look like. Generally, most Windows applications are divided into a few distinct interface components: a tool bar, status bar and workspace. More complex applications may include additional elements, but the process is basically the same.
Once you’ve decided on the elements that will make up your publication’s interface, you need to decide where they should go. A typical layout might look like this:
You can reproduce this layout in VisualNEO for Windows by creating three Container objects. Create the Tool Bar Container first and set its Snap Position to “Top”. Next, create the Status Bar Container and set its Snap Position to “Bottom”. Finally, create the Workspace Container and set its Snap Position to “Center.” If needed, adjustments can be made to the heights of the top and bottom Containers, but the snap settings will prevent them from being moved.
To complete the publication, buttons, pictures and other elements can be attached to each of the three base Containers. However, the Workspace Container is special because it will be most affected when the publication is resized at runtime. In a traditional Windows application, the workspace usually consists of a single component. For example, a word processor’s workspace is the area where you enter text. When the word processor window is resized, the text area expands or shrinks, but the formatting controls, status bar and other components retain their basic size and shape.
To create a word processor with VisualNEO for Windows, you would attach a multi-line Text Entry Field object to the workspace Container and set its Snap Position to “Center.” When Center is selected, the object will fill the portion of the workspace that is not occupied by other snapped objects. If the object has been placed on a Container object, as done here, then the selected Snap Position will apply to the bounds of the Container instead of the entire workspace. This is the key to making the whole thing work.
With these simple steps you have created a primitive sizeable text editor. If you run this publication and attempt to resize its window, the Snap Position settings will make sure that the publication’s interface maintains its integrity regardless of the window’s shape. For example:
A short tutorial describing the steps involved in creating a sizeable publication can be found here.