This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20 R7
SET WINDOW DOCUMENT ICON

SET WINDOW DOCUMENT ICON 


 

SET WINDOW DOCUMENT ICON ( winRef {; image}{; file} ) 
Parameter Type   Description
winRef  Integer in Window reference number
image  Picture in Custom icon
file  4D.File, 4D.Folder in File path or folder path

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. 

  • 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 

Define a different icon for each window (blog post)

 
PROPERTIES 

Product: 4D
Theme: Windows
Number: 1840

 
PAGE CONTENTS 
 
HISTORY 

New
Created: 4D v20 R7

 
ARTICLE USAGE

4D Language Reference ( 4D v20 R7)