ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Image control
  • Overview
  • Displaying an image file in an Image control
  • In a page
  • Retrieving the name of the image file displayed in the Image control
  • In a page
  • Retrieving the position of the mouse in a clickable image
  • Clearing or reinitializing the content of an Image control
  • Properties specific to Image controls
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Handling Image controls programmatically
Overview
WINDEV, WEBDEV and WINDEV Mobile allow you to handle an Image control through programming. To do so, use the variable of the Image control in the code.
The variable of Image control corresponds to the name of Image control. This variable is a text variable.
Displaying an image file in an Image control
WEBDEV - Server code

In a page

To display an image file in an Image control, a simple assignment is sufficient.
If the image is available in the "<ProjectName>_WEB", directory, you have the ability to use the following syntaxes:
  • WEBDEV - Server code Server code:
    <Image control> = <Image name>

    Remark: In server code, if the image is available in a directory other than "<ProjectName>_WEB", you must:
    • specify the full path of image.
    • have read rights in this directory.
  • WEBDEV - Browser code Browser code:
    <Image control> = FolderWeb() + <Image name>

    Remark: In the "Details" tab of the Image control description window, you can define the type of assignment in browser code for compatibility. If this option corresponds to "Path in _WEB directory", FolderWeb has no effect. The following syntax can be used:
    <Image control> = <Image name>
    Remark: If the control is bound to a data file item, the value from the data source is automatically updated in the control using FileToPage. For more details, see Linking an Image control to an item.
Retrieving the name of the image file displayed in the Image control
WEBDEV - Server code

In a page

To retrieve the name of the image displayed in an Image control:
  • perform a simple assignment. For example:
    EDT_CurrentImageContent = IMG_Image1
  • use the Value property.
  • use the Caption property (server code only).
WEBDEV - Server code In server code, these syntaxes are used to get the name of the image defined in the "General" tab of the control. Example: ./background.gif
WEBDEV - Browser code In browser code, these syntaxes are used to retrieve the full image name on the server.
Example: http://localhost/addressbook_Web/background_fr.gif
Remark: To retrieve the image (or its name) in the item associated with the Image control,
  1. If the control is associated with a text item, the entered value is automatically retrieved via PageToFile. You also have the ability to use the following notation: CUSTOMER.NAME = EDT_Edit1.
  2. If the control is associated with a binary memo, use HLinkMemo to associate the image file with the item.
    For more details, see Linking an Image control to an item.
Retrieving the position of the mouse in a clickable image
Clearing or reinitializing the content of an Image control
To clear or reinitialize an Image control, all you have to do is assign an empty string to the Image control. For example:
IMG_MyImage = ""

Remark: You also have the ability to use dStartDrawing/dEndDrawing on the Image control.
Properties specific to Image controls
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/06/2023

Send a report | Local help