4D Blog

Home Product Define a different icon for each window

Define a different icon for each window

October 29, 2024

Product

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…

blank

… and on the Windows taskbar in SDI mode, providing clear visual cues for the user.

blank

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)

blank
blank

 

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)

blank
blank

 

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.

Discuss

Tags 20 R7, 21, Programming, UI

Latest related posts

  • June 16, 2025

    Generate, share and use web sessions One-Time Passcodes (OTP)

  • May 20, 2025

    Automatic Refresh of OEM Build Licenses

  • May 16, 2025

    New class to handle incoming TCP connections

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor

Tags

4D-Analyzer 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R8 20 R9 Administration Authentication Build application CI/CD Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Microsoft 365 Network Objects ORDA PDF Pictures Preemptive Programming Qodly Studio REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience v20 vscode Web Word processor
Subscribe to 4D Newsletter

© 2025 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy