4D Blog

Home Product Using 4D libraries within project databases

Using 4D libraries within project databases

November 28, 2019

Product

4D provides libraries to help you develop applications. One of these libraries is standard and contains preconfigured form objects and widgets, while other libraries are custom. The standard library is “read-only” and its behavior doesn’t change when developing project databases (with the exception of minor, cosmetic interface differences). You also have the ability to create your own custom libraries to save your own form objects or group of objects. In this case, a few changes have been made to make them even more powerful. The following is everything you need to know about these changes:

A new library is a new project

When you develop an application as a project, any custom libraries you create will also be projects … regular, standalone projects. Libraries are no longer in “.4dlibrary” folders, even though they behave exactly the same as libraries previously created in binary databases.

two points to consider

can any project be opened as a library?

Before answering this question, you need to understand what a library is. Essentially, a library is a set of forms inside a database structure. Each item in the library’s dialog corresponds to a project form inside this database structure. Therefore, each time you add or remove an object to or from a library, 4D creates or removes a project form from its database structure.

Knowing this, the answer to the above question is “yes”, but there’s two small caveats to be aware of:

  • If you open a regular project as a library, only project forms will appear in the library dialog; All other forms (i.e. table forms) will be ignored. The library dialog will display as many items as there are project forms in your database, no more, no less.
  • On these project forms, only objects belonging to the first form page will be reachable. All other objects (i.e., belonging to page zero or pages other than the first one) will also be ignored.

 

What about my previous (binary) libraries?

Legacy 4D libraries can not be opened when the current database is a project, they must be converted first. This is really a quick and easy operation, so let’s take a look at how:

  • Windows users can skip the first step, otherwise (i.e. you work on macOS) you must rename your library by removing its “.4dlibrary extension” (or replace the “.” by an “_” for example). This renaming action will transform the package into a regular folder that you can open. (You can also use the “show package content” contextual menu, but getting rid of the extension is a better way to go. 🙂  )
  • Once this is done, you’ll see a .4IL file and (probably) a Resources folder. Just change the file extension from .4IL to .4DB.
    Guess what? The file is now a regular 4D file that can be opened by 4D! Open the file and create a .4DD file when prompted.

 

 

The next step is conversion, or to be more precise, “Export”. You may have used this option previously if you’ve already converted legacy (binary) databases into projects.

  • Open the “File” menu  and select “Structure to project” in the Export submenu (File > Export > Structure to project). Once done, you’ll be prompted to open the project. Take a look to see what happens behind the scenes!
  • Quit and the job is completed. Your library is converted!

 

blankblank

 

What’s next?

Now that your binary library has been converted to a project, it can be opened as a library by any other 4D Project!

In the example below, the “Background” form belongs to a database under development. Open the “Alpha” library to get the set of buttons you have saved there, then drag (or copy/paste) to the “Background” form!

blankblank

blank

As you can see, 4D libraries are easier than ever to use. They’re an easy way to share items with coworkers or to save buttons, icons, widgets, etc. Take a look at the documentation to learn even more!

 

 

 

Discuss

Tags Component, Project, Project database, Source control, UI, v18

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

Roland Lannuzel
Roland Lannuzel
• Product Owner & 4D Expert •After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy