Skip to main content
Version: Next

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 )

ParameterTypeDescription
winRefIntegerWindow reference number
imagePictureCustom icon
file4D.File, 4D.FolderFile path or folder path
History
ReleaseChanges
20 R7Added

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).

Example

In this example, we want to create four windows:

  1. Use the application icon on Windows and no icon on macOS (default state when no image or file is used).
  2. Use a "user" icon.
  3. Associate a document with the window (this uses its file type icon).
  4. Customize the icon associated with the 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";*)

See also

Create entity selection