With 4D 20 R5, unlocking new possibilities in application customization, two additional window types now offer flexible modal or non-modal windows without title bars. This means complete freedom to tailor your application’s appearance to your exact specifications. Imagine redesigning the title bar to match your desired aesthetics, integrating features like a customized search box or other elements seamlessly.
But that’s not all! We’ve also introduced several new commands designed to streamline your development process:
- Reduce a window in the title bar on Windows or the dock on macOS,
- Know if the window is reduced in the title bar on Windows or the dock on macOS,
- Know if the window if the window is maximized.
New window types
Two new constants can be used with the Open form window command.
$winRef1:=Open form window("myForm1"; Plain form window no title)
$winRef2:=Open form window("myForm2"; Movable form dialog box no title)
Here is an example with a custom title bar:
- A rectangle with the automatic background color. So on macOS, in light mode, the rectangle is white, and in dark mode, the rectangle is black.
- An invisible button above the rectangle. On click, the button triggers the DRAG WINDOW command, enabling the window to be moved.
- Three buttons, Close, Maximize, and Minimize with associated commands MAXIMIZE WINDOW, MINIMIZE WINDOW, and REDUCE RESTORE WINDOW. As for the look of the buttons, a little more work for macOS, rollover is performed on all three buttons simultaneously. So, on the On Mouse enter and On Mouse Leave events, the button icons are modified with the OBJECT SET FORMAT command.
On macOS:
Plain form window no title
Movable form dialog box no title
On WindowS:
Plain form window no title
Movable form dialog box no title
This example in live:
New commands
In addition to these new window types, we have also introduced some handy commands to simplify your development process:
- The REDUCE RESTORE WINDOW allows you to reduce the frontmost window or the named window in the taskbar on Windows in SDI mode or the dock on macOS. If the window is reduced, the command restores it to its previous state.
REDUCE RESTORE WINDOW($winRef)
- The Is window reduced command helps you determine if a window is currently in the reduced state. This knowledge can be leveraged to perform specific actions based on the window’s state.
If(Is window reduced($winRef))
// Do something
End if
- The Is window maximized command lets you know if the window is in the maximized state, so you can easily switch between the maximized and previous states.
If(Is window maximized($winRef))
MINIMUM WINDOW($winRef)
Else
MAXIMIZE WINDOW($winRef)
End if
And…
Please refer to this documentation page for more information on the different window types. Don’t hesitate to share the incredible interfaces you’ve created with this feature on the 4D Forum.