SET WINDOW DOCUMENT ICON
SET WINDOW DOCUMENT ICON ( winRef )
SET WINDOW DOCUMENT ICON ( winRef ; image )
SET WINDOW DOCUMENT ICON ( winRef ; file )
SET WINDOW DOCUMENT ICON ( winRef ; image ; file )
Paramètres | Type | Description | |
---|---|---|---|
winRef | Integer | → | Numéro de référence de la fenêtre |
image | Picture | → | Icône personnalisée |
file | 4D.File, 4D.Folder | → | Chemin d'accès du fichier ou du dossier |
Historique
Release | Modifications |
---|---|
20 R7 | Ajout |
Description
The SET WINDOW DOCUMENT ICON
command allows you to define an icon for windows in multi-window applications using either an image and/or file with the window reference winRef. The icon will be visible within the window itself and on the windows taskbar to help users identify and navigate different windows.
In the case of an MDI application on Windows, you can pass -1
in winRef to set the icon of the main window. In other contexts (macOS or SDI application on Windows), using -1 does nothing.
- If only file is passed, the window uses the icon corresponding to the file type and the file’s path is displayed in the window’s menu.
- If only image is passed, 4D does not show the path and the passed image is used for the window icon.
- If both file and image are passed, the file’s path is displayed in the window’s menu and the passed image is used for the window icon.
- If only winRef is passed or image is empty, the icon is removed on macOS and the default icon is displayed on Windows (application icon).
Exemple
Dans cet exemple, nous voulons créer quatre fenêtres :
- Utilisez l'icône de l'application sous Windows et aucune icône sur macOS (état par défaut quand aucune image ou file n'est utilisée).
- Utilisez une icône "user".
- Associer un document à la fenêtre ( cela utilise l'icône du type de fichier correspondant).
- Personnaliser l'icône associée au document.
var $winRef : Integer
var $userImage : Picture
var $file : 4D.File
// 1- Open "Contact" form
$winRef:=Open form window("Contact";Plain form window+Form has no menu bar)
SET WINDOW DOCUMENT ICON($winRef)
DIALOG("Contact";*)
// 2- Open "Contact" form with "user" icon
$winRef:=Open form window("Contact";Plain form window+Form has no menu bar)
BLOB TO PICTURE(File("/RESOURCES/icon/user.png").getContent();$userImage)
SET WINDOW DOCUMENT ICON($winRef;$userImage)
DIALOG("Contact";*)
// 3- Open "Contact" form associated with the document "user"
$winRef:=Open form window("Contact";Plain form window+Form has no menu bar)
$file:=File("/RESOURCES/files/user.txt")
SET WINDOW DOCUMENT ICON($winRef;$file)
DIALOG("Contact";*)
// 4- Open "Contact" form associated with the document "user" with "user" icon
$winRef:=Open form window("Contact";Plain form window+Form has no menu bar)
BLOB TO PICTURE(File("/RESOURCES/icon/user.png").getContent();$userImage)
$file:=File("/RESOURCES/files/user.txt")
SET WINDOW DOCUMENT ICON($winRef;$userImage;$file)
DIALOG("Contact";*)