How to automate the compilation
Since 4D v19, you can start the compilation of a project with a simple command. You might be wondering what you can use this for!
Your team may consist of several developers, so why not automate the compilation at each code push on your source control server? It is always easier to identify an error when it is quickly detected.
Another case is when your project consists of several components. You can write a method that compiles, builds, and then copies the component to the host database.
This blog will discuss the different technical points that are very useful to create your own automation tools, along with an example application.
Apply naming conventions with Form macros
by guest author Michael Höhne, 4D developer (Munich, Germany)
There’s a feature in 4D v18 R5 that may have been overlooked, or at least hasn’t gotten much attention so far: Form macros. To be honest, I hadn’t spent much time on them either, until recently. In this blog post, I’ll show you a macro that saves a lot of time when applying naming conventions to list box columns, column headers, and footers. You can easily change it to fit your needs. A dedicated repo is also available on Github.
Automate repetitive tasks and more with form macros!
If you’re a fan of macros in the code editor, then 4D v18 R5 has some good news for you … because now macros are also available in the form editor!
Let me start by telling you how useful macros can be for you. Have you ever needed to use formatting or naming rules in your application, then apply them to each new form? Or maybe you’ve had to work on existing forms created by someone else, and always need to do the exact same checks and analyses before getting started. If you’ve ever encountered one of these scenarios, then 4D v18 R5 is for you because it gives you the ability to create macros and save time on predictable, repetitive tasks.
Coder-friendly syntax for class functions and methods
Using $1, $2, and $n variables in your code not only makes the code less readable, it can also increase confusion since the human brain can find it difficult to remember what these variables correspond to. The solution is to create a variable with an understandable name and assign it the value of $1, $2, or $n.
4D v18 R5 has good news, you can now name your parameters when declaring:
- a project method,
- a trigger
- a database method
- a form method
- a constructor of a class
- a function of a class.
Let’s see how!
Preview your CSS directly in the form editor!
In 4D v18 R5, you can preview the final CSS rendering in the form editor WITHOUT running your dialog. Yes, you heard that right. Standardizing and reviving your forms has never been easier!
If you haven’t yet heard about CSS in 4D, now’s the perfect time to learn more! Introduced in 4D v18 for project applications, this concept includes enhanced and quick style sheets based on CSS. I recommend taking a look at this blog post.
Project by default. Binary on demand
Projects were introduced in 4D v17 R5. An architecture representing a giant evolution for 4D applications, projects opened the 4D world to source control tools, collaborative programming, code sharing, modularity, and much more! To make things even better (and simpler), 4D v18 R4 creates new projects by default, while developers – if they choose to do so – can continue to create binary databases via a simple setting.
Project Databases: Build your own documentation for components
In a previous blog post, we showed you that documentation for methods has returned in the Explorer. Want to take things even further and use them as documentation for your components? In this blog post, we’ll show you how!
Project Databases: Method documentation is back
When developing an application, it can be very useful to have quick access to the details of a method (e.g., an explanation of what it does, its syntax, and a definition of the parameters passed to it). This becomes even more important when using a compiled component. You can’t look at the content of the method, so you can only rely on its documentation to understand how to use it.
The Explorer’s dialog has been enhanced and documentation is now available in 4D v18 R3 for project databases.
Define the font size for automatic font
In a previous R-release, we added two new automatic themes to define font and the font size, so there are three automatic themes at your disposal which respect the guidelines of each platform. To design your interface, the automatic theme is the recommended way to go with each form object using the font and size recommended by the OS.
In some cases, you may need more control and have valid reasons to ignore the guidelines. With 4D v18 R3, you can override the size of the automatic themes and have more control over how your text is displayed.
Object-oriented programming in 4D: Manage class inheritance
In a previous blog post, we introduced a very important concept in object-oriented programming: Classes. Now we’ll go through another core concept: Inheritance, the mechanism that allows a class to acquire the behavior of another class.
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