We are excited to announce a new feature that will enhance the user experience in multi-window applications in 4D 20 R7. With the introduction of the SET WINDOW DOCUMENT ICON command, you now have the ability to define an icon for each type of window, making it easier for users to identify and navigate through different windows.
HDI: Set window document and icon
New command
The SET WINDOW DOCUMENT ICON command allows you to set a custom icon and/or a document for the referenced window using the following syntax:
SET WINDOW DOCUMENT ICON($winRef; $picture)
SET WINDOW DOCUMENT ICON($winRef; $document)
SET WINDOW DOCUMENT ICON($winRef; $picture; $document)
By utilizing this command, you can create a more visually appealing and intuitive interface for your users.
Icons
For example, create three windows,
- the first uses the application icon on Windows and no icon on macOS,
- the second uses a “user” icon,
- and the third with a “product” icon.
var $winRef : Integer
var $userImage ; $productImage : Picture
BLOB TO PICTURE(File("/RESOURCES/icon/user.png").getContent(); $userImage)
BLOB TO PICTURE(File("/RESOURCES/icon/product.png").getContent(); $productImage)
// 1- Open "Contact" form
$winRef:=Open form window("Contact"; Plain form window+Form has no menu bar)
DIALOG("Contact"; *)
// 2- Open "Contact" form with "user" icon
$winRef:=Open form window("Contact"; Plain form window+Form has no menu bar)
SET WINDOW DOCUMENT ICON($winRef; $userImage)
DIALOG("Contact"; *)
// 3- Open "Contact" form with "product" icon
$winRef:=Open form window("Contact"; Plain form window+Form has no menu bar)
SET WINDOW DOCUMENT ICON($winRef; $productImage)
DIALOG("Contact"; *)
The icon will be visible within the window itself…
… and on the Windows taskbar in SDI mode, providing clear visual cues for the user.
Documents
The icon is usually a static image. If the window represents a file or document on disk, you can enable the standard document popup, assigned to the icon, by simply using this code:
var $file : 4D.File
$file:=File("/RESOURCES/files/user.txt")
SET WINDOW DOCUMENT ICON($winRef; $file)
If you associated a document, by default it uses the system icon of this document. You can use another image with this code:
var $image : Picture
var $file : 4D.File
BLOB TO PICTURE(File("/RESOURCES/icon/user.png").getContent(); $image)
$file:=File("/RESOURCES/files/user.txt")
SET WINDOW DOCUMENT ICON($winRef; $image; $file)
If you don’t want a title bar, or if you’d like the icon to be associated with a different action, see Customize appearance with new window types.
Even if you completely customize the title bar, or don’t want to display the title bar at all, the new SET WINDOW DOCUMENT ICON command is still useful, as it changes the icon used in the Windows taskbar.
Next…
There are lots of possibilities for customizing your windows, just take a look at the Windows theme’s documentation.
If you have any comments or suggestions, don’t hesitate to share them on the forum.