Log In    |    Knowledge Base    |    4D Home
Tech Tip: Object Libraries
Published On: January 4, 2005

4D 2004 introduced a new concept, Object Libraries. An object library is an external file created by 4D, which allows storing all type of usable objects in forms: buttons, texts, pictures, hierarchical lists, etc. Objects are stored with all their properties, including their object methods. Libraries are put together and used by a simple drag and drop or copy-paste. You can think of them as a residual clipboard, where the data can be accessed, manipulated and saved. Using object libraries, you can build form object backgrounds grouped by graphic families, by behavior, etc. Since these libraries are stored as an external file, their usage with different databases is ideal.

To create an object library, select "New" from the File menu. Then select "Object Library...". Give the new object library a name. At this point, a blank window will appear and you can begin copying and pasting objects from your form(s) or other object libraries into this new window. You can even copy grouped objects and paste them into the object library. To specify a name for these objects, double click on an object in the object library and you'll be asked to provide a name.

Note: No link is kept between objects, meaning if you copy more than one instance of the same object onto a form, they are different from one another. To modify objects, you will have to copy them onto a form, edit, delete the old object from the object library, and then copy the modified object back to the object library.