KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Naming Shared Forms and Methods in Components
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: April 19, 2021

Be mindful when choosing names for project methods and project forms in component databases. It is important to not have any matching method or form names between a host and its components, as this can cause problems when sharing them.

When a host and component database both have a project method or form with the same name, only the method or form existing in the same database context as the caller can be referenced.

For example, If a host and a component database both have a shared project method named "Method1", calling Method1 from the host will exececute the host's "Method1" code. Calling Method1 from the component will execute the component's "Method1" code. The host database will not be able to call the component's "Method1" method and vice versa. To avoid this, it can be a good idea to add the component name as a prefix to component methods and forms. Ex. ComponentName_MethodName