仅将 4D 用作前端应用程序

Use 4D only as front end application

我想开发一个完全使用 4D 作为前端并完全使用 Postgres 作为后端的应用程序。可能吗?我不希望在前端(即 4D 端)有任何数据库痕迹。

但这里的问题是opening/running编译好的4D应用程序(exe)或4D打开结构文件时,需要数据文件。 所以我的问题是我们能否取消该对话框,以便我可以完全使用 4D 作为前端。

提前致谢。

我认为你无法压制它。 4D 的核心是一个数据库应用程序,因此它需要一个数据文件。但是你可以有一个空的数据文件。如果您创建了数据文件,下次它会自动重新打开而不会出现对话框。

我想你是,但如果不是,你应该考虑使用 Pluggers 的 PostgreSQL plugin

So my question is can we suppress that dialog so that i could use 4D as front end completely.

您需要有一个数据文件,否则 4D 会提示用户要求创建或打开一个,即使应用程序中没有表格也是如此。

如果您使用的是 v15 或更高版本,您可以利用 Default Data Folder 来帮助您抑制 "select a data file" 对话框。

引自the docs

Opening the data file

When a user launches a new or updated merged application (single-user or client-server) for the first time, 4D tries to select a valid data file. Several locations are examined by the application successively.

The opening sequence for launching a merged application is:

1) 4D tries to open the last data file opened (not applicable during initial launch).

2) If not found, 4D tries to open the data file in a default data folder next to the .4DC file in read-only mode (new in 4D v15, described below).

3) If not found, 4D tries to open the standard default data file (same name and same location as the .4DC file).

4) If not found, 4D displays a standard "Open data file" dialog box.

Defining a default data folder

4D allows you to define a default data file file" at the application building stage. When the application is launched for the first time, if no local data file is found (see sequence described above), the default data file is automatically opened silently in read-only mode by 4D. This gives you better control over data file creation and/or opening when launching a merged application for the first time. More specifically, the following cases are covered:

  • Avoiding the display of the 4D "Open Data File" dialog box when launching a new or updated merged application. You can detect, for example in the On Startup database method, that the default data file has been opened and thus execute your own code and/or dialogs to create or select a local data file.
  • Allowing the distribution of merged applications with read-only data (for demo applications, for instance).

To define and use a default data file:

  • You must provide a default data file (named "Default.4DD") and store it in a default folder (named "Default Data") inside the database package (4dbase). This file must be provided along with all other necessary files, depending on the database configuration: index (.4DIndx), external Blobs, journal, etc. It is your responsibility to provide a valid default data file. Note however that since a default data file is opened in read-only mode, it is recommended to uncheck the "Use Log File" option in the original structure file before creating the data file.
  • When the application is built, the default data folder is integrated into the merged application. All files within this default data folder are also embedded.

The following graphic illustrates this feature:


(source: doc.4d.com)

When the default data file is detected at first launch, it is silently opened in read-only mode, thus allowing you to execute any custom operations that do not modify the data file itself.

有关详细信息,请参阅:
Docs for v15.1+
Docs for v15R4

之前的答案是正确的,空白数据文件应该可以解决您的问题。

至于连接性,您也可以使用 ODBC 连接。唯一的缺点是您必须在每台要 运行 4D 前端的机器上配置连接。然后使用 SQL LOGIN.

将 4D 数据库中的 ODBC 连接指定为数据源