Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions docs/Extensions/develop-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can develop 4D components for your own needs and keep them private. You can

:::note

You can [create a component directly from the host](#creating-components) project without needing to go through a separate matrix project
You can [create a component directly from the host](#creating-components) project without needing to go through a separate matrix project.

:::

Expand All @@ -35,13 +35,13 @@ Creating and installing 4D components is carried out directly from 4D:

:::note

Interpreted component code can be [edited directly from the host project](#editing-components) if the context is supported.
Interpreted component code can be [edited](#editing-components) and [compiled](../Project/compiler.md#compile-components) directly from the host project if the context is supported.

:::

## Creating and editing components from the host

In interpreted mode, the 4D IDE allows you to create and edit components directly from the host project. It facilitates component development and tuning in the actual context of a host project without having to leave or restart it.
In interpreted mode, the 4D IDE allows you to create, edit, and compile components directly from the host project. It facilitates component development and tuning in the actual context of a host project without having to leave or restart it.

### Creating components

Expand All @@ -55,9 +55,10 @@ This action opens a folder selection dialog where you choose where [the componen
* If you decide to store the component **next to the project package**, 4D adds it to the [`dependencies.json`](../Project/components.md#dependenciesjson) file.
* If you decide to store the component **elsewhere**, 4D adds it to the [`dependencies.json`](../Project/components.md#dependenciesjson) file and its path is added to the [`environment4d.json`](../Project/components.md#environment4djson) file, using either a [relative or an absolute path](../Project/components.md#relative-paths-vs-absolute-paths). A relative path is used if the component is located within no more than two levels above as the `environment4d.json` file, or in its subfolders. Otherwise, an absolute path is used.

:::note
:::note Notes

You cannot store a component **in the project package** but **outside the Components folder**.
- You cannot store a component **in the project package** but **outside the Components folder**.
- When a component is created from the host, it is assigned a [default namespace](#default-namespace).

:::

Expand All @@ -80,7 +81,7 @@ In this context, you can open, edit, and save your component code in the Code ed

[Exposed component classes](#sharing-of-classes) and [shared methods](#sharing-of-project-methods) of your component can be edited from the **Component Methods** tab of the Explorer.

A specific icon indicates that the component contains shared code):<br/>
A specific icon indicates that the component contains shared code:<br/>
![](../assets/en/Develop/editable-component.png)

Select **Edit...** to open your component code in the Code editor. You can edit and save it.
Expand Down Expand Up @@ -116,6 +117,11 @@ Standard 4D IDE features are available for the component. You can execute the fo
- run methods,
- restore from trash or empty trash.

### Compiling components

You can compile a component [directly from the host project](../Project/compiler.md#compile-components) without having to open it separately, provided it is compliant with the [requirements](../Project/compiler.md#requirements).



### Search and replace

Expand Down Expand Up @@ -206,7 +212,7 @@ By default, component classes cannot be called from the 4D Code Editor of the ho

### Declaring the component namespace

To allow classes of your component to be exposed in the host projects and their loaded components, enter a value in the [**Component namespace in the class store** option in the General page](../settings/general.md#component-namespace-in-the-class-store) of the matrix project Settings. By default, the area is empty: component classes are not available outside of the component context.
To allow classes of your component to be exposed in the host projects and their loaded components, enter a value in the [**Component namespace in the class store** option in the General page](../settings/general.md#component-namespace-in-the-class-store) of the matrix project Settings. By default, the area is empty (except when the component is [created from the host](#default-namespace)): component classes are not available outside of the component context.

![](../assets/en/settings/namespace.png)

Expand Down Expand Up @@ -237,6 +243,15 @@ Of course, it is recommended to use a distinguished name to avoid any conflict.

A component's ORDA classes are not available in its host project. For example, if there is a dataclass called Employees in your component, you will not be able to use a "cs.Mycomponent.Employee" class in the host project.

#### Default namespace

When a new component is [created from the host](#creating-components), a default namespace is automatically assigned to the component.

The default namespace is the component's name, without characters that do not comply with [property naming rules](../Concepts/identifiers.md#object-properties), if any. For example, for a component named "My Component-2", the default namespace will be "MyComponent2".




### Hidden classes

Just like in any project, you can create hidden classes and functions in the component by prefixing names with an underscore ("_"). When a [component namespace is defined](#declaring-the-component-namespace), hidden classes and functions of the component will not appear as suggestions when using code completion.
Expand All @@ -250,6 +265,8 @@ $rect:=cs.eGeometry._Rectangle.new(10;20)
> Non-hidden functions inside a hidden class appear as suggestions when you use code completion with a class that [inherits](../Concepts/classes.md#inheritance) from it. For example, if a component has a `Teacher` class that inherits from a `_Person` class, code completion for `Teacher` suggests non-hidden functions from `_Person`.




## Code completion for compiled components

To make your component easier to use for developers, you can check the [**Generate syntax file for code completion when compiled** option in the General page](../settings/general.md#component-namespace-in-the-class-store) of the matrix project Settings.
Expand Down
1 change: 1 addition & 0 deletions docs/Notes/updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Read [**What’s new in 4D 21 R5**](https://blog.4d.com/whats-new-in-4d-21-r5/),
#### Highlights

- Support of S/MIME email signing through new [`4D.SMTPTransporter`](../API/SMTPTransporterClass.md) class properties: [`.certificate`](../API/SMTPTransporterClass.md#certificate) or [`.certificateName`](../API/SMTPTransporterClass.md#certificatename) (certificate providing), and [`.certificatePassword`](../API/SMTPTransporterClass.md#certificatepassword).
- You can now [compile a component directly from the host](../Project/compiler.md#compile-components).
- Support of list forms in [**fluent UI** rendering](../FormEditor/forms.md#fluent-ui-rendering) on Windows.
- Direct access to the [4D Corner platform](https://corner.4d.com/) from the [Dependency manager](../Project/components.md#using-4d-corner).
- [**Fixed bug list**](https://bugs.4d.fr/fixedbugslist?version=21_R5): list of all bugs that have been fixed in 4D 21 R5.
Expand Down
65 changes: 64 additions & 1 deletion docs/Project/compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,70 @@ Use the **Previous Error** / **Next Error** commands of the **Method** menu to n

The number of errors found during your first compilations may be daunting, but do not let this put you off. You will soon discover that they often spring from the same source, i.e., non-compliance with certain project conventions. The compiler always provides a [precise diagnosis](#error-file) of the errors in order to help you correct them.

> Compilation requires an appropriate license. Without this license, it is not possible to carry out a compilation (buttons are disabled). Nevertheless, it is still possible to check the syntax and generate Typing methods.
:::note

Compilation requires an [appropriate license](../Admin/licenses.md). Without this license, it is not possible to carry out a compilation (buttons are disabled). Nevertheless, it is still possible to check the syntax and generate Typing methods.

:::

### Compile components

<details><summary>History</summary>

|Release|Changes|
|---|---|
|21 R5|Added|

</details>

While developing your application, you can compile the components used by the host project directly from the host project, without having to open them separately. When the host project contains one or more *eligible* components (see [Requirements](#requirements) below), an additional menu is displayed in the Compiler window. This menu lets you select which project(s) you want to compile:

- the host project only (default)
- the host project and all its eligible components
- a single eligible component among the list of all eligible components.

![](../assets/en/Project/compile-component.png)

:::note

You can open the Compiler window from the **Methods>Component Methods** section of the Explorer: right-click on an eligible component name and select **Compiler...** from the contextuel menu.

:::

A list of components being compiled is displayed in the Compiler window. If an error is detected in a component, its compilation is stopped but the process continues for other components.

- Components with at least one error can be unfolded to display the list of errors and appear **in bold**.
- Components with at least one warning can be unfolded to display the list of warnings.
- Components wihout errors cannot be unfolded.




#### Requirements

To be eligible for compilation from the host project, a component must comply with the following requirements:

- the component uses the [project architecture](../Project/architecture.md),
- the component's [interpreted code](../Concepts/interpreted.md) is available and the component is not [running in compiled mode](#run-compiled),
- the component uses [direct typing](#enabling-direct-typing) declarations.

:::note

The additional menu is not displayed if the project does not contain any eligible component.

:::

#### Compiler features & Settings

All available features of the Compiler window are applied to the selected component(s): **Compile**, **Check syntax**, **Clear compiled code**.

The [Settings](../settings/) cannot be edited when a component is selected (the button is dimmed).

Each component's [settings](../settings/) are applied for the compilation, except the [error file and symbol file generation options](#compilation-options): settings of the host project override the component's options. When enabled, [error and warning file](#error-file) as well as [symbol file](#symbol-file) of each component are stored in the [**Logs** folder of the host project](../Project/architecture.md#logs), within a dedicated folder (the name of the folder is the component name).

When you start a compilation or a syntax check, every processed project is listed in the compiler window. If errors or warnings are detected, they are displayed in hierarchical lists beneath the corresponding project. Projects that contain errors are displayed in **bold**:

![](../assets/en/Project/compile-components-errors.png)

## Run Compiled

Expand Down
4 changes: 2 additions & 2 deletions docs/Project/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ title: Dependencies



The 4D [project architecture](../Project/architecture.md) is modular. You can provide additional functionalities to your 4D projects by installing [**components**](Concepts/components.md) and [**plug-ins**](../Concepts/plug-ins.md). Components are made of 4D code, while plug-ins can be [built using any language](../Extensions/develop-plug-ins.md).
The 4D [project architecture](../Project/architecture.md) is modular. You can provide additional functionalities to your 4D projects by installing [**components**](../Concepts/components.md) and [**plug-ins**](../Concepts/plug-ins.md). Components are made of 4D code, while plug-ins can be [built using any language](../Extensions/develop-plug-ins.md).

You can [develop](../Extensions/develop-components.md) and [build](../Desktop/building.md) your own 4D components, or download public components proposed by 4D or the 4D community on the [**4D Corner platform**](https://corner.4d.com/).

Expand All @@ -16,7 +16,7 @@ Once installed in your 4D environment, extensions are handled as **dependencies*

## Interpreted and compiled components

Components can be interpreted or [compiled](../Desktop/building.md).
Components can be interpreted or [compiled](./compiler.md#compile-components).

- A 4D project running in interpreted mode can use either interpreted or compiled components.
- A 4D project running in compiled mode cannot use interpreted components. In this case, only compiled components can be used.
Expand Down
Binary file modified docs/assets/en/Develop/editable-component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/en/Project/compile-component.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading